Skip to content

Commit

Permalink
Add release-specific OLM channels
Browse files Browse the repository at this point in the history
Signed-off-by: Michael Edgar <[email protected]>
  • Loading branch information
MikeEdgar committed Jan 24, 2025
1 parent 74dd153 commit e2b7555
Show file tree
Hide file tree
Showing 3 changed files with 43 additions and 0 deletions.
24 changes: 24 additions & 0 deletions operator/bin/release-prepare.sh
Original file line number Diff line number Diff line change
Expand Up @@ -28,8 +28,26 @@ if [ "${VERSION}" == "${POSTRELEASE_VERSION}" ] ; then
"replaces": "'${RELEASE_CSV_NAME}'"
}' ${OPERATOR_PATH}/src/main/olm/channel.alpha.yaml

POSTRELEASE_CHANNEL=$(echo "${POSTRELEASE_VERSION}" | sed -E 's/([0-9]+)\.([0-9]+)\.[0-9]+(-snapshot)?/\1.\2.x/g')

if [ ! -f ${OPERATOR_PATH}/src/main/olm/channel.${POSTRELEASE_CHANNEL}.yaml ] ; then
echo '---
schema: olm.channel
name: '${RELEASE_CHANNEL}'
package: streamshub-console-operator
properties: []
entries: []' > ${OPERATOR_PATH}/src/main/olm/channel.${POSTRELEASE_CHANNEL}.yaml
fi

# Create new entry for the next development cycle, "replaces" the version just released
${YQ} -i '.entries += {
"name": "'${POSTRELEASE_CSV_NAME}'",
"replaces": "'${RELEASE_CSV_NAME}'"
}' ${OPERATOR_PATH}/src/main/olm/channel.${POSTRELEASE_CHANNEL}.yaml

if [ "${GIT_STAGE}" == "true" ] ; then
git add ${OPERATOR_PATH}/src/main/olm/channel.alpha.yaml
git add ${OPERATOR_PATH}/src/main/olm/channel.${POSTRELEASE_CHANNEL}.yaml
fi
else
# Running via the `preparationGoals` of the maven-release-plugin
Expand All @@ -39,6 +57,12 @@ else
${YQ} -i '(.entries[].name | select(. == "'${PRERELEASE_CSV_NAME}'")) = "'${RELEASE_CSV_NAME}'"' \
${OPERATOR_PATH}/src/main/olm/channel.alpha.yaml

RELEASE_CHANNEL=$(echo "${RELEASE_VERSION}" | sed -E 's/([0-9]+)\.([0-9]+)\.[0-9]+/\1.\2.x/g')

# Change the name of the entry to be the released version (e.g removing the -snapshot suffix)
${YQ} -i '(.entries[].name | select(. == "'${PRERELEASE_CSV_NAME}'")) = "'${RELEASE_CSV_NAME}'"' \
${OPERATOR_PATH}/src/main/olm/channel.${RELEASE_CHANNEL}.yaml

# Create a file with a reference to the bundle image to be generated during the release
echo "image: ${IMAGE_NAME}:${VERSION}" > ${OPERATOR_PATH}/src/main/olm/bundles/${RELEASE_CSV_NAME}.yaml

Expand Down
7 changes: 7 additions & 0 deletions operator/src/main/olm/channel.0.5.x.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
---
schema: olm.channel
name: 0.5.x
package: streamshub-console-operator
properties: []
entries:
- name: streamshub-console-operator.v0.5.0
12 changes: 12 additions & 0 deletions operator/src/main/olm/channel.0.6.x.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
---
schema: olm.channel
name: 0.6.x
package: streamshub-console-operator
properties: []
entries:
- name: streamshub-console-operator.v0.6.0
replaces: streamshub-console-operator.v0.5.0
- name: streamshub-console-operator.v0.6.1
replaces: streamshub-console-operator.v0.6.0
- name: streamshub-console-operator.v0.6.2-snapshot
replaces: streamshub-console-operator.v0.6.1

0 comments on commit e2b7555

Please sign in to comment.