Skip to content

Commit

Permalink
Added Workflow job to update CFO image (#398)
Browse files Browse the repository at this point in the history
  • Loading branch information
Bobbins228 authored Jan 19, 2024
1 parent 0e7bd88 commit 233de7e
Show file tree
Hide file tree
Showing 7 changed files with 31 additions and 5 deletions.
7 changes: 6 additions & 1 deletion .github/workflows/tag-and-build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -102,6 +102,11 @@ jobs:
sed -i -E "s/(.*INSTASCALE_VERSION \?= ).*/\1${{ github.event.inputs.instascale-version }}/" Makefile
sed -i -E "s/(.*KUBERAY_VERSION \?= ).*/\1${{ github.event.inputs.kuberay-version }}/" Makefile
- name: Update image version in params.env
run: |
VERSION=${{ github.event.inputs.version }} perl -i -pe 's/:(.*)$/:$ENV{"VERSION"}/' config/manager/params.env
shell: bash

- name: Login to Quay.io
uses: redhat-actions/podman-login@v1
with:
Expand Down Expand Up @@ -138,7 +143,7 @@ jobs:
uses: stefanzweifel/git-auto-commit-action@v4
with:
commit_message: Update dependency versions for release ${{ github.event.inputs.version }}
file_pattern: 'README.md *.yaml Makefile go.mod go.sum'
file_pattern: 'README.md *.yaml Makefile go.mod go.sum *.env'
create_branch: true
branch: ${{ env.PR_BRANCH_NAME }}

Expand Down
4 changes: 2 additions & 2 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -198,7 +198,7 @@ uninstall: manifests kustomize ## Uninstall CRDs from the K8s cluster specified

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

Expand Down Expand Up @@ -283,8 +283,8 @@ validate-bundle: install-operator-sdk

.PHONY: bundle
bundle: manifests kustomize install-operator-sdk ## Generate bundle manifests and metadata, then validate generated files.
cd config/manager && IMAGE=$(IMG) perl -i -pe 's/codeflare-operator-controller-image=(.*)$$/codeflare-operator-controller-image=$$ENV{"IMAGE"}/' params.env
$(OPERATOR_SDK) generate kustomize manifests -q
cd config/manager && $(KUSTOMIZE) edit set image controller=$(IMG)
cd config/manifests && $(KUSTOMIZE) edit add patch --patch '[{"op":"add", "path":"/metadata/annotations/containerImage", "value": "$(IMG)" }]' --kind ClusterServiceVersion
cd config/manifests && $(KUSTOMIZE) edit add patch --patch '[{"op":"add", "path":"/spec/replaces", "value": "codeflare-operator.$(PREVIOUS_VERSION)" }]' --kind ClusterServiceVersion
$(KUSTOMIZE) build config/manifests | $(OPERATOR_SDK) generate bundle $(BUNDLE_GEN_FLAGS)
Expand Down
16 changes: 16 additions & 0 deletions config/manager/kustomization.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -3,3 +3,19 @@ resources:

generatorOptions:
disableNameSuffixHash: true

configMapGenerator:
- name: stack-config
envs:
- params.env
configurations:
- params.yaml

vars:
- name: codeflare_operator_controller_image
objref:
kind: ConfigMap
name: stack-config
apiVersion: v1
fieldref:
fieldpath: data.codeflare-operator-controller-image
2 changes: 1 addition & 1 deletion config/manager/manager.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ spec:
containers:
- command:
- /manager
image: controller:latest
image: $(codeflare_operator_controller_image)
imagePullPolicy: Always
name: manager
securityContext:
Expand Down
1 change: 1 addition & 0 deletions config/manager/params.env
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
codeflare-operator-controller-image=quay.io/opendatahub/codeflare-operator:v1.0.1
3 changes: 3 additions & 0 deletions config/manager/params.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
varReference:
- path: spec/template/spec/containers[]/image
kind: Deployment
3 changes: 2 additions & 1 deletion config/manifests/kustomization.yaml
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
# These resources constitute the fully configured set of manifests
# used to generate the 'manifests/' directory in a bundle.
resources:
- bases/codeflare-operator.clusterserviceversion.yaml
- ../default
- ../scorecard
- bases/codeflare-operator.clusterserviceversion.yaml

apiVersion: kustomize.config.k8s.io/v1beta1
kind: Kustomization

0 comments on commit 233de7e

Please sign in to comment.