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

Release automation and keeping up project momentum #4025

Open
davidspek opened this issue Aug 28, 2023 · 18 comments · May be fixed by #4083
Open

Release automation and keeping up project momentum #4025

davidspek opened this issue Aug 28, 2023 · 18 comments · May be fixed by #4083

Comments

@davidspek
Copy link
Collaborator

Background

It's no secret that the project hasn't been the most active in terms of releases. It's my opinion that the slow and unpredictable release cycle is also partly responsible for the slow momentum of the project and contributions. To solve this, I would like to propose a fully automated release cycle so that contributors know when their improvements will be included in a release and maintainers don't need to manually plan and execute each release.

The setup

  1. We enforce PR titles to be named in accordance to the Conventional Commit specification using this GitHub Action.
  2. We configure the repository to only allow Squash commits and Default to pull request title so that the commits merged into the repo follow the the Conventional Commit specification. See below for the setting for the repo.
  3. We configure Semantic Release to use the Conventional Commit specification and run it monthly using this GitHub Action. Semantic Release will take care of creating the appropriate Git tags for the commits that were pushed since the last release. It also creates a release on GitHub with the changelog, and will comment on merged PRs in which release the changes have been included.

This allows us to publish new versions of distribution/distribution in a fully automated fashion with the release versions conforming to proper SemVer and no need for manual intervention.

Repo setting for only allow squash merges:
image

Open points for discussion

Naturally a change like this brings up a lot of discussion points. Here are a few that I'd like to bring up. However, none of these should be blocking for the initial implementation for the automation.

Release cadence

Having a high release cadence can be a chore for users of the software. Releasing quarterly I feel might not keep the project momentum as high as releasing monthly, but it is also a good option instead of monthly. While it would be possible to release a new version every day, week or for each new commit, since this project is used by big services as part of their infrastructure I don't believe this is a good choice.

Branching structure

The choice of how we want to create release branches for back porting fixes has a big influence on how our PR workflow will look and how Semantic Release needs to be configured. For some background information I highly recommend reading this documentation for Semantic Release.

Currently we are creating branches for minor versions (e.g. release/2.7, release/2.8). When following proper SemVer, minor versions shouldn't introduce any breaking changes. As such, I'm not sure we would need to create branches for minor versions going forward (this should also reduce the maintenance burden somewhat, also taking errors with Semantic Release into account). Personally I think we should only create branches for new major versions.

This also brings up the discussion about what the default release branch should be. Taking the upcoming v3 release as an example I think there are 2 setups to consider:

  1. The main branch is and remains the release branch for v3 going forward. This means contributors can simply target the main branch to add their improvements for the current release. This also mean we don't need to setup a bunch of automation to merge changes from main into release the branch(es). For any breaking changes, they would target the branch named next. Before merging next into main for the v4 release, a branch for v3 is created for continued support and fixes.
  2. For the v3 release a v3 release branch is created. All contributors wanted to add improvements to the current release would need to target that branch. The main branch would then again be used for the next major release (similar to next from option 1). We'd need to setup automation for merging any minor and patch commits from the main branch into the v3 release branch.

To avoid the current situation where the main branch has diverged enormously from the current release branch (which in my opinion seriously hinders the momentum of the project), my preference is for the first option. This should also significantly reduce the burden for maintainers, remove the need for additional complex automation workflows and be more transparent for contributors.

@davidspek
Copy link
Collaborator Author

@Jamstah
Copy link
Collaborator

Jamstah commented Aug 28, 2023

What would we consider to be supported targets for security updates? (https://github.com/distribution/distribution/blob/main/SECURITY.md)

Would we support 3.0 after release of 3.1?

@davidspek
Copy link
Collaborator Author

Since there would be no breaking changes between v3.0.x and v3.1.x I think for security fixes people can upgrade to new minor versions. So if a CVE is found in versions v3.0.0 and v3.1.0, we release a fix in version v3.1.1 and people from v3.0.0 would upgrade to it. So in a way v3.1 and newer releases is how v3.0 is supported.

Now arguably I'm not sure if this approach is water tight and many projects to create release branches for minor versions. However, this might be because they aren't following proper SemVer (which is extremely common). Now I'm not sure what all the pros and cons are of branching only for major versions compared to for minor versions as well and am happy for input here.

What I do know is that supporting branches for minor versions will increase the burden of maintainers a lot and require a bunch more automation. Since the goal here is to help get the pace of the project up and keeping it there I'm biased towards the solution with the least maintenance overhead. However, once we have a solid group of active maintainers and regular releases the situation is completely different and having release branches for minor versions might make a lot of sense.

@milosgajdos
Copy link
Member

What would we consider to be supported targets for security updates? (https://github.com/distribution/distribution/blob/main/SECURITY.md)

Would we support 3.0 after release of 3.1?

I kinda like the approach Go team takes: support only the last 2 Minor releases https://github.com/golang/go/wiki/MinorReleases

@davidspek
Copy link
Collaborator Author

Having a closer look at some of the semantic release documentation here, it actually confirms what I thought we could do going forward. We can create the branches for minor versions from the existing version tags as we need to release fixes on top of minor versions.

Scenarion:

  • main is the current release branch with the tag v3.0.0
  • a new feature gets added to the main branch and v3.1.0 gets released (and a git tag is created)
  • another new feature gets added to the main branch and v3.2.0 gets released
  • A CVE comes in that we'd like to fix also fix on the previous minor versions
    • A fix for the CVE is pushed to main and the v3.2.1 release is created
    • A v3.0.x branch is created from the v3.0.0 tag and the commit with the fix is merged into it and v3.0.1 is released
    • A v3.1.x branch is created from the v3.1.0 tag and the commit with the fix is merged into it and v3.0.1 is released

This way we can still use the main branch for the current release, and we don't need to pre-create all the release branches for each minor version since that will create a huge amount of maintenance overhead.

@Jamstah
Copy link
Collaborator

Jamstah commented Aug 28, 2023

Are we planning for beta/rc releases? How do they work?

@milosgajdos
Copy link
Member

Are we planning for beta/rc releases? How do they work?

We should do. We have done that in past, but how theyre supported and how they work was never properly "codified" so we should discuss that.

@davidspek
Copy link
Collaborator Author

I'll need to do some testing with the automation I've described above to see how it ends up working exactly. Then I'll also play around with beta/rc releases. For v3 I think it's obvious that this should be done. However, I don't think we'd need beta/rc releases for patch (and possibly minor) releases. I think this was done in the past mainly because the release cadence was slow which we're trying to combat here.

@davidspek davidspek added this to the Registry/3.0.0 milestone Aug 29, 2023
@wy65701436
Copy link
Collaborator

I appreciate the proposal, and it's important for us to establish a concrete release cadence.

  • For major releases, we can aim for a 3-4 month cycle. These releases will primarily focus on introducing new features and enhancements.
  • For minor/patch releases, a monthly cycle would be suitable. These releases will primarily address bugs and any identified CVEs.

Additionally, we should define a process that includes beta, RC and GA.

@Jamstah
Copy link
Collaborator

Jamstah commented Aug 30, 2023

I think it's worth getting a beta release up ASAP even if it's not fully automated, then we can tell dependent projects about it

@milosgajdos
Copy link
Member

Yes, we should kick things off for v3 with an alpha (or beta) release.

Going forward I think the monthly release cycle makes sense to me 🤔

Personally, I'd prefer RCs only in scenarios that introduce some new behaviour or major b/w compatibility breakage kinda thing. Otherwise we should stick to semver releases 🤔

@thaJeztah
Copy link
Member

I'll give this a more thorough read, but one quick comment;

We configure the repository to only allow Squash commits

I really prefer NOT to do this. Github's squash commits are... rather bad;

  • they remove any (GPG) signing from the commits
  • it's a lot more difficult to find trace back origin (e.g. the commit SHA no longer matches the commits from the PR)
  • grouping commits into logical chunks of work should be part of the review process (and the author of the PR). Squashing all commits can lead to a more complicated history ("git blame" now pointing to a large diff, losing context of the changes on that specific line)

@milosgajdos
Copy link
Member

I agree with @thaJeztah, I am also against squashing commits. We can always ask explicitly for squash on a PR if need be.

@davidspek
Copy link
Collaborator Author

Then we'd need to find another way to enforce conventional commits for all the commits of a PR. Which can be a pain for contributors since rewriting a commit message is less easy than changing a GitHub PR title. I'm not against it though, just need to look into how to enforce it. I hope to get something setup for this this week or early next week.

@davidspek
Copy link
Collaborator Author

I appreciate the proposal, and it's important for us to establish a concrete release cadence.

  • For major releases, we can aim for a 3-4 month cycle. These releases will primarily focus on introducing new features and enhancements.
  • For minor/patch releases, a monthly cycle would be suitable. These releases will primarily address bugs and any identified CVEs.

Additionally, we should define a process that includes beta, RC and GA.

@wy65701436 Major releases would only be created for breaking changes, not for new features and enhancements. Those are what minor releases are for. For a setup like this to work we need to be strict with enforcing SemVer, and Semantic Release helps us with enforcing SemVer strictly.

@corhere
Copy link
Collaborator

corhere commented Aug 31, 2023

Conventional Commits would go a long way to enforce SemVer, but it relies on the author and reviewers to not make any mistakes. Tooling like https://pkg.go.dev/golang.org/x/exp/cmd/gorelease would help catch unintentional breaking API changes before it makes it into a release.

@davidspek
Copy link
Collaborator Author

Good suggestion. We should be able to layer that on top of conventional commits and run it in an action on PRs to check if a PR makes breaking changes.

@wy65701436
Copy link
Collaborator

wy65701436 commented Sep 1, 2023

Major

Yes, revise my comments, should be minor as item1 and patch for item2

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

Successfully merging a pull request may close this issue.

6 participants