Skip to content

Commit

Permalink
ci: Support --dry-run flag for make-release.sh (#1852)
Browse files Browse the repository at this point in the history
Signed-off-by: Anatolii Bazko <abazko@redhat.com>
  • Loading branch information
tolusha authored Jun 7, 2024
1 parent e9c5b04 commit d306aa1
Show file tree
Hide file tree
Showing 2 changed files with 28 additions and 7 deletions.
15 changes: 11 additions & 4 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,11 @@ on:
description: If true, tags will be recreated. Use with caution
required: false
default: 'false'
dryRun:
description: If true, dry run will be performed. No changes will be pushed to the repository
required: false
default: 'false'

jobs:
build:
runs-on: ubuntu-22.04
Expand Down Expand Up @@ -77,6 +82,8 @@ jobs:
IMAGE_REGISTRY_USER_NAME: eclipse
run: |
CHE_VERSION=${{ github.event.inputs.version }}
DRY_RUN=${{ github.event.inputs.dryRun }}
DRY_RUN_FLAG=[[ ${DRY_RUN} == "true" ]] && DRY_RUN_FLAG="--dry-run"
echo "CHE_VERSION=${CHE_VERSION}"
BRANCH=${CHE_VERSION%.*}.x
echo "BRANCH=${BRANCH}"
Expand All @@ -96,10 +103,10 @@ jobs:
export QUAY_ECLIPSE_CHE_PASSWORD=${{ secrets.QUAY_PASSWORD }}
if [[ ${CHE_VERSION} == *".0" ]]; then
build/scripts/release/make-release.sh ${CHE_VERSION} --release --check-resources --release-olm-files
build/scripts/release/make-release.sh ${CHE_VERSION} --release --check-resources --release-olm-files ${DRY_RUN_FLAG}
else
git checkout ${BRANCH}
build/scripts/release/make-release.sh ${CHE_VERSION} --release --release-olm-files
build/scripts/release/make-release.sh ${CHE_VERSION} --release --release-olm-files ${DRY_RUN_FLAG}
fi
# default robot account on quay does not have permissions for application repos
Expand All @@ -113,14 +120,14 @@ jobs:
# echo "[DEBUG] QUAY_USERNAME_OS = ${QUAY_USERNAME_OS}"
git checkout ${CHE_VERSION}-release
build/scripts/release/make-release.sh ${CHE_VERSION} --push-olm-bundles
build/scripts/release/make-release.sh ${CHE_VERSION} --push-olm-bundles ${DRY_RUN_FLAG}
# perform extra checkouts to ensure branches exist locally
git checkout ${BRANCH}
git checkout ${CHE_VERSION}-release
force_update=""
if [[ ${{ github.event.inputs.forceRecreateTags }} == "true" ]]; then force_update="--force"; fi
build/scripts/release/make-release.sh ${CHE_VERSION} --push-git-changes --pull-requests ${force_update}
build/scripts/release/make-release.sh ${CHE_VERSION} --push-git-changes --pull-requests ${force_update} ${DRY_RUN_FLAG}
#- name: Create failure MM message
#if: ${{ failure() }}
#run: |
Expand Down
20 changes: 17 additions & 3 deletions build/scripts/release/make-release.sh
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ set -e

init() {
RELEASE="$1"
DRY_RUN=false
BRANCH=$(echo $RELEASE | sed 's/.$/x/')
RELEASE_BRANCH="${RELEASE}-release"
GIT_REMOTE_UPSTREAM="https://github.com/eclipse-che/che-operator.git"
Expand Down Expand Up @@ -42,6 +43,7 @@ init() {
while [[ "$#" -gt 0 ]]; do
case $1 in
'--release') RUN_RELEASE=true; shift 0;;
'--dry-run') DRY_RUN=true; shift 0;;
'--push-olm-bundles') PUSH_OLM_BUNDLES=true; shift 0;;
'--push-git-changes') PUSH_GIT_CHANGES=true; shift 0;;
'--pull-requests') CREATE_PULL_REQUESTS=true; shift 0;;
Expand Down Expand Up @@ -262,7 +264,11 @@ run() {
updateVersionFile
releaseEditorsDefinitions
releaseManagerYaml
buildOperatorImage
if [[ $DRY_RUN == "false" ]]; then
buildOperatorImage
else
echo "[INFO] Dry run is enabled. Skipping buildOperatorImage"
fi
if [[ $RELEASE_OLM_FILES == "true" ]]; then
releaseOlmFiles
addDigests
Expand All @@ -280,7 +286,11 @@ if [[ $RUN_RELEASE == "true" ]]; then
fi

if [[ $PUSH_OLM_BUNDLES == "true" ]]; then
pushOlmBundlesToQuayIo
if [[ $DRY_RUN == "false" ]]; then
pushOlmBundlesToQuayIo
else
echo "[INFO] Dry run is enabled. Skipping pushOlmBundlesToQuayIo"
fi
fi

if [[ $PUSH_GIT_CHANGES == "true" ]]; then
Expand All @@ -293,5 +303,9 @@ if [[ $CREATE_PULL_REQUESTS == "true" ]]; then
fi

if [[ $PREPARE_COMMUNITY_OPERATORS_UPDATE == "true" ]]; then
prepareCommunityOperatorsUpdate
if [[ $DRY_RUN == "false" ]]; then
prepareCommunityOperatorsUpdate
else
echo "[INFO] Dry run is enabled. Skipping prepareCommunityOperatorsUpdate"
fi
fi

0 comments on commit d306aa1

Please sign in to comment.