Skip to content

Commit

Permalink
Link catalog PR in summary comment
Browse files Browse the repository at this point in the history
When a release pipeline opens a new pull request with a catalog changes
the summary comment now contains a information and link to the new PR
instead of manual instruction.

The comment is only visible when auto-release is enabled.

JIRA: ISV-5662

Signed-off-by: Ales Raszka <[email protected]>
  • Loading branch information
Allda committed Feb 26, 2025
1 parent 34cc389 commit f93a06c
Show file tree
Hide file tree
Showing 4 changed files with 24 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -1229,6 +1229,9 @@ spec:
- name: source
workspace: repository
subPath: src
- name: output
workspace: results
subPath: summary

# merge PR
- name: merge-pr
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -712,6 +712,9 @@ spec:
- name: source
workspace: repository
subPath: src
- name: output
workspace: results
subPath: summary
- name: ssh-directory
workspace: ssh-dir

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,8 @@ spec:

workspaces:
- name: source
- name: output
description: Scratch space and storage for the comment and related data
- name: ssh-directory
optional: true

Expand Down Expand Up @@ -154,9 +156,12 @@ spec:
If you have any questions or need modifications, please let us know!
EOL
mkdir -p "$(workspaces.output.path)/release_info"
# A new pull request is created with FBC addition
gh pr create \
--base "$(params.git_base_branch)" \
--head $FBC_UPDATE_BRANCH \
--title "Auto FBC release $(params.operator_name) $(params.operator_version)" \
--body-file pr_comment.md
--body-file pr_comment.md > "$(workspaces.output.path)/release_info/fbc_pr_url.txt"
echo "FBC PR created: $(cat "$(workspaces.output.path)/release_info/fbc_pr_url.txt")"
Original file line number Diff line number Diff line change
Expand Up @@ -160,7 +160,18 @@ spec:
# Add info how to update catalog for FBC bundles
if [[ "$fbc_enabled" == "true" && -f "$RELEASE_INFO_DIR_PATH/released_bundle.txt" ]]; then
echo -e "\n## Catalog update\n" >> "$PR_NAME/comment.md"
echo -e "Operator bundle using FBC mode has been released.\nTo add bundle to FBC templates, follow [this guide](https://redhat-openshift-ecosystem.github.io/operator-pipelines/users/fbc_workflow/#adding-new-bundle-to-catalog) to create a new PR with catalog changes." >> "$PR_NAME/comment.md"
if [[ -f "$RELEASE_INFO_DIR_PATH/fbc_pr_url.txt" ]]; then
PR_URL=$(cat "$RELEASE_INFO_DIR_PATH/fbc_pr_url.txt")
cat >> "$PR_NAME/comment.md" <<EOF
Automated release to the File-Based Catalog has been enabled for this bundle
A new pull request has been created to update the catalog with the new bundle. You can find the PR here: $PR_URL.
EOF
else
echo -e "Operator bundle using FBC mode has been released.\nTo add bundle to FBC templates, follow [this guide](https://redhat-openshift-ecosystem.github.io/operator-pipelines/users/fbc_workflow/#adding-new-bundle-to-catalog) to create a new PR with catalog changes." >> "$PR_NAME/comment.md"
fi
fi
fi
Expand Down

0 comments on commit f93a06c

Please sign in to comment.