Skip to content

Commit d07a22a

Browse files
Merge pull request openstack-k8s-operators#1469 from dprince/catalog_olm_upgrade
Add github workflow to create upgrades OLM catalog
2 parents 314ceec + 95ff33b commit d07a22a

File tree

2 files changed

+120
-0
lines changed

2 files changed

+120
-0
lines changed
Lines changed: 89 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,89 @@
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+
runs-on: ubuntu-latest
28+
if: >
29+
github.event.workflow_run.conclusion == 'success'
30+
31+
steps:
32+
- name: Install Go
33+
uses: actions/setup-go@v4
34+
with:
35+
go-version: ${{ inputs.go_version }}
36+
cache: false
37+
38+
- name: Checkout openstack-operator repository
39+
uses: actions/checkout@v4
40+
with:
41+
path: ./openstack-operator
42+
43+
- name: Install opm
44+
uses: redhat-actions/openshift-tools-installer@v1
45+
with:
46+
source: github
47+
opm: 'latest'
48+
49+
- name: Log in to Quay Registry
50+
uses: redhat-actions/podman-login@v1
51+
with:
52+
registry: ${{ env.imageregistry }}
53+
username: ${{ secrets.QUAY_USERNAME }}
54+
password: ${{ secrets.QUAY_PASSWORD }}
55+
56+
- name: Log in to Red Hat Registry
57+
uses: redhat-actions/podman-login@v1
58+
with:
59+
registry: registry.redhat.io
60+
username: ${{ secrets.REDHATIO_USERNAME }}
61+
password: ${{ secrets.REDHATIO_PASSWORD }}
62+
63+
- name: Create the catalog index
64+
shell: bash
65+
run: ./openstack-operator/hack/catalog-build-olm-upgrade.sh
66+
env:
67+
#FIXME: these should be pulled from a YAML config in the main operator directory?
68+
MAIN_VERSION: 0.3.0
69+
FEATURE_RELEASE_VERSION: 0.2.0
70+
FEATURE_RELEASE_BRANCH: 18.0-fr2
71+
BUNDLE: ${{ env.imageregistry }}/${{ env.imagenamespace }}/openstack-operator-bundle:${{ github.sha }}
72+
73+
- name: Buildah Action
74+
id: build-operator-index-upgrade
75+
uses: redhat-actions/buildah-build@v2
76+
with:
77+
image: openstack-operator-index-upgrade
78+
tags: ${{ env.latesttag }} ${{ github.sha }}
79+
containerfiles: |
80+
./catalog.Dockerfile
81+
82+
- name: Push openstack-operator-index-upgrade To ${{ env.imageregistry }}
83+
uses: redhat-actions/push-to-registry@v2
84+
with:
85+
image: ${{ steps.build-operator-index-upgrade.outputs.image }}
86+
tags: ${{ steps.build-operator-index-upgrade.outputs.tags }}
87+
registry: ${{ env.imageregistry }}/${{ env.imagenamespace }}
88+
username: ${{ secrets.QUAY_USERNAME }}
89+
password: ${{ secrets.QUAY_PASSWORD }}

hack/catalog-build-olm-upgrade.sh

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
#!/bin/bash
2+
#NOTE: this script is used by the catalog-openstack-operator-upgrades.yaml
3+
set -ex
4+
5+
MAIN_VERSION=${MAIN_VERSION:-"0.3.0"}
6+
FEATURE_RELEASE_VERSION=${FEATURE_RELEASE_VERSION:-"0.2.0"}
7+
FEATURE_RELEASE_BRANCH=${FEATURE_RELEASE_BRANCH:-"18.0-fr2"}
8+
BUNDLE=${BUNDLE:-"quay.io/openstack-k8s-operators/openstack-operator-bundle:latest"}
9+
10+
[ -d "catalog" ] && rm -Rf catalog
11+
[ -e "catalog.Dockerfile" ] && rm catalog.Dockerfile
12+
mkdir catalog
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 ${BUNDLE} --output yaml >> catalog/index.yaml
18+
# always default to use the FR release from openstack-k8s-operators
19+
opm render quay.io/openstack-k8s-operators/openstack-operator-bundle:${FEATURE_RELEASE_BRANCH}-latest --output yaml >> catalog/index.yaml
20+
21+
cat >> catalog/index.yaml << EOF_CAT
22+
---
23+
schema: olm.channel
24+
package: openstack-operator
25+
name: stable-v1.0
26+
entries:
27+
- name: openstack-operator.v${FEATURE_RELEASE_VERSION}
28+
- name: openstack-operator.v${MAIN_VERSION}
29+
replaces: openstack-operator.v${FEATURE_RELEASE_VERSION}
30+
EOF_CAT
31+
opm validate catalog

0 commit comments

Comments
 (0)