Skip to content

Commit

Permalink
Set env vars correctly in workflow steps (#152)
Browse files Browse the repository at this point in the history
Signed-off-by: Juraci Paixão Kröhling <juraci@kroehling.de>
  • Loading branch information
jpkrohling authored Dec 17, 2020
1 parent e616b65 commit 26bb32b
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 15 deletions.
12 changes: 9 additions & 3 deletions .github/workflows/publish-images.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,12 @@ jobs:
steps:
- uses: actions/checkout@v2

- name: Unshallow
run: git fetch --prune --unshallow

- name: Describe the current state
run: git describe --tags

- name: Set env vars for the job
run: |
grep -v '\#' versions.txt | grep opentelemetry-collector | awk -F= '{print "OTELCOL_VERSION="$2}' >> $GITHUB_ENV
Expand Down Expand Up @@ -63,8 +69,8 @@ jobs:
labels: ${{ steps.docker_meta.outputs.labels }}
build-args: |
VERSION_PKG=github.com/open-telemetry/opentelemetry-operator/internal/version
VERSION=${VERSION}
VERSION_DATE=${VERSION_DATE}
OTELCOL_VERSION=${OTELCOL_VERSION}
VERSION=${{ env.VERSION }}
VERSION_DATE=${{ env.VERSION_DATE }}
OTELCOL_VERSION=${{ env.OTELCOL_VERSION }}
cache-from: type=local,src=/tmp/.buildx-cache
cache-to: type=local,dest=/tmp/.buildx-cache
24 changes: 12 additions & 12 deletions main.go
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,18 @@ func main() {

// Add flags related to this operator
v := version.Get()
logger := zap.New(zap.UseFlagOptions(&opts))
ctrl.SetLogger(logger)

logger.Info("Starting the OpenTelemetry Operator",
"opentelemetry-operator", v.Operator,
"opentelemetry-collector", v.OpenTelemetryCollector,
"build-date", v.BuildDate,
"go-version", v.Go,
"go-arch", runtime.GOARCH,
"go-os", runtime.GOOS,
)

restConfig := ctrl.GetConfigOrDie()

// builds the operator's configuration
Expand All @@ -89,18 +101,6 @@ func main() {

pflag.Parse()

logger := zap.New(zap.UseFlagOptions(&opts))
ctrl.SetLogger(logger)

logger.Info("Starting the OpenTelemetry Operator",
"opentelemetry-operator", v.Operator,
"opentelemetry-collector", v.OpenTelemetryCollector,
"build-date", v.BuildDate,
"go-version", v.Go,
"go-arch", runtime.GOARCH,
"go-os", runtime.GOOS,
)

watchNamespace, found := os.LookupEnv("WATCH_NAMESPACE")
if found {
setupLog.Info("watching namespace(s)", "namespaces", watchNamespace)
Expand Down

0 comments on commit 26bb32b

Please sign in to comment.