From 71ed0f21592e0acde206aca983321481f8ae485a 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 | 7 ++- .github/workflows/remove-me.yaml | 71 +++++++++++++++++++++++++++ 2 files changed, 77 insertions(+), 1 deletion(-) create mode 100644 .github/workflows/remove-me.yaml diff --git a/.github/workflows/publish-images.yaml b/.github/workflows/publish-images.yaml index b0b886ad6b..739d782db9 100644 --- a/.github/workflows/publish-images.yaml +++ b/.github/workflows/publish-images.yaml @@ -54,6 +54,11 @@ jobs: - name: Build and push Operator image uses: docker/build-push-action@v2 + env: + VERSION_PKG: github.com/open-telemetry/opentelemetry-operator/internal/version + VERSION: ${{ env.VERSION }} + VERSION_DATE: ${{ env.VERSION_DATE }} + OTELCOL_VERSION: ${{ env.OTELCOL_VERSION }} with: context: . file: ./Dockerfile @@ -62,7 +67,7 @@ jobs: tags: ${{ steps.docker_meta.outputs.tags }} labels: ${{ steps.docker_meta.outputs.labels }} build-args: | - VERSION_PKG=github.com/open-telemetry/opentelemetry-operator/internal/version + VERSION_PKG=${VERSION_PKG} VERSION=${VERSION} VERSION_DATE=${VERSION_DATE} OTELCOL_VERSION=${OTELCOL_VERSION} diff --git a/.github/workflows/remove-me.yaml b/.github/workflows/remove-me.yaml new file mode 100644 index 0000000000..9a01d5d5fa --- /dev/null +++ b/.github/workflows/remove-me.yaml @@ -0,0 +1,71 @@ +name: "Remove me before merging" + +on: + pull_request: + branches: [ master ] + +jobs: + publish-containers: + name: Publish container images + runs-on: ubuntu-20.04 + steps: + - uses: actions/checkout@v2 + + - name: Set env vars for the job + run: | + grep -v '\#' versions.txt | grep opentelemetry-collector | awk -F= '{print "OTELCOL_VERSION="$2}' >> $GITHUB_ENV + echo "VERSION_DATE=$(date -u +'%Y-%m-%dT%H:%M:%SZ')" >> $GITHUB_ENV + echo "VERSION=$(git describe --tags | sed 's/^v//')" >> $GITHUB_ENV + + - name: Docker meta + id: docker_meta + uses: crazy-max/ghaction-docker-meta@v1 + with: + images: quay.io/opentelemetry/opentelemetry-operator + tag-semver: | + {{raw}} + {{version}} + {{major}}.{{minor}} + + - name: Set up QEMU + uses: docker/setup-qemu-action@v1 + + - name: Set up Docker Buildx + uses: docker/setup-buildx-action@v1 + + - name: Cache Docker layers + uses: actions/cache@v2 + with: + path: /tmp/.buildx-cache + key: ${{ runner.os }}-buildx-${{ github.sha }} + restore-keys: | + ${{ runner.os }}-buildx- + + - name: Login to Quay + uses: docker/login-action@v1 + with: + registry: quay.io + username: ${{ secrets.QUAY_USERNAME }} + password: ${{ secrets.QUAY_PASSWORD }} + + - name: Build and push Operator image + uses: docker/build-push-action@v2 + env: + VERSION_PKG: github.com/open-telemetry/opentelemetry-operator/internal/version + VERSION: ${{ env.VERSION }} + VERSION_DATE: ${{ env.VERSION_DATE }} + OTELCOL_VERSION: ${{ env.OTELCOL_VERSION }} + with: + context: . + file: ./Dockerfile + platforms: linux/amd64 + push: ${{ github.event_name != 'pull_request' }} + tags: ${{ steps.docker_meta.outputs.tags }} + labels: ${{ steps.docker_meta.outputs.labels }} + build-args: | + VERSION_PKG=${VERSION_PKG} + VERSION=${VERSION} + VERSION_DATE=${VERSION_DATE} + OTELCOL_VERSION=${OTELCOL_VERSION} + cache-from: type=local,src=/tmp/.buildx-cache + cache-to: type=local,dest=/tmp/.buildx-cache