Skip to content
This repository was archived by the owner on Sep 30, 2024. It is now read-only.

chore(rel): plug automatic changelog generation (RFC912)#62878

Merged
jhchabran merged 5 commits into
mainfrom
jh/rfc912
May 23, 2024
Merged

chore(rel): plug automatic changelog generation (RFC912)#62878
jhchabran merged 5 commits into
mainfrom
jh/rfc912

Conversation

@jhchabran

@jhchabran jhchabran commented May 23, 2024

Copy link
Copy Markdown
Contributor

Please see RFC912 for the context before that PR.

This PR plugs in the changelog tool that lives in sourcegraph/devx-service (a private repo) and uses its update-as-pr command to automatic open a pull request against the docs repo, which hosts the changelog for Sourcegraph itself.

You can see an example output over: https://github.com/sourcegraph/docs/pull/350/files for 5.4.2198.

The Changelog PR is created as part of the finalization process when promoting to the public.

We fetch the binary straight for the releases over https://github.com/sourcegraph/devx-service, which is a private repository. I've made the choice to not integrate this within Bazel, to avoid having the local environment depending on a private repository. This would have been okay, but it's simpler to keep things separate, at least for now.

Test plan

I tested all of this over a few different steps:

  1. Tested straight in Buildkite, by replacing the pipeline entirely (faster iterations)
  2. Tested in the finalization step of the internal release creation (to ensure it works within the release manifest).

An annotation is also submitted, to find the changelog PR easily.

image

@cla-bot cla-bot Bot added the cla-signed label May 23, 2024
@jhchabran jhchabran requested review from a team May 23, 2024 14:11
@jhchabran jhchabran marked this pull request as ready for review May 23, 2024 14:11
Comment thread release.yaml Outdated
trap 'rm ./changelog 2>/dev/null || true' EXIT

# Grab the token from sourcegraph-devx-bot
DEVX_GH_TOKEN="$(gcloud secrets versions access latest --secret=DEVX_SERVICE_GH_TOKEN --quiet --project=sourcegraph-ci)"

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Since this runs in CI DEVX_SERVICE_GH_TOKEN should exist in the environment (like RELEASE_REGISTRY_TOKEN used below). Should we not just use it directly?

We can also then add it as an env requirement in the release manifest?

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Sorry should've mentioned this earlier

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Good point, especially this steps only happens in CI

Comment thread release.yaml

chmod +x changelog

pr_url=$(./changelog \

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

I think it would help to put some comments on each flags, it's a bit lenghty

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

In the same note, are there any docs on the changelog tool?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

@burmudar burmudar left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

approving with one small comment which will be addressed :D

@jdpleiness jdpleiness left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Looks good, I just added a few questions that aren't blocking 🚀

Comment thread release.yaml

chmod +x changelog

pr_url=$(./changelog \

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

In the same note, are there any docs on the changelog tool?

Comment thread release.yaml
Comment on lines +158 to +176
# - name: 'validate promotion criteria'
# cmd: |
# echo "validating promotion criteria"
# body=$(wget --content-on-error -O- --header="Content-Type: application/json" "https://releaseregistry.sourcegraph.com/v1/releases/sourcegraph/{{version}}")
# exit_code=$?
#
# if [ $exit_code != 0 ]; then
# echo "❌ Failed to fetch release on release registry, got:"
# echo "--- raw body ---"
# echo $body
# echo "--- raw body ---"
# exit $exit_code
# fi
# if [ $exit_code != 0 ]; then
# echo "❌ Failed to fetch release on release registry, got:"
# echo "--- raw body ---"
# echo $body
# echo "--- raw body ---"
# exit $exit_code
# fi
#
# is_development=$(echo "$body" | jq -r '.is_development')
# if [ "$is_development" = "true" ]; then
# echo "cannot promote a development release"
# exit 1
# fi
# is_development=$(echo "$body" | jq -r '.is_development')
# if [ "$is_development" = "true" ]; then
# echo "cannot promote a development release"
# exit 1
# fi

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Kind of out of scope of this PR, but looks like this is a guard to make sure we don't promote development releases, so why is this commented out atm?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

It was like this before I made my changes, cc @BolajiOlajide

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Yeah, the recent change to the release registry would require a rework of this logic. This endpoint now returns an array of objects because we can have two releases with the same version, because one of them could be a development release.

@jhchabran jhchabran merged commit 8636535 into main May 23, 2024
@jhchabran jhchabran deleted the jh/rfc912 branch May 23, 2024 16:17
@craigfurman

Copy link
Copy Markdown
Contributor

@sourcegraph/release I added a note about this here: https://www.notion.so/sourcegraph/How-to-Create-a-Sourcegraph-Release-43dc0d5b608b4dad82057553af46cee2?pvs=4#0bfee201865d48e1920851a8ca24b9f8, so that hopefully we can remove most (all?) of the manual changelog steps when we use this code 💪

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants