diff --git a/README.md b/README.md index 8ad2294d..e10d4e8d 100644 --- a/README.md +++ b/README.md @@ -65,18 +65,19 @@ See [konflux docs](https://github.com/konflux-ci/build-definitions/blob/c93ea73d ### Release process 1. Make sure you [logged in](https://spaces.redhat.com/pages/viewpage.action?pageId=407312060#HowtoeverythingKonfluxforRHACS-GettingocCLItoworkwithKonflux) to the Konflux cluster. -2. Make sure you checked out the latest master branch: `git checkout master && git pull` -3. Generate Release and Snapshot CRs by running `./scripts/generate-releases.sh `. Use `stage` for test release and `prod` for production one. -4. (Skip for `stage` release.) Create a PR which adds the file created by the script, get the PR reviewed and merged. -5. (Skip for `stage` release.) Go to the [#acs-operator-index-release](https://redhat.enterprise.slack.com/archives/C096WU0GZUG) channel, and: +2. Make sure you have installed [KubeArchive plugin](https://kubearchive.github.io/kubearchive/main/cli/installation.html) and ensure it is configured correctly by running `kubectl ka -n rh-acs-tenant get snapshots`. +3. Make sure you checked out the latest master branch: `git checkout master && git pull` +4. Generate Release and Snapshot CRs by running `./scripts/generate-releases.sh `. Use `stage` for test release and `prod` for production one. +5. (Skip for `stage` release.) Create a PR which adds the file created by the script, get the PR reviewed and merged. +6. (Skip for `stage` release.) Go to the [#acs-operator-index-release](https://redhat.enterprise.slack.com/archives/C096WU0GZUG) channel, and: 1. make sure the previous operator index release is complete (has a green check mark emoticon) 2. if not, coordinate with the person conducting that release 3. once that release is complete, start a new thread for your release -6. Apply generated CRs to the cluster: `oc create -f release-history/--.yaml` -7. Monitor release [using monitor release script](#monitoring-release). Each supported OCP version has its own `Release`. Successfully finished `Release` has `Succeeded` status. -8. Follow [the restarting release step below](#restarting-konflux-release) if any of the `Release`s fails for any OCP version. -9. (Skip for `stage` release.) Once done, go back to the Slack thread you started earlier, add a message that your release is done and add a green check mark emoticon on the initial message of the thread. -10. Once releases for all OCP versions successfully finish, then the operator catalog release is done. If you perform it as part of a bigger release procedure, you should go back to that procedure and continue with further steps. +7. Apply generated CRs to the cluster: `oc create -f release-history/--.yaml` +8. Monitor release [using monitor release script](#monitoring-release). Each supported OCP version has its own `Release`. Successfully finished `Release` has `Succeeded` status. +9. Follow [the restarting release step below](#restarting-konflux-release) if any of the `Release`s fails for any OCP version. +10. (Skip for `stage` release.) Once done, go back to the Slack thread you started earlier, add a message that your release is done and add a green check mark emoticon on the initial message of the thread. +11. Once releases for all OCP versions successfully finish, then the operator catalog release is done. If you perform it as part of a bigger release procedure, you should go back to that procedure and continue with further steps. ### Monitoring Release diff --git a/scripts/generate-releases.sh b/scripts/generate-releases.sh index 5546e703..cbcd01e2 100755 --- a/scripts/generate-releases.sh +++ b/scripts/generate-releases.sh @@ -114,8 +114,16 @@ generate_release_resources() { do snapshot="$(echo "$line" | cut -d "|" -f 1)" snapshot_copy_name="$(echo "${snapshot%-*}-${release_name_suffix}" | cut -c -63)" # Replace random suffix with release name and crop to 63 characters to avoid running over the Kubernetes limit. + snapshot_yaml_list="$(kubectl ka get snapshot -n rh-acs-tenant "${snapshot}" -o yaml)" + snapshot_count="$(echo "$snapshot_yaml_list" | "${YQ}" '.items | length')" + if [[ "$snapshot_count" -eq 0 ]]; then + echo "ERROR: No snapshot found in kubearchive for name: ${snapshot}" >&2 + return 1 + fi + snapshot_yaml="$(echo "$snapshot_yaml_list" | "${YQ}" '.items[0]')" + echo "---" - kubectl -n rh-acs-tenant get snapshot.appstudio.redhat.com "${snapshot}" -o yaml | \ + echo "$snapshot_yaml" | \ "${YQ}" -P 'load("'"${whitelist_file}"'") as $whitelisted | del(.metadata.annotations |keys[]|select(. as $needle | $whitelisted.annotations | has($needle) | not)) | del(.metadata.labels |keys[]|select(. as $needle | $whitelisted.labels | has($needle) | not)) @@ -148,9 +156,6 @@ generate_release_resources() { snapshot: ${snapshot_copy_name}" done <<< "$snapshots_data" > "${out_file}" - - echo "Staging the file for commit..." - git add --verbose "${out_file}" } usage "$@" diff --git a/scripts/helpers.sh b/scripts/helpers.sh index 8232f57d..4db2bf10 100644 --- a/scripts/helpers.sh +++ b/scripts/helpers.sh @@ -36,7 +36,7 @@ get_snapshots() { local -r commit="$1" local -r branch="$2" - kubectl get -n rh-acs-tenant snapshot -l pac.test.appstudio.openshift.io/sha="${commit}" -o json | jq ' + kubectl ka get snapshots -n rh-acs-tenant -l pac.test.appstudio.openshift.io/sha="${commit}" -o json | jq ' .items | map(select((.metadata.annotations["pac.test.appstudio.openshift.io/source-branch"]=="'"${branch}"'") or (.metadata.annotations["pac.test.appstudio.openshift.io/source-branch"]=="refs/heads/'${branch}'"))) | map(select(.metadata.annotations["'"${ORIGINAL_SNAPSHOT_ANNOTATION_NAME}"'"] == null))