Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Set env vars correctly in workflow steps #152

Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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))
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This has been moved here so that it logs the versions even when a Kubernetes isn't available.

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