Thanks to visit codestin.com
Credit goes to github.com

Skip to content

improve release workflow to detect breaking changes #5233

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

Closed
1 of 3 tasks
Tracked by #4748
bpmct opened this issue Dec 1, 2022 · 4 comments · Fixed by #5675
Closed
1 of 3 tasks
Tracked by #4748

improve release workflow to detect breaking changes #5233

bpmct opened this issue Dec 1, 2022 · 4 comments · Fixed by #5675
Assignees

Comments

@bpmct
Copy link
Member

bpmct commented Dec 1, 2022

  • We need to be aware of a breaking change prior to doing a release
    • We have a way to label a PR as “breaking” pre-merge and post-merge
      • pre-merge: engineer can mark as commit as breaking with feat!: or fix!:
        • the label release-breaking is automatically added to the PR
      • post-merge: engineer or PM can label a PR as release-breaking
  • When a release is created, it should be impossible to create a patch release if there were PRs with breaking changes
    • Any breaking changes are in a separate section in the changelog
    • We modify our changelog generation script to look up corresponding PRs, check for a breaking label, and sort them accordingly
    # old workflow
    git tag -m "release v0.0.0" v0.0.0
    git push origin v0.0.0
    
    # new workflow
    ./scripts/release.sh patch [-n|--dry-run]
    error: found breaking change
    promote to minor

Things to consider

  • Documentation on how to create a release.
  • Removing the workflow on tag to prevent "legacy releases"
@bpmct bpmct mentioned this issue Dec 1, 2022
21 tasks
@deansheather
Copy link
Member

deansheather commented Dec 1, 2022

I think we should delegate the decision on what tag to make to the workflow. If we change the workflow to not run on tag, and instead run on workflow dispatch (like in v1) we can make the script decide what version to use by itself, and optionally have some controls for forcing version bumps if we really want different behavior to what the script decides.

The script will decide what version bump to use (based on tags like release-breaking or whatever other metric we want) and then create the tag by itself.

@mafredri
Copy link
Member

mafredri commented Dec 2, 2022

@deansheather are you simply referring to that ./release.sh would normally take no argument, but you can optionally give it --minor to bump the specific number?

Or are you referring to how ./release.sh is run. I.e. by someone locally or via a github action or some such?

Wrt to the latter, I think for the first step to improving this, it'd be fine if it's run manually by a user on their machine.


With regard to implementation, it seems quite straightforward how we can pull this information out during release. Some initial exploration:

# Compare HEAD to previous versiongit log --oneline HEAD...v0.13.1
81c39487 (HEAD -> main, origin/main, origin/HEAD) fix: Close tty first in `ptytest` cleanup (#5252)
ee4f0fc5 chore: enable debug logging for gotestsum (#5248)
8469dbc0 fix: add index to `provisioner_jobs.started_at` (#5245)
92c217bd fix: add index on `workspace_agents.auth_token` (#5244)

# For each hash, check associated PRsgh api -H "Accept: application/vnd.github+json" /repos/coder/coder/commits/81c39487/pulls | jq -r '.[].labels[].name'
release/test

This'll most likely require a GH API key so we don't run into any rate limitations, utilizing gh is optional but convenient.

@deansheather
Copy link
Member

It's very easy to add parameters to a workflow dispatch run so it can be run on GitHub. Check the release workflow in coder v1, it just asks for what version you want to mark and tags it for you. In this case, you would just have checkboxes for whether you want to "force" a major, minor or patch and then have the workflow determine the tag to use and create it, then build coder.

mafredri added a commit that referenced this issue Dec 9, 2022
This commit introduces three new scripts:

- `release.sh` To be run by a user on their local machine to preview and
  create a new release (tag + push)
- `check_commit_metadata.sh` For e.g. detecting breaking changes
- `genereate_release_notes.sh` To display the generated release notes,
  used for previews and in `publish_release.sh`

The `release.sh` script can be run without arguments, and it will
automatically determine if we're to do a patch or minor release. A minor
release can be forced via `--minor` flag.

Breaking changes can be annotated either via commit/merge title prefix
(`feat!:`, `feat(api)!:`), or by adding the `release/breaking` label to
the PR that was merged (on GitHub).

Related #5233

This work will be followed up by changes to move the tag creation from
`release.sh` to CI workflows, the `release.sh` will then become a
lightweight wrapper to run the workflow.
mafredri added a commit that referenced this issue Dec 15, 2022
This commit introduces three new scripts:

- `release.sh` To be run by a user on their local machine to preview and
  create a new release (tag + push)
- `check_commit_metadata.sh` For e.g. detecting breaking changes
- `genereate_release_notes.sh` To display the generated release notes,
  used for previews and in `publish_release.sh`

The `release.sh` script can be run without arguments, and it will
automatically determine if we're to do a patch or minor release. A minor
release can be forced via `--minor` flag.

Breaking changes can be annotated either via commit/merge title prefix
(`feat!:`, `feat(api)!:`), or by adding the `release/breaking` label to
the PR that was merged (on GitHub).

Related #5233
@mafredri
Copy link
Member

With #5366 merged, this issue is now 90% complete. We still need to disallow manual tag/push to prevent human error in deciding if it's a patch/minor release (#5382).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants