Skip to content

Commit fe12d06

Browse files
committed
Add github workflow to create upgrades OLM catalog
The upgrades OLM catalog/index has 2 releases in it to facilitate testing operator updates from the last feature release to main. Jira: OSPRH-14819
1 parent 3e40e32 commit fe12d06

File tree

2 files changed

+121
-0
lines changed

2 files changed

+121
-0
lines changed
Lines changed: 91 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,91 @@
1+
name: Build catalog for OLM upgrade testing
2+
3+
on:
4+
workflow_run:
5+
workflows: ["openstack operator image builder"]
6+
types:
7+
- completed
8+
secrets:
9+
IMAGENAMESPACE:
10+
required: true
11+
QUAY_USERNAME:
12+
required: true
13+
QUAY_PASSWORD:
14+
required: true
15+
REDHATIO_USERNAME:
16+
required: true
17+
REDHATIO_PASSWORD:
18+
required: true
19+
20+
env:
21+
imageregistry: 'quay.io'
22+
imagenamespace: ${{ secrets.IMAGENAMESPACE || secrets.QUAY_USERNAME }}
23+
latesttag: latest
24+
25+
jobs:
26+
build-catalog:
27+
#github.event.workflow_run.event == 'push' &&
28+
runs-on: ubuntu-latest
29+
if: >
30+
github.event.workflow_run.conclusion == 'success' &&
31+
github.event.workflow_run.head_branch == 'main'
32+
33+
steps:
34+
- name: Install Go
35+
uses: actions/setup-go@v4
36+
with:
37+
go-version: ${{ inputs.go_version }}
38+
cache: false
39+
40+
- name: Checkout openstack-operator repository
41+
uses: actions/checkout@v4
42+
with:
43+
path: ./openstack-operator
44+
45+
- name: Install opm
46+
uses: redhat-actions/openshift-tools-installer@v1
47+
with:
48+
source: github
49+
opm: 'latest'
50+
51+
- name: Log in to Quay Registry
52+
uses: redhat-actions/podman-login@v1
53+
with:
54+
registry: ${{ env.imageregistry }}
55+
username: ${{ secrets.QUAY_USERNAME }}
56+
password: ${{ secrets.QUAY_PASSWORD }}
57+
58+
- name: Log in to Red Hat Registry
59+
uses: redhat-actions/podman-login@v1
60+
with:
61+
registry: registry.redhat.io
62+
username: ${{ secrets.REDHATIO_USERNAME }}
63+
password: ${{ secrets.REDHATIO_PASSWORD }}
64+
65+
- name: Create the catalog index
66+
shell: bash
67+
run: ./openstack-operator/hack/catalog-build-olm-upgrade.sh
68+
env:
69+
MAIN_VERSION: 0.3.0
70+
FEATURE_RELEASE_VERSION: 0.2.0
71+
FEATURE_RELEASE_BRANCH: 18.0-fr2
72+
73+
- name: Buildah Action
74+
id: build-operator-index
75+
uses: redhat-actions/buildah-build@v2
76+
with:
77+
image: openstack-operator-index-upgrade
78+
#tags: ${{ env.latesttag }} ${{ github.sha }}
79+
tags: ${{ env.latesttag }}
80+
containerfiles: |
81+
./catalog.Dockerfile
82+
83+
- name: Push openstack-operator-index-upgrade To ${{ env.imageregistry }}
84+
uses: redhat-actions/push-to-registry@v2
85+
with:
86+
image: ${{ steps.build-operator-index.outputs.image }}
87+
tags: ${{ steps.build-operator-index.outputs.tags }}
88+
registry: ${{ env.imageregistry }}/${{ env.imagenamespace }}
89+
username: ${{ secrets.QUAY_USERNAME }}
90+
password: ${{ secrets.QUAY_PASSWORD }}
91+
digestfile: digest.txt

hack/catalog-build-olm-upgrade.sh

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
#!/bin/bash
2+
set -ex
3+
4+
MAIN_VERSION=${MAIN_VERSION:-"0.3.0"}
5+
FEATURE_RELEASE_VERSION=${FEATURE_RELEASE_VERSION:-"0.2.0"}
6+
FEATURE_RELEASE_BRANCH=${FEATURE_RELEASE_BRANCH:-"18.0-fr2"}
7+
8+
#rm -Rf catalog
9+
#rm catalog.Dockerfile
10+
mkdir catalog
11+
12+
#echo -n "OpenStack Operator" > catalog/description.md
13+
14+
opm generate dockerfile ./catalog -i registry.redhat.io/openshift4/ose-operator-registry-rhel9:v4.18
15+
opm init openstack-operator --default-channel=stable-v1.0 --output yaml > catalog/index.yaml
16+
17+
opm render quay.io/openstack-k8s-operators/openstack-operator-bundle:latest --output yaml >> catalog/index.yaml
18+
opm render quay.io/openstack-k8s-operators/openstack-operator-bundle:${FEATURE_RELEASE_BRANCH}-latest --output yaml >> catalog/index.yaml
19+
20+
cat >> catalog/index.yaml << EOF_CAT
21+
---
22+
schema: olm.channel
23+
package: openstack-operator
24+
name: stable-v1.0
25+
entries:
26+
- name: openstack-operator.v${FEATURE_RELEASE_VERSION}
27+
- name: openstack-operator.v${MAIN_VERSION}
28+
replaces: openstack-operator.v${FEATURE_RELEASE_VERSION}
29+
EOF_CAT
30+
opm validate catalog

0 commit comments

Comments
 (0)