Skip to content

Output for storing image build information in a single place (DRY) #159

Output for storing image build information in a single place (DRY)

Output for storing image build information in a single place (DRY) #159

Workflow file for this run

name: "CI Pipeline"
on:
push:
branches: [main]
paths-ignore:
- "**/*.md"
pull_request:
# Allow to run this workflow manually
workflow_dispatch:
jobs:
########################################
# Jobs operating on the whole repository
########################################
security-jobs:
uses: ./.github/workflows/security-jobs.yml
secrets: inherit # so the backend workflow can access "secrets.SLACK_WEBHOOK_URL" and others
permissions:
contents: read
security-events: write # trivy scan needs this
# Due to a GitHub bug (https://github.com/actions/runner/issues/480),
# we need to set the env vars manually for our use case
setup-env-vars:
runs-on: ubuntu-latest
steps:
- name: Set docker image related environment variables
run: |
echo "GITHUB_RUN_ID=${{ github.run_id }}" >> $GITHUB_ENV
echo "CONTAINER_REGISTRY=ghr.io" >> $GITHUB_ENV
echo "CONTAINER_IMAGE_NAME={{ github.repository }}" >> $GITHUB_ENV
echo "CONTAINER_IMAGE_VERSION=${{ github.event.pull_request.head.sha || github.sha }} >> $GITHUB_ENV
- name: Show env vars
run: echo $GITHUB_ENV
###############
# Frontend jobs
###############
frontend-checks:
uses: ./.github/workflows/frontend-checks.yml
secrets: inherit
frontend-build-image-and-scan:
uses: ./.github/workflows/frontend-build-image-and-scan.yml
secrets: inherit
needs:
- setup-env-vars
permissions:
contents: read
security-events: write
with:
run-id: ${{ env.GITHUB_RUN_ID }}

Check failure on line 55 in .github/workflows/pipeline.yml

View workflow run for this annotation

GitHub Actions / CI Pipeline

Invalid workflow file

The workflow is not valid. .github/workflows/pipeline.yml (Line: 55, Col: 15): Unrecognized named-value: 'env'. Located at position 1 within expression: env.GITHUB_RUN_ID .github/workflows/pipeline.yml (Line: 56, Col: 27): Unrecognized named-value: 'env'. Located at position 1 within expression: env.CONTAINER_REGISTRY
container-registry: ${{ env.CONTAINER_REGISTRY }}
container-image-name: ${{ env.CONTAINER_IMAGE_NAME }}
container-image-version: ${{ env.CONTAINER_IMAGE_VERSION }}
frontend-push-image-to-registry:
if: ${{ github.ref == 'refs/heads/main' }}
# For PR releases, labels could be used like this:
# if: ${{ github.ref == 'refs/heads/main' || contains(github.event.pull_request.labels.*.name, 'dev-env') || contains(github.event.labeled.labels.*.name, 'dev-env') }}
uses: ./.github/workflows/frontend-push-image-to-registry.yml
secrets: inherit
permissions:
contents: read
id-token: write # This is used to complete the identity challenge with sigstore/fulcio..
packages: write
needs:
- setup-env-vars
- security-jobs
- frontend-checks
- frontend-build-image-and-scan
with:
run-id: ${{ github.run_id }}
container-registry: ghcr.io
container-image-name: ${{ github.repository }}
container-image-version: ${{ github.event.pull_request.head.sha || github.sha }}
frontend-deploy-staging:
if: ${{ github.ref == 'refs/heads/main' }}
uses: ./.github/workflows/frontend-deploy-staging.yml
needs:
- setup-env-vars
- security-jobs
- frontend-checks
- frontend-build-image-and-scan
- frontend-push-image-to-registry
permissions:
id-token: write
secrets: inherit
with:
container-image-version: ${{ github.event.pull_request.head.sha || github.sha }}