Skip to content

chore: Set version of 'next' bundle to always update and add build info #815

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Apr 13, 2022
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
30 changes: 30 additions & 0 deletions .github/workflows/next-build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -138,6 +138,36 @@ jobs:
export DEFAULT_DWO_IMG="quay.io/devfile/devworkspace-controller:$TAG"
export PROJECT_CLONE_IMG="quay.io/devfile/project-clone:$TAG"

# Next builds are not rolled out unless the version is incremented. We want to use semver
# prerelease tags to make sure each new build increments on the previous one, e.g.
# v0.15.0-dev.1, v0.15.0-dev.2, etc.
CURR_VERSION=$(yq -r '.spec.version' deploy/templates/components/csv/clusterserviceversion.yaml)
PREV_VERSION=$(opm render ${DWO_INDEX_IMG} |\
jq -r 'select(.schema == "olm.channel") | .entries[0].name | ltrimstr("devworkspace-operator.v")')
# Strip the static version number and build identifier to get the previous build number, e.g.
# v0.15.0-dev.1+41e8ccb8 -> 1
# If previous version does not have build number/identifier, result is the full version (e.g. v0.15.0-dev)
PREV_ID=${PREV_VERSION##*-dev.}
PREV_ID=${PREV_ID%%+*}

if [ "$PREV_ID" == "$CURR_VERSION" ]; then
# no build number set, start at 0
NEXT_ID="0"
elif [ "${PREV_VERSION%%-*}" != "${CURR_VERSION%%-*}" ]; then
# minor version bump, moving from e.g. v0.14.0-dev.8 -> v0.15.0-dev.0
NEXT_ID="0"
else
NEXT_ID=$((PREV_ID+1))
fi

NEW_VERSION="${CURR_VERSION}.${NEXT_ID}+${{ needs.build-next-imgs.outputs.git-sha }}"
NEW_NAME="devworkspace-operator.v${CURR_VERSION}.${NEXT_ID}"
echo "Updating version for this build to $NEW_VERSION"
yq -Yi --arg NEW_VERSION "$NEW_VERSION" \
--arg NEW_NAME "$NEW_NAME" \
'.spec.version=$NEW_VERSION | .metadata.name=$NEW_NAME' \
deploy/templates/components/csv/clusterserviceversion.yaml

./build/scripts/build_index_image.sh \
--bundle-repo ${DWO_BUNDLE_REPO} \
--bundle-tag ${DWO_BUNDLE_TAG} \
Expand Down