From 26a8ef90245eb8af4a0c247c377df6e8d8115f0d Mon Sep 17 00:00:00 2001 From: Tyler Gillson Date: Thu, 3 Jul 2025 19:26:24 -0600 Subject: [PATCH 1/4] ci: dedupe env setup & greedy trim github ref until final '/' Signed-off-by: Tyler Gillson --- .../actions/prepare-release-env/action.yml | 58 +++++++++++++++++++ .github/workflows/chart-upload.yml | 31 +++------- .github/workflows/release.yml | 31 +++------- .github/workflows/releaseimage.yml | 29 +++------- 4 files changed, 81 insertions(+), 68 deletions(-) create mode 100644 .github/actions/prepare-release-env/action.yml diff --git a/.github/actions/prepare-release-env/action.yml b/.github/actions/prepare-release-env/action.yml new file mode 100644 index 00000000..d626e7e1 --- /dev/null +++ b/.github/actions/prepare-release-env/action.yml @@ -0,0 +1,58 @@ +name: 'Prepare Release Environment' +description: 'Prepare release environment variables and matrix' + +inputs: + github_ref: + description: 'GitHub reference' + required: true + default: ${{ github.ref }} + +outputs: + MAJOR_RELEASE_VERSION: + description: 'Major release version' + value: ${{ steps.env-vars.outputs.MAJOR_RELEASE_VERSION }} + RELEASE_VERSION: + description: 'Release version' + value: ${{ steps.env-vars.outputs.RELEASE_VERSION }} + TRIMMED_RELEASE_VERSION: + description: 'Trimmed release version' + value: ${{ steps.env-vars.outputs.TRIMMED_RELEASE_VERSION }} + MATRIX: + description: 'Generated matrix' + value: ${{ steps.generate-matrix.outputs.matrix }} + +runs: + using: 'composite' + steps: + - name: checkout code + uses: actions/checkout@v4 + with: + fetch-depth: 1 + path: go/src/open-cluster-management.io/lab + + - name: get release version + shell: bash + run: | + echo "RELEASE_VERSION=${GITHUB_REF##*/}" >> $GITHUB_ENV + env: + GITHUB_REF: ${{ inputs.github_ref }} + + - name: get major release version + shell: bash + run: | + echo "MAJOR_RELEASE_VERSION=${RELEASE_VERSION%.*}" >> $GITHUB_ENV + echo "TRIMMED_RELEASE_VERSION=${RELEASE_VERSION#v}" >> $GITHUB_ENV + + - name: set outputs + id: env-vars + shell: bash + run: | + echo "MAJOR_RELEASE_VERSION=${MAJOR_RELEASE_VERSION}" >> $GITHUB_OUTPUT + echo "RELEASE_VERSION=${RELEASE_VERSION}" >> $GITHUB_OUTPUT + echo "TRIMMED_RELEASE_VERSION=${TRIMMED_RELEASE_VERSION}" >> $GITHUB_OUTPUT + + - name: generate matrix + id: generate-matrix + uses: ./go/src/open-cluster-management.io/lab/.github/actions/generate-repo-matrix + with: + repoRoot: go/src/open-cluster-management.io/lab \ No newline at end of file diff --git a/.github/workflows/chart-upload.yml b/.github/workflows/chart-upload.yml index 58c363a9..38cb3012 100644 --- a/.github/workflows/chart-upload.yml +++ b/.github/workflows/chart-upload.yml @@ -12,31 +12,16 @@ jobs: name: prepare release env runs-on: ubuntu-latest steps: - - name: checkout code - uses: actions/checkout@v4 + - name: prepare release environment + id: prepare-env + uses: ./go/src/open-cluster-management.io/lab/.github/actions/prepare-release-env with: - fetch-depth: 1 - path: go/src/open-cluster-management.io/lab - - - name: get release version - run: | - echo "RELEASE_VERSION=${GITHUB_REF#refs/tags/}" >> $GITHUB_ENV - - - name: get major release version - run: | - echo "MAJOR_RELEASE_VERSION=${RELEASE_VERSION%.*}" >> $GITHUB_ENV - echo "TRIMMED_RELEASE_VERSION=${RELEASE_VERSION#v}" >> $GITHUB_ENV - - - name: generate matrix - id: generate-matrix - uses: ./go/src/open-cluster-management.io/lab/.github/actions/generate-repo-matrix - with: - repoRoot: go/src/open-cluster-management.io/lab + github_ref: ${{ github.ref }} outputs: - MAJOR_RELEASE_VERSION: ${{ env.MAJOR_RELEASE_VERSION }} - RELEASE_VERSION: ${{ env.RELEASE_VERSION }} - TRIMMED_RELEASE_VERSION: ${{ env.TRIMMED_RELEASE_VERSION }} - MATRIX: ${{ steps.generate-matrix.outputs.matrix }} + MAJOR_RELEASE_VERSION: ${{ steps.prepare-env.outputs.MAJOR_RELEASE_VERSION }} + RELEASE_VERSION: ${{ steps.prepare-env.outputs.RELEASE_VERSION }} + TRIMMED_RELEASE_VERSION: ${{ steps.prepare-env.outputs.TRIMMED_RELEASE_VERSION }} + MATRIX: ${{ steps.prepare-env.outputs.MATRIX }} upload: name: upload diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index acf77b7d..7cc8a588 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -23,31 +23,16 @@ jobs: name: prepare release env runs-on: ubuntu-latest steps: - - name: checkout code - uses: actions/checkout@v4 - with: - fetch-depth: 1 - path: go/src/open-cluster-management.io/lab - - - name: get release version - run: | - echo "RELEASE_VERSION=${GITHUB_REF#refs/tags/}" >> $GITHUB_ENV - - - name: get major release version - run: | - echo "MAJOR_RELEASE_VERSION=${RELEASE_VERSION%.*}" >> $GITHUB_ENV - echo "TRIMMED_RELEASE_VERSION=${RELEASE_VERSION#v}" >> $GITHUB_ENV - - - name: generate matrix - id: generate-matrix - uses: ./go/src/open-cluster-management.io/lab/.github/actions/generate-repo-matrix + - name: prepare release environment + id: prepare-env + uses: ./go/src/open-cluster-management.io/lab/.github/actions/prepare-release-env with: - repoRoot: go/src/open-cluster-management.io/lab + github_ref: ${{ github.ref }} outputs: - MAJOR_RELEASE_VERSION: ${{ env.MAJOR_RELEASE_VERSION }} - RELEASE_VERSION: ${{ env.RELEASE_VERSION }} - TRIMMED_RELEASE_VERSION: ${{ env.TRIMMED_RELEASE_VERSION }} - MATRIX: ${{ steps.generate-matrix.outputs.matrix }} + MAJOR_RELEASE_VERSION: ${{ steps.prepare-env.outputs.MAJOR_RELEASE_VERSION }} + RELEASE_VERSION: ${{ steps.prepare-env.outputs.RELEASE_VERSION }} + TRIMMED_RELEASE_VERSION: ${{ steps.prepare-env.outputs.TRIMMED_RELEASE_VERSION }} + MATRIX: ${{ steps.prepare-env.outputs.MATRIX }} release: name: release diff --git a/.github/workflows/releaseimage.yml b/.github/workflows/releaseimage.yml index 77da6b66..737dcaaf 100644 --- a/.github/workflows/releaseimage.yml +++ b/.github/workflows/releaseimage.yml @@ -24,30 +24,15 @@ jobs: name: prepare release env runs-on: ubuntu-latest steps: - - name: checkout code - uses: actions/checkout@v4 - with: - fetch-depth: 1 - path: go/src/open-cluster-management.io/lab - - - name: get release version - run: | - echo "RELEASE_VERSION=${GITHUB_REF#refs/tags/}" >> $GITHUB_ENV - - - name: get major release version - run: | - echo "MAJOR_RELEASE_VERSION=${RELEASE_VERSION%.*}" >> $GITHUB_ENV - echo "TRIMMED_RELEASE_VERSION=${RELEASE_VERSION#v}" >> $GITHUB_ENV - - - name: generate matrix - id: generate-matrix - uses: ./go/src/open-cluster-management.io/lab/.github/actions/generate-repo-matrix + - name: prepare release environment + id: prepare-env + uses: ./go/src/open-cluster-management.io/lab/.github/actions/prepare-release-env with: - repoRoot: go/src/open-cluster-management.io/lab + github_ref: ${{ github.ref }} outputs: - MAJOR_RELEASE_VERSION: ${{ env.MAJOR_RELEASE_VERSION }} - RELEASE_VERSION: ${{ env.RELEASE_VERSION }} - MATRIX: ${{ steps.generate-matrix.outputs.matrix }} + MAJOR_RELEASE_VERSION: ${{ steps.prepare-env.outputs.MAJOR_RELEASE_VERSION }} + RELEASE_VERSION: ${{ steps.prepare-env.outputs.RELEASE_VERSION }} + MATRIX: ${{ steps.prepare-env.outputs.MATRIX }} images: name: images From c86980d5896c09e60ccf8a6b441dfcc3a71175a5 Mon Sep 17 00:00:00 2001 From: Tyler Gillson Date: Thu, 3 Jul 2025 19:31:59 -0600 Subject: [PATCH 2/4] ci: fix image release Signed-off-by: Tyler Gillson --- .github/workflows/releaseimage.yml | 4 ++-- README.md | 4 ++++ 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/.github/workflows/releaseimage.yml b/.github/workflows/releaseimage.yml index 737dcaaf..111bba18 100644 --- a/.github/workflows/releaseimage.yml +++ b/.github/workflows/releaseimage.yml @@ -47,7 +47,7 @@ jobs: uses: actions/checkout@v4 with: fetch-depth: 1 - path: go/src/open-cluster-management.io/lab + path: go/src/open-cluster-management.io/lab/${{ matrix.repository }} - name: install Go uses: actions/setup-go@v5 @@ -86,7 +86,7 @@ jobs: uses: actions/checkout@v4 with: fetch-depth: 1 - path: go/src/open-cluster-management.io/lab + path: go/src/open-cluster-management.io/lab/${{ matrix.repository }} - name: create run: | diff --git a/README.md b/README.md index 8eb2ea0b..3da7b9c5 100644 --- a/README.md +++ b/README.md @@ -53,6 +53,10 @@ All projects must define the following `make` targets: - `check-diff`: Perform any automated formatting, Helm chart README updates, manifest generation, etc. Return a non-zero exit code if a git diff is produced. - `test-e2e`: Invoke end-to-end tests and return an exit code accordingly. - `test-unit`: Invoke unit tests and return an exit code accordingly. +- `images`: Build all container images. +- `image-push`: Push all container images. +- `image-manifest`: Create multi-architecture manifests for all images. +- `image-manifest-annotate`: Annotate multi-architecture manifests for all images. #### Dockerfiles From 259776614eb28dd9a9b680c84930018ac20fae17 Mon Sep 17 00:00:00 2001 From: Tyler Gillson Date: Fri, 4 Jul 2025 07:30:24 -0600 Subject: [PATCH 3/4] chore: tweak descriptions Signed-off-by: Tyler Gillson --- .github/actions/prepare-release-env/action.yml | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/.github/actions/prepare-release-env/action.yml b/.github/actions/prepare-release-env/action.yml index d626e7e1..931b3fe2 100644 --- a/.github/actions/prepare-release-env/action.yml +++ b/.github/actions/prepare-release-env/action.yml @@ -1,24 +1,24 @@ -name: 'Prepare Release Environment' -description: 'Prepare release environment variables and matrix' +name: Prepare Release Environment +description: Prepare release environment variables and repository matrix inputs: github_ref: - description: 'GitHub reference' + description: GitHub reference required: true default: ${{ github.ref }} outputs: MAJOR_RELEASE_VERSION: - description: 'Major release version' + description: Major release version value: ${{ steps.env-vars.outputs.MAJOR_RELEASE_VERSION }} RELEASE_VERSION: - description: 'Release version' + description: Release version value: ${{ steps.env-vars.outputs.RELEASE_VERSION }} TRIMMED_RELEASE_VERSION: - description: 'Trimmed release version' + description: Trimmed release version value: ${{ steps.env-vars.outputs.TRIMMED_RELEASE_VERSION }} MATRIX: - description: 'Generated matrix' + description: Repository matrix value: ${{ steps.generate-matrix.outputs.matrix }} runs: @@ -55,4 +55,4 @@ runs: id: generate-matrix uses: ./go/src/open-cluster-management.io/lab/.github/actions/generate-repo-matrix with: - repoRoot: go/src/open-cluster-management.io/lab \ No newline at end of file + repoRoot: go/src/open-cluster-management.io/lab From c43d953dbba593ab93bb2fc10d4a9e6befe21866 Mon Sep 17 00:00:00 2001 From: Tyler Gillson Date: Fri, 4 Jul 2025 07:34:22 -0600 Subject: [PATCH 4/4] ci: checkout outside composite prepare-release-env action Signed-off-by: Tyler Gillson --- .github/actions/prepare-release-env/action.yml | 6 ------ .github/workflows/chart-upload.yml | 6 ++++++ .github/workflows/release.yml | 6 ++++++ .github/workflows/releaseimage.yml | 6 ++++++ 4 files changed, 18 insertions(+), 6 deletions(-) diff --git a/.github/actions/prepare-release-env/action.yml b/.github/actions/prepare-release-env/action.yml index 931b3fe2..8c184925 100644 --- a/.github/actions/prepare-release-env/action.yml +++ b/.github/actions/prepare-release-env/action.yml @@ -24,12 +24,6 @@ outputs: runs: using: 'composite' steps: - - name: checkout code - uses: actions/checkout@v4 - with: - fetch-depth: 1 - path: go/src/open-cluster-management.io/lab - - name: get release version shell: bash run: | diff --git a/.github/workflows/chart-upload.yml b/.github/workflows/chart-upload.yml index 38cb3012..c35eb6bf 100644 --- a/.github/workflows/chart-upload.yml +++ b/.github/workflows/chart-upload.yml @@ -12,6 +12,12 @@ jobs: name: prepare release env runs-on: ubuntu-latest steps: + - name: checkout code + uses: actions/checkout@v4 + with: + fetch-depth: 1 + path: go/src/open-cluster-management.io/lab + - name: prepare release environment id: prepare-env uses: ./go/src/open-cluster-management.io/lab/.github/actions/prepare-release-env diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 7cc8a588..faace473 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -23,6 +23,12 @@ jobs: name: prepare release env runs-on: ubuntu-latest steps: + - name: checkout code + uses: actions/checkout@v4 + with: + fetch-depth: 1 + path: go/src/open-cluster-management.io/lab + - name: prepare release environment id: prepare-env uses: ./go/src/open-cluster-management.io/lab/.github/actions/prepare-release-env diff --git a/.github/workflows/releaseimage.yml b/.github/workflows/releaseimage.yml index 111bba18..ac9be7cc 100644 --- a/.github/workflows/releaseimage.yml +++ b/.github/workflows/releaseimage.yml @@ -24,6 +24,12 @@ jobs: name: prepare release env runs-on: ubuntu-latest steps: + - name: checkout code + uses: actions/checkout@v4 + with: + fetch-depth: 1 + path: go/src/open-cluster-management.io/lab + - name: prepare release environment id: prepare-env uses: ./go/src/open-cluster-management.io/lab/.github/actions/prepare-release-env