From e8307ecc4b5e2396dac584793eb9f2226c08f135 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Juraci=20Paix=C3=A3o=20Kr=C3=B6hling?= Date: Thu, 17 Dec 2020 11:07:02 +0100 Subject: [PATCH] Set env vars correctly in workflow steps MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Juraci Paixão Kröhling --- .github/workflows/publish-images.yaml | 12 +++++++++--- main.go | 24 ++++++++++++------------ 2 files changed, 21 insertions(+), 15 deletions(-) diff --git a/.github/workflows/publish-images.yaml b/.github/workflows/publish-images.yaml index b0b886ad6b..122479a305 100644 --- a/.github/workflows/publish-images.yaml +++ b/.github/workflows/publish-images.yaml @@ -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 @@ -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 diff --git a/main.go b/main.go index 120ae50830..3fe73dbe27 100644 --- a/main.go +++ b/main.go @@ -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 @@ -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)