Skip to content

Commit 629bd6c

Browse files
build: Parameterized build system for company forks (#4605)
* build: started parameterized release process Signed-off-by: Kostis Kapelonis <[email protected]> * build: custom step for registry name Signed-off-by: Kostis Kapelonis <[email protected]> * build: document releases from internal forks Signed-off-by: Kostis Kapelonis <[email protected]> * build: also pass custom registry to manifests Signed-off-by: Kostis Kapelonis <[email protected]> --------- Signed-off-by: Kostis Kapelonis <[email protected]>
1 parent 348260a commit 629bd6c

File tree

5 files changed

+57
-15
lines changed

5 files changed

+57
-15
lines changed

.github/workflows/docker-publish.yml

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,10 @@ concurrency:
1515

1616
permissions: {}
1717

18+
env:
19+
# Registry namespace - defaults to 'argoproj', override via GitHub vars
20+
REGISTRY_NAMESPACE: ${{ vars.REGISTRY_NAMESPACE || 'argoproj' }}
21+
1822
jobs:
1923
set-vars:
2024
permissions:
@@ -31,7 +35,7 @@ jobs:
3135
uses: docker/metadata-action@v5
3236
with:
3337
images: |
34-
quay.io/argoproj/argo-rollouts
38+
quay.io/${{ env.REGISTRY_NAMESPACE }}/argo-rollouts
3539
tags: |
3640
type=ref,event=branch,enable=${{ github.ref != 'refs/heads/master'}}
3741
type=raw,value=latest,enable=${{ github.ref == 'refs/heads/master' }}
@@ -41,7 +45,7 @@ jobs:
4145
uses: docker/metadata-action@v5
4246
with:
4347
images: |
44-
quay.io/argoproj/kubectl-argo-rollouts
48+
quay.io/${{ env.REGISTRY_NAMESPACE }}/kubectl-argo-rollouts
4549
tags: |
4650
type=ref,event=branch,enable=${{ github.ref != 'refs/heads/master'}}
4751
type=raw,value=latest,enable=${{ github.ref == 'refs/heads/master' }}

.github/workflows/release.yaml

Lines changed: 27 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -10,14 +10,30 @@ env:
1010
GOLANG_VERSION: '1.24' # Note: go-version must also be set in job controller-image.with.go-version & plugin-image.with.go-version.
1111

1212
jobs:
13+
# Central registry namespace configuration - Allows override of the registry namespace via GitHub vars. Defaults to 'argoproj'
14+
set-registry-namespace:
15+
runs-on: ubuntu-latest
16+
outputs:
17+
registry_namespace: ${{ steps.set.outputs.registry_namespace }}
18+
steps:
19+
- name: Set registry namespace
20+
id: set
21+
run: |
22+
REGISTRY_NAMESPACE="${{ vars.REGISTRY_NAMESPACE }}"
23+
if [ -z "$REGISTRY_NAMESPACE" ]; then
24+
REGISTRY_NAMESPACE="argoproj"
25+
fi
26+
echo "registry_namespace=$REGISTRY_NAMESPACE" >> $GITHUB_OUTPUT
27+
1328
controller-image:
29+
needs: set-registry-namespace
1430
permissions:
1531
contents: read
1632
packages: write # Required and used to push images to `ghcr.io` if used.
1733
id-token: write # For creating OIDC tokens for signing.
1834
uses: ./.github/workflows/image-reuse.yaml
1935
with:
20-
quay_image_name: quay.io/argoproj/argo-rollouts:${{ github.ref_name }}
36+
quay_image_name: quay.io/${{ needs.set-registry-namespace.outputs.registry_namespace }}/argo-rollouts:${{ github.ref_name }}
2137
# Note: cannot use env variables to set go-version (https://docs.github.com/en/actions/using-workflows/reusing-workflows#limitations)
2238
go-version: '1.24'
2339
platforms: linux/amd64,linux/arm64
@@ -27,13 +43,14 @@ jobs:
2743
quay_password: ${{ secrets.QUAY_ROBOT_TOKEN }}
2844

2945
plugin-image:
46+
needs: set-registry-namespace
3047
permissions:
3148
contents: read
3249
packages: write # Required and used to push images to `ghcr.io` if used.
3350
id-token: write # For creating OIDC tokens for signing.
3451
uses: ./.github/workflows/image-reuse.yaml
3552
with:
36-
quay_image_name: quay.io/argoproj/kubectl-argo-rollouts:${{ github.ref_name }}
53+
quay_image_name: quay.io/${{ needs.set-registry-namespace.outputs.registry_namespace }}/kubectl-argo-rollouts:${{ github.ref_name }}
3754
# Note: cannot use env variables to set go-version (https://docs.github.com/en/actions/using-workflows/reusing-workflows#limitations)
3855
go-version: '1.24'
3956
platforms: linux/amd64,linux/arm64
@@ -46,14 +63,15 @@ jobs:
4663
controller-image-provenance:
4764
needs:
4865
- controller-image
66+
- set-registry-namespace
4967
permissions:
5068
actions: read # for detecting the Github Actions environment.
5169
id-token: write # for creating OIDC tokens for signing.
5270
packages: write # for uploading attestations. (https://github.com/slsa-framework/slsa-github-generator/blob/main/internal/builders/container/README.md#known-issues)
5371
# Must be refernced by a tag. https://github.com/slsa-framework/slsa-github-generator/blob/main/internal/builders/container/README.md#referencing-the-slsa-generator
5472
uses: slsa-framework/slsa-github-generator/.github/workflows/[email protected]
5573
with:
56-
image: quay.io/argoproj/argo-rollouts
74+
image: quay.io/${{ needs.set-registry-namespace.outputs.registry_namespace }}/argo-rollouts
5775
digest: ${{ needs.controller-image.outputs.image-digest }}
5876
secrets:
5977
registry-username: ${{ secrets.QUAY_USERNAME }}
@@ -62,20 +80,22 @@ jobs:
6280
plugin-image-provenance:
6381
needs:
6482
- plugin-image
83+
- set-registry-namespace
6584
permissions:
6685
actions: read # for detecting the Github Actions environment.
6786
id-token: write # for creating OIDC tokens for signing.
6887
packages: write # for uploading attestations. (https://github.com/slsa-framework/slsa-github-generator/blob/main/internal/builders/container/README.md#known-issues)
6988
# Must be refernced by a tag. https://github.com/slsa-framework/slsa-github-generator/blob/main/internal/builders/container/README.md#referencing-the-slsa-generator
7089
uses: slsa-framework/slsa-github-generator/.github/workflows/[email protected]
7190
with:
72-
image: quay.io/argoproj/kubectl-argo-rollouts
91+
image: quay.io/${{ needs.set-registry-namespace.outputs.registry_namespace }}/kubectl-argo-rollouts
7392
digest: ${{ needs.plugin-image.outputs.image-digest }}
7493
secrets:
7594
registry-username: ${{ secrets.QUAY_USERNAME }}
7695
registry-password: ${{ secrets.QUAY_ROBOT_TOKEN }}
7796

7897
release-artifacts:
98+
needs: set-registry-namespace
7999
permissions:
80100
contents: write # for softprops/action-gh-release to create GitHub release
81101
runs-on: ubuntu-latest
@@ -104,7 +124,7 @@ jobs:
104124
run: |
105125
make release-plugins
106126
make checksums
107-
make manifests IMAGE_TAG=${{ github.ref_name }}
127+
make manifests IMAGE_TAG=${{ github.ref_name }} REGISTRY_NAMESPACE=${{ needs.set-registry-namespace.outputs.registry_namespace }}
108128
109129
- name: Draft release
110130
uses: softprops/action-gh-release@5be0e66d93ac7ed76da52eca8bb058f665c3a5fe # v0.1.15
@@ -151,6 +171,7 @@ jobs:
151171
needs:
152172
- release-artifacts
153173
- release-artifacts-provenance
174+
- set-registry-namespace
154175
permissions:
155176
contents: write # Needed for release uploads
156177
id-token: write # Needed for signing Sbom
@@ -183,7 +204,7 @@ jobs:
183204
# managers (gomod, yarn, npm).
184205
PROJECT_FOLDERS: '.,./ui'
185206
# full qualified name of the container image to be inspected
186-
CONTAINER_IMAGE: quay.io/argoproj/argo-rollouts:${{ github.event.inputs.tag }}
207+
CONTAINER_IMAGE: quay.io/${{ needs.set-registry-namespace.outputs.registry_namespace }}/argo-rollouts:${{ github.ref_name }}
187208

188209
run: |
189210
yarn install --cwd ./ui

Makefile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -291,7 +291,7 @@ coverage: test ## run coverage tests
291291

292292
.PHONY: manifests
293293
manifests: ## generate manifests e.g. CRD, RBAC etc.
294-
./hack/update-manifests.sh
294+
REGISTRY_NAMESPACE=$(REGISTRY_NAMESPACE) IMAGE_TAG=$(IMAGE_TAG) ./hack/update-manifests.sh
295295

296296
.PHONY: clean
297297
clean: ## clean up build artifacts

docs/releasing.md

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -68,3 +68,21 @@ execution. You can follow its progress under the [Actions](https://github.com/ar
6868
brew upgrade kubectl-argo-rollouts
6969
kubectl argo rollouts version
7070
```
71+
72+
### Releasing from your own fork of Argo Rollouts
73+
74+
It is also possible to release from your own personal/company fork. This is useful if your organization keeps [a second copy of Argo Rollouts](https://github.com/argoproj/argo-rollouts/blob/master/docs/proposals/parameterized-build-system.md) for hot-fixes or security updates.
75+
76+
1. Sign-up for a RedHat account so that you get acess to [Quay Registry](http://quay.io)
77+
2. Login and create two repositories called `argo-rollouts` and `kubectl-argo-rollouts` (for the CLI)
78+
3. Under "Account settings" create a "Robot account" for CI automation with any name you want. A token will be generated for you
79+
80+
Then enter your GitHub account in your own forked repo and under Settings -> "Secrets and Variables" -> actions:
81+
82+
* Add `QUAY_USERNAME` and `QUAY_ROBOT_TOKEN` as "Repository Secrets" with the values you created from the previous step
83+
* Add `REGISTRY_NAMESPACE` with your own Quay username/organization as "Repository variables"
84+
85+
Now follow any of the instructions from the previous section and you will see released images in your own Quay repository.
86+
87+
!!! tip
88+
The `trigger-release.sh` does some basic checks for the name of the tag. If you want to release with a tag that doesn't follow the expected naming convention you can skip this script and just push a tag on your own directly to GitHub.

hack/update-manifests.sh

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -6,17 +6,16 @@ set -e
66
SRCROOT="$( CDPATH='' cd -- "$(dirname "$0")/.." && pwd -P )"
77
AUTOGENMSG="# This is an auto-generated file. DO NOT EDIT"
88

9-
if [ ! -z "${IMAGE_NAMESPACE}" ]; then
10-
SET_IMAGE_NAMESPACE="=${IMAGE_NAMESPACE}"
11-
fi
9+
# Default to 'argoproj' if not set
10+
REGISTRY_NAMESPACE="${REGISTRY_NAMESPACE:-argoproj}"
1211

1312
if [ ! -z "${IMAGE_TAG}" ]; then
1413
SET_IMAGE_TAG=":${IMAGE_TAG}"
1514
fi
1615

17-
if [ ! -z "${SET_IMAGE_NAMESPACE}" ] || [ ! -z "${SET_IMAGE_TAG}" ]; then
18-
(cd ${SRCROOT}/manifests/base && kustomize edit set image quay.io/argoproj/argo-rollouts${SET_IMAGE_NAMESPACE}${SET_IMAGE_TAG})
19-
(cd ${SRCROOT}/manifests/dashboard-install && kustomize edit set image quay.io/argoproj/kubectl-argo-rollouts${SET_IMAGE_NAMESPACE}${SET_IMAGE_TAG})
16+
if [ ! -z "${SET_IMAGE_TAG}" ]; then
17+
(cd ${SRCROOT}/manifests/base && kustomize edit set image quay.io/${REGISTRY_NAMESPACE}/argo-rollouts${SET_IMAGE_TAG})
18+
(cd ${SRCROOT}/manifests/dashboard-install && kustomize edit set image quay.io/${REGISTRY_NAMESPACE}/kubectl-argo-rollouts${SET_IMAGE_TAG})
2019
fi
2120

2221
kust_cmd="kustomize build --load-restrictor LoadRestrictionsNone"

0 commit comments

Comments
 (0)