Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add a check to verify the base commit build status in the release process #7775

Merged
merged 1 commit into from
Jun 5, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/workflows/prepare-release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ jobs:
branch: release/automated_v${{ inputs.version }}
title: Prepare for ${{ inputs.version }}
draft: false
body-path: changes-since-last-tag.txt
body-path: pr-body.txt
labels: no-jira-ticket
commit-message: Prepare for release ${{ inputs.version }}
token: ${{ secrets.GITHUB_TOKEN }}
Expand Down
2 changes: 1 addition & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -110,4 +110,4 @@ ssh_agent_commands.sh

# release script artifacts
extracted_changelog.md
changes-since-last-tag.txt
pr-body.txt
23 changes: 19 additions & 4 deletions tools/release-init.sh
Original file line number Diff line number Diff line change
Expand Up @@ -50,11 +50,26 @@ sed -i.bak -e "1s/.*/$RELEASE_HEADER/" "${project_dir}/CHANGELOG.md" || exit 1
sed -i.bak -e "/.*\[#????\](https.*/d" "${project_dir}/CHANGELOG.md"
rm "${project_dir}/CHANGELOG.md.bak" || exit 1

# make the PR description
PR_BODY_FILE="pr-body.txt"
# assumes that tags and history have been fetched
echo "commits since last tag:\n" > changes-since-last-tag.txt
git log $(git describe --tags --abbrev=0)..HEAD --oneline --no-merges >> changes-since-last-tag.txt
echo changes since last tag are
cat changes-since-last-tag.txt
GIT_HASH=$(git rev-parse HEAD)
# if you wish to run this locally you need to install the github cli (https://cli.github.com/manual)
# both the gh and jq are available in github actions natively
GH_STATUS_FOR_COMMIT=$(gh api -H "Accept: application/vnd.github+json" -H "X-GitHub-Api-Version: 2022-11-28" /repos/realm/realm-core/commits/$GIT_HASH/status)
GH_CHECK_STATE=$(echo $GH_STATUS_FOR_COMMIT | jq '.state')
echo "CI checks for $GIT_HASH:" > $PR_BODY_FILE
if [ "$GH_CHECK_STATE" = '"success"' ]; then
echo " succeeded! :white_check_mark:" >> $PR_BODY_FILE
else
echo " failed! :x:" >> $PR_BODY_FILE
fi
Comment on lines +61 to +66
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

So this just gives a ✅ or ❌ if the sum total of the checks failed or not?
Maybe for reference, make the $GIT_HASH value a link to the PR/commit used to to provide this status.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, I am taking advantage that the text is rendered in the Github PR description, which expands the text of the ✅ or ❌ to render the emoji. In the same way, Git hashes in a Github PR automatically become links to the commit, from that it should be easy to poke around and find the failing check.

echo "You may also want to manually verify the [evergreen checks](https://spruce.mongodb.com/commits/realm-core-stable)" >> $PR_BODY_FILE
echo "" >> $PR_BODY_FILE
echo "commits since last tag:" >> $PR_BODY_FILE
git log $(git describe --tags --abbrev=0)..HEAD --oneline --no-merges >> $PR_BODY_FILE
echo "The PR body file contains:"
cat $PR_BODY_FILE

echo Ready to make "${realm_version}"

Loading