Skip to content

Commit fa7ada5

Browse files
fabiendupontqbarrand
authored andcommitted
Add workflow steps to build bundle and catalog (#28)
When the operator image is updated, the bundle image needs to be updated as well to reflect the new operator image digest. This change adds this by calling `make bundle` and rebuilding / pushing the bundle image. On the same line, the catalog image needs to be rebuilt to reflect the new bundle image digest. This is also part of this change. The `bundle` folder is also ignored since its content is generated and uses the operator image digest, that changes with every merge. There can be additional improvements to ensure digests are used everywhere, but it's a first stab at automating the operator > bundle > catalog flow. Signed-off-by: Fabien Dupont <[email protected]>
1 parent 161bb51 commit fa7ada5

File tree

2 files changed

+65
-5
lines changed

2 files changed

+65
-5
lines changed

.github/workflows/container-image.yml

+63-5
Original file line numberDiff line numberDiff line change
@@ -14,8 +14,8 @@ jobs:
1414
packages: write
1515

1616
steps:
17-
- name: Generate image metadata
18-
id: meta
17+
- name: Generate image metadata for operator
18+
id: meta-operator
1919
uses: docker/metadata-action@v3
2020
with:
2121
images: ghcr.io/qbarrand/oot-operator
@@ -26,6 +26,30 @@ jobs:
2626
type=semver,pattern={{major}}
2727
type=sha
2828
29+
- name: Generate image metadata for bundle
30+
id: meta-bundle
31+
uses: docker/metadata-action@v3
32+
with:
33+
images: ghcr.io/qbarrand/oot-operator-bundle
34+
tags: |
35+
type=ref,event=branch
36+
type=semver,pattern={{version}}
37+
type=semver,pattern={{major}}.{{minor}}
38+
type=semver,pattern={{major}}
39+
type=sha
40+
41+
- name: Generate image metadata for catalog
42+
id: meta-catalog
43+
uses: docker/metadata-action@v3
44+
with:
45+
images: ghcr.io/qbarrand/oot-operator-catalog
46+
tags: |
47+
type=ref,event=branch
48+
type=semver,pattern={{version}}
49+
type=semver,pattern={{major}}.{{minor}}
50+
type=semver,pattern={{major}}
51+
type=sha
52+
2953
- name: Login to GitHub Container Registry
3054
uses: docker/login-action@v1
3155
with:
@@ -36,10 +60,44 @@ jobs:
3660
- name: Check out the repo
3761
uses: actions/checkout@v3
3862

39-
- name: Build and push
63+
- name: Build and push operator
64+
id: build-push-operator
65+
uses: docker/build-push-action@v2
66+
with:
67+
context: .
68+
push: true
69+
tags: ${{ steps.meta-operator.outputs.tags }}
70+
labels: ${{ steps.meta-operator.outputs.labels }}
71+
72+
- name: Setup Go 1.17
73+
uses: actions/setup-go@v3
74+
with:
75+
go-version: '1.17'
76+
77+
- name: Install the Operator SDK CLI
78+
run: |
79+
mkdir -p ${HOME}/.local/bin
80+
curl -Lo ${HOME}/.local/bin/operator-sdk https://github.com/operator-framework/operator-sdk/releases/download/v1.18.1/operator-sdk_linux_amd64
81+
chmod +x {HOME}/.local/bin/operator-sdk
82+
echo "${HOME}/.local/bin" >> $GITHUB_PATH
83+
84+
- name: Generate the bundle content
85+
run: make bundle
86+
env:
87+
IMG: ghcr.io/qbarrand/oot-operator@${{ steps.build-push-operator.outputs.digest }}
88+
89+
- name: Build and push bundle
90+
id: build-push-bundle
4091
uses: docker/build-push-action@v2
4192
with:
4293
context: .
94+
file: bundle.Dockerfile
4395
push: true
44-
tags: ${{ steps.meta.outputs.tags }}
45-
labels: ${{ steps.meta.outputs.labels }}
96+
tags: ${{ steps.meta-bundle.outputs.tags }}
97+
labels: ${{ steps.meta-bundle.outputs.labels }}
98+
99+
- name: Build and push catalog
100+
run: make catalog-build && make catalog-push
101+
env:
102+
BUNDLE_IMG: ghcr.io/qbarrand/oot-operator-bundle@${{ steps.build-push-operator-bundle.outputs.digest }}
103+
VERSION: ${{ github.ref_name }}

.gitignore

+2
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
# Bundle files are generated
2+
bundle
13

24
# Binaries for programs and plugins
35
*.exe

0 commit comments

Comments
 (0)