Skip to content

Commit

Permalink
Set env vars correctly in workflow steps
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 committed Dec 17, 2020
1 parent 10f3fb2 commit 71ed0f2
Show file tree
Hide file tree
Showing 2 changed files with 77 additions and 1 deletion.
7 changes: 6 additions & 1 deletion .github/workflows/publish-images.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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}
Expand Down
71 changes: 71 additions & 0 deletions .github/workflows/remove-me.yaml
Original file line number Diff line number Diff line change
@@ -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

0 comments on commit 71ed0f2

Please sign in to comment.