Skip to content

Commit f93a06c

Browse files
committed
Link catalog PR in summary comment
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]>
1 parent 34cc389 commit f93a06c

File tree

4 files changed

+24
-2
lines changed

4 files changed

+24
-2
lines changed

ansible/roles/operator-pipeline/templates/openshift/pipelines/operator-hosted-pipeline.yml

+3
Original file line numberDiff line numberDiff line change
@@ -1229,6 +1229,9 @@ spec:
12291229
- name: source
12301230
workspace: repository
12311231
subPath: src
1232+
- name: output
1233+
workspace: results
1234+
subPath: summary
12321235

12331236
# merge PR
12341237
- name: merge-pr

ansible/roles/operator-pipeline/templates/openshift/pipelines/operator-release-pipeline.yml

+3
Original file line numberDiff line numberDiff line change
@@ -712,6 +712,9 @@ spec:
712712
- name: source
713713
workspace: repository
714714
subPath: src
715+
- name: output
716+
workspace: results
717+
subPath: summary
715718
- name: ssh-directory
716719
workspace: ssh-dir
717720

ansible/roles/operator-pipeline/templates/openshift/tasks/add-bundle-to-fbc.yml

+6-1
Original file line numberDiff line numberDiff line change
@@ -53,6 +53,8 @@ spec:
5353

5454
workspaces:
5555
- name: source
56+
- name: output
57+
description: Scratch space and storage for the comment and related data
5658
- name: ssh-directory
5759
optional: true
5860

@@ -154,9 +156,12 @@ spec:
154156
If you have any questions or need modifications, please let us know!
155157
EOL
156158
159+
mkdir -p "$(workspaces.output.path)/release_info"
157160
# A new pull request is created with FBC addition
158161
gh pr create \
159162
--base "$(params.git_base_branch)" \
160163
--head $FBC_UPDATE_BRANCH \
161164
--title "Auto FBC release $(params.operator_name) $(params.operator_version)" \
162-
--body-file pr_comment.md
165+
--body-file pr_comment.md > "$(workspaces.output.path)/release_info/fbc_pr_url.txt"
166+
167+
echo "FBC PR created: $(cat "$(workspaces.output.path)/release_info/fbc_pr_url.txt")"

ansible/roles/operator-pipeline/templates/openshift/tasks/github-pipelinerun-summary.yml

+12-1
Original file line numberDiff line numberDiff line change
@@ -160,7 +160,18 @@ spec:
160160
# Add info how to update catalog for FBC bundles
161161
if [[ "$fbc_enabled" == "true" && -f "$RELEASE_INFO_DIR_PATH/released_bundle.txt" ]]; then
162162
echo -e "\n## Catalog update\n" >> "$PR_NAME/comment.md"
163-
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"
163+
if [[ -f "$RELEASE_INFO_DIR_PATH/fbc_pr_url.txt" ]]; then
164+
PR_URL=$(cat "$RELEASE_INFO_DIR_PATH/fbc_pr_url.txt")
165+
166+
cat >> "$PR_NAME/comment.md" <<EOF
167+
Automated release to the File-Based Catalog has been enabled for this bundle
168+
169+
A new pull request has been created to update the catalog with the new bundle. You can find the PR here: $PR_URL.
170+
EOF
171+
172+
else
173+
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"
174+
fi
164175
fi
165176
fi
166177

0 commit comments

Comments
 (0)