Skip to content

Commit

Permalink
[ISV-4830] Release pipeline shares a summary in PR comment
Browse files Browse the repository at this point in the history
  • Loading branch information
RichardPlesnik committed Jun 27, 2024
1 parent 02d8e9f commit 7690bbf
Show file tree
Hide file tree
Showing 6 changed files with 71 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -1414,6 +1414,10 @@ spec:
value: "true"
- name: pipeline_name
value: "$(context.pipeline.name)"
- name: pipeline_status
value: "$(tasks.status)"
- name: fbc-enabled
value: "$(tasks.read-config.results.fbc-enabled)"
workspaces:
- name: base
workspace: repository
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -336,6 +336,9 @@ spec:
workspace: registry-pull-credentials
- name: dest-registry-credentials
workspace: registry-push-credentials
- name: output
workspace: results
subPath: summary

# Publish bundle metadata to Pyxis
- name: publish-pyxis-data
Expand Down Expand Up @@ -648,6 +651,10 @@ spec:
value: "$(tasks.get-organization.results.organization)"
- name: quay_push_final_index_secret
value: "$(params.quay_push_final_index_secret)"
workspaces:
- name: output
workspace: results
subPath: summary


finally:
Expand Down Expand Up @@ -848,6 +855,10 @@ spec:
value: "true"
- name: pipeline_name
value: "$(context.pipeline.name)"
- name: pipeline_status
value: "$(tasks.status)"
- name: fbc-enabled
value: "$(tasks.read-config.results.fbc-enabled)"
workspaces:
- name: base
workspace: repository
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,8 @@ spec:
description: Docker config for the source registry
- name: dest-registry-credentials
description: Docker config for the destination registry
- name: output
description: Scratch space and storage for the comment and related data
results:
- name: container_digest
- name: image_pullspec
Expand All @@ -32,6 +34,11 @@ spec:
script: |
set -xe
# Save data about released bundle to volume
RELEASE_INFO_DIR_PATH="$(workspaces.output.path)/release_info"
mkdir "$RELEASE_INFO_DIR_PATH"
echo "- $(params.src_image)" | tee "$RELEASE_INFO_DIR_PATH/released_bundle.txt"
if [[ "$(params.vendor_label)" == "" ]]; then
echo "Image pullspec for community bundle is the source image itself."
echo -n > "$(results.container_digest.path)"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,9 @@ spec:
- name: pipeline_name
description: The name of the Pipeline.

- name: pipeline_status
description: The result status of the Pipeline.

- name: pipeline_image
description: The common pipeline image.

Expand All @@ -50,6 +53,12 @@ spec:
A flag that determines whether pipeline logs should be uploaded to Github gists
type: string

- name: fbc-enabled
default: "false"
description: |
A flag that determines whether bundle uses fbc mode.
steps:
- name: gather-info
workingDir: $(workspaces.output.path)
Expand Down Expand Up @@ -130,6 +139,30 @@ spec:
DOC_LINK="https://github.com/redhat-openshift-ecosystem/certification-releases/blob/main/4.9/ga/troubleshooting.md"
fi
if [[ "$(params.pipeline_name)" == "operator-release-pipeline" && ("$(params.pipeline_status)" == "Succeeded" || "$(params.pipeline_status)" == "Completed") ]]; then
# Add details about released bundle and indices
echo -e "\n## Release info\n" >> "$PR_NAME/comment.md"
RELEASE_INFO_DIR_PATH="$(workspaces.output.path)/release_info"
if [[ -d "$RELEASE_INFO_DIR_PATH" ]]; then
if [[ -f "$RELEASE_INFO_DIR_PATH/released_bundle.txt" ]]; then
echo -e "\n*Released bundle:* \n" >> "$PR_NAME/comment.md"
cat "$RELEASE_INFO_DIR_PATH/released_bundle.txt" >> "$PR_NAME/comment.md"
fi
if [[ -f "$RELEASE_INFO_DIR_PATH/updated_indices.txt" ]]; then
echo -e "\n*Updated indices:* \n" >> "$PR_NAME/comment.md"
cat "$RELEASE_INFO_DIR_PATH/updated_indices.txt" >> "$PR_NAME/comment.md"
fi
else
echo -e "\nNothing was released.\n" >> "$PR_NAME/comment.md"
fi
# Add info how to update catalog for FBC bundles
if [[ "$(params.fbc-enabled)" == "true" ]]; 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"
fi
fi
echo -e "\n## Troubleshooting\n\nPlease refer to the [troubleshooting guide]($DOC_LINK)." >> $PR_NAME/comment.md
echo -e "\nRun \`/pipeline restart $(params.pipeline_name)\` in case of pipeline failure to restart a pipeline." >> $PR_NAME/comment.md
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,9 @@ spec:
- iib-quay-credentials (default) - for connect and marketplace repositories
- community-push-final-index-quay-credentials - for community repositories
default: iib-quay-credentials
workspaces:
- name: output
description: Scratch space and storage for the comment and related data
steps:
- name: skopeo-copy
# Pipeline image is needed for Red Hat internal SSL cert
Expand Down Expand Up @@ -87,6 +90,13 @@ spec:
esac
echo "FROM_INDEX: $FROM_INDEX"
# Replace internal registry with external address
INDEX_NAME="${FROM_INDEX#*----}"
if [[ "$(params.environment)" == "prod" ]]; then
FROM_INDEX_PROXY="registry.redhat.io/redhat/${INDEX_NAME}"
else
FROM_INDEX_PROXY="registry.stage.redhat.io/redhat/${INDEX_NAME}"
fi
echo "Copying index images to published repos..."
TEMP_IMAGES=$(echo $(params.index_image_paths) | tr "," " ")
Expand Down Expand Up @@ -122,4 +132,8 @@ spec:
--dest-creds $QUAY_USER:$QUAY_TOKEN \
docker://$SRC_IMAGE \
docker://$DEST_IMAGE_PERMANENT_TAG
# Save data about indexes to volume
RELEASE_INFO_DIR_PATH="$(workspaces.output.path)/release_info"
echo "- ${FROM_INDEX_PROXY}:${VERSION}" | tee -a "$RELEASE_INFO_DIR_PATH/updated_indices.txt"
done
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ spec:
if [[ ! -f "$CONFIG_PATH" || -z "$(params.bundle_path)" ]]; then
echo "Config file $CONFIG_PATH does not exist or no bundle affected."
echo "replaces" | tee $(results.upgrade-graph-mode.path)
echo "false" | tee $(results.fbc-enabled.path)
echo -n "false" | tee $(results.fbc-enabled.path)
exit 0
fi
Expand All @@ -62,5 +62,5 @@ spec:
UPGRADE_GRAPH_MODE=`echo $UPGRADE_GRAPH_MODE | sed 's/-mode$//'`
fi
echo $FBC_ENABLEMENT | tee $(results.fbc-enabled.path)
echo -n $FBC_ENABLEMENT | tee $(results.fbc-enabled.path)
echo -n $UPGRADE_GRAPH_MODE | tee $(results.upgrade-graph-mode.path)

0 comments on commit 7690bbf

Please sign in to comment.