Skip to content

Commit

Permalink
wip: test-gha
Browse files Browse the repository at this point in the history
  • Loading branch information
ccwienk committed Nov 18, 2024
1 parent 027724c commit 69caa53
Showing 1 changed file with 104 additions and 0 deletions.
104 changes: 104 additions & 0 deletions .github/workflows/build.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,104 @@
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
permissions:
needs:
- params
- version
- build
steps:
- test
run: |
echo "matrix: ${{ needs.build.outputs.matrix }}"
echo "matrix-direct: ${{ needs.build.matrix }}"

0 comments on commit 69caa53

Please sign in to comment.