Skip to content

wip: test-gha

wip: test-gha #3

Workflow file for this run

name: Build
on:
push:
jobs:
params:
runs-on: ubuntu-latest
outputs:
ocm_repository: ${{ steps.params.outputs.ocm_repository }}
oci_repository: ${{ steps.params.outputs.oci_repository }}
oci_platforms: ${{ steps.params.outputs.oci_platforms }}
steps:
- name: params
id: params
run: |
ocm_repo='europe-docker.pkg.dev/gardener-project/snapshots/test'
oci_repo='europe-docker.pkg.dev/gardener-project/snapshots/test'
oci_platforms='linux/arm64,linux/amd64'
echo "ocm_repository=${ocm_repo}" >> ${GITHUB_OUTPUT}
echo "oci_repository=${oci_repo}" >> ${GITHUB_OUTPUT}
echo "oci_platforms=${oci_platforms}" >> ${GITHUB_OUTPUT}
version: # TODO: this (mostly) copy-pasted from cc-utils; factor-out into re-usable workflow
runs-on: ubuntu-latest
outputs:
effective_version: ${{ steps.version.outputs.effective_version }}
next_version: ${{ steps.version.outputs.next_version }}
repo_version: ${{ steps.version.outputs.repo_version }}
steps:
- uses: actions/checkout@v4
- name: calculate-effective-version
id: version
run: |
src_version="$(cat VERSION | grep -v -e'^#')"
commit=${{ github.sha }}
echo "commit-digest: ${commit}"
major="$(echo ${src_version} | cut -d. -f1)"
minor="$(echo ${src_version} | cut -d. -f2)"
patch="$(echo ${src_version} | cut -d. -f3 | cut -d- -f1)"
if ${{ inputs.release || false }}; then
effective_version=${major}.${minor}.${patch}
# hardcode to bumping "minor" for now
next_minor=$(( $minor + 1 ))
next_version="${major}.${next_minor}.${patch}-dev"
echo "next_version=${next_version}" >> "${GITHUB_OUTPUT}"
echo "next_version=${next_version}"
else
effective_version=${major}.${minor}.${patch}-${commit}
fi
echo "effective-version: ${effective_version}"
echo "effective_version=${effective_version}" >> "${GITHUB_OUTPUT}"
echo "repo_version=${src_version}" >> "${GITHUB_OUTPUT}"
build:
runs-on: ubuntu-latest
permissions:
id-token: write
needs:
- params
- version
strategy:
matrix:
image:
- name: concourse-worker
dockerfile: concourse-worker.dockerfile
# todo: handle build-args
- name: concourse-web
dockerfile: concourse-web.dockerfile
- name: concourse-resource-git
dockerfile: concourse-resource-git.dockerfile
- name: concourse-resource-time
dockerfile: concourse-resource-time.dockerfile
outputs:
matrix: ${{ matrix }}
steps:
- uses: actions/checkout@v4
- name: prebuild-hook
if: ${{ matrix.image.name == 'concourse-worker' }}
run: |
./prebuild-registry-resource.sh
- name: Build OCI Image
uses: gardener/cc-utils/.github/actions/ocm-oci-build@gha-ocm-imagebuild
with:
name: ${{ matrix.image.name }}
repository: ${{ needs.params.outputs.oci_repository}}/${{ matrix.image.name }}
version: ${{ needs.version.outputs.effective_version }}
context: .
dockerfile: ${{ matrix.image.dockerfile }}
component_descriptor:
runs-on: ubuntu-latest
needs:
- params
- version
- build
steps:
- name: test
run: |
echo "matrix: ${{ needs.build.outputs.matrix }}"
echo "matrix-direct: ${{ needs.build.matrix }}"