Skip to content

Commit 233de7e

Browse files
authored
Added Workflow job to update CFO image (#398)
1 parent 0e7bd88 commit 233de7e

File tree

7 files changed

+31
-5
lines changed

7 files changed

+31
-5
lines changed

.github/workflows/tag-and-build.yml

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -102,6 +102,11 @@ jobs:
102102
sed -i -E "s/(.*INSTASCALE_VERSION \?= ).*/\1${{ github.event.inputs.instascale-version }}/" Makefile
103103
sed -i -E "s/(.*KUBERAY_VERSION \?= ).*/\1${{ github.event.inputs.kuberay-version }}/" Makefile
104104
105+
- name: Update image version in params.env
106+
run: |
107+
VERSION=${{ github.event.inputs.version }} perl -i -pe 's/:(.*)$/:$ENV{"VERSION"}/' config/manager/params.env
108+
shell: bash
109+
105110
- name: Login to Quay.io
106111
uses: redhat-actions/podman-login@v1
107112
with:
@@ -138,7 +143,7 @@ jobs:
138143
uses: stefanzweifel/git-auto-commit-action@v4
139144
with:
140145
commit_message: Update dependency versions for release ${{ github.event.inputs.version }}
141-
file_pattern: 'README.md *.yaml Makefile go.mod go.sum'
146+
file_pattern: 'README.md *.yaml Makefile go.mod go.sum *.env'
142147
create_branch: true
143148
branch: ${{ env.PR_BRANCH_NAME }}
144149

Makefile

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -198,7 +198,7 @@ uninstall: manifests kustomize ## Uninstall CRDs from the K8s cluster specified
198198

199199
.PHONY: deploy
200200
deploy: manifests kustomize ## Deploy controller to the K8s cluster specified in ~/.kube/config.
201-
cd config/manager && $(KUSTOMIZE) edit set image controller=${IMG}
201+
cd config/manager && IMAGE=$(IMG) perl -i -pe 's/codeflare-operator-controller-image=(.*)$$/codeflare-operator-controller-image=$$ENV{"IMAGE"}/' params.env
202202
$(KUSTOMIZE) build config/${ENV} | kubectl apply -f -
203203
git restore config/*
204204

@@ -283,8 +283,8 @@ validate-bundle: install-operator-sdk
283283

284284
.PHONY: bundle
285285
bundle: manifests kustomize install-operator-sdk ## Generate bundle manifests and metadata, then validate generated files.
286+
cd config/manager && IMAGE=$(IMG) perl -i -pe 's/codeflare-operator-controller-image=(.*)$$/codeflare-operator-controller-image=$$ENV{"IMAGE"}/' params.env
286287
$(OPERATOR_SDK) generate kustomize manifests -q
287-
cd config/manager && $(KUSTOMIZE) edit set image controller=$(IMG)
288288
cd config/manifests && $(KUSTOMIZE) edit add patch --patch '[{"op":"add", "path":"/metadata/annotations/containerImage", "value": "$(IMG)" }]' --kind ClusterServiceVersion
289289
cd config/manifests && $(KUSTOMIZE) edit add patch --patch '[{"op":"add", "path":"/spec/replaces", "value": "codeflare-operator.$(PREVIOUS_VERSION)" }]' --kind ClusterServiceVersion
290290
$(KUSTOMIZE) build config/manifests | $(OPERATOR_SDK) generate bundle $(BUNDLE_GEN_FLAGS)

config/manager/kustomization.yaml

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,3 +3,19 @@ resources:
33

44
generatorOptions:
55
disableNameSuffixHash: true
6+
7+
configMapGenerator:
8+
- name: stack-config
9+
envs:
10+
- params.env
11+
configurations:
12+
- params.yaml
13+
14+
vars:
15+
- name: codeflare_operator_controller_image
16+
objref:
17+
kind: ConfigMap
18+
name: stack-config
19+
apiVersion: v1
20+
fieldref:
21+
fieldpath: data.codeflare-operator-controller-image

config/manager/manager.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ spec:
3434
containers:
3535
- command:
3636
- /manager
37-
image: controller:latest
37+
image: $(codeflare_operator_controller_image)
3838
imagePullPolicy: Always
3939
name: manager
4040
securityContext:

config/manager/params.env

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
codeflare-operator-controller-image=quay.io/opendatahub/codeflare-operator:v1.0.1

config/manager/params.yaml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
varReference:
2+
- path: spec/template/spec/containers[]/image
3+
kind: Deployment

config/manifests/kustomization.yaml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,9 @@
11
# These resources constitute the fully configured set of manifests
22
# used to generate the 'manifests/' directory in a bundle.
33
resources:
4-
- bases/codeflare-operator.clusterserviceversion.yaml
54
- ../default
65
- ../scorecard
6+
- bases/codeflare-operator.clusterserviceversion.yaml
7+
78
apiVersion: kustomize.config.k8s.io/v1beta1
89
kind: Kustomization

0 commit comments

Comments
 (0)