Skip to content

Maintenance: Improve and automate release process #1231

Closed
@jeromevdl

Description

@jeromevdl

Summary

The release process for Powertools Java is mostly manual as of today. We do have some github actions to help (release-drafter for the release note, release-prep to upgrade versions) but they are not used and not complete.

To improve our MTTR, ease our release process and avoid any manual (human) error, we need to make it as automated as possible.

Why is this needed?

Manual releases are:

  • source of error (deploying a wrong version to maven central),
  • slow ("what's the next step?"),
  • infrequent ("too long, will do it another day")

And this is a vicious circle. slow/infrequent releases increase the risk of errors.

Which area does this relate to?

Automation, Governance

Solution

Leverage knowledge and existing process for Python version, especially see:

Also get inspiration on release-maven-plugin.

More precisely:

Inputs:

  • the release version (ex: 1.16.0)
  • the next snapshot version (ex: 1.17.0-SNAPSHOT)

Steps:

  1. checkout code
  2. Update maven pom files with the new version. Note sure using jacobtomlinson/gha-find-replace action is a good idea, because if we have a version similar to a dependency, it will also update it. Prefer using the versions-maven-plugin:
mvn versions:set -DnewVersion=x.y.z

⚠️ But it won't update the documentation and other projects (samples / e2e tests)...

  1. Create a hash of the code, to make sure code is not tampered when releasing
  2. Build / verify (unit + e2e tests + quality checks)
mvn -Pbuild-with-spotbugs clean verify -Dspotbugs.failOnError=true && mvn -Pe2e -B verify --file powertools-e2e-tests/pom.xml
  1. Commit and create a tag on git (❓can we do that on main branch. Otherwise we need to do a PR, but then the release process stops as we need to validate the PR. In python they release to Pypi before doing the tag/PR which is weird IMHO, release plugin is tagging before deploying... which is what we want/should do):
git commit -am "chore: version bump ${RELEASE_VERSION}"
git tag -a v"${RELEASE_VERSION}" -m "release_version: v${RELEASE_VERSION}"
  1. Checkout the tag
  2. Verify the hash: if someone committed in between, there will be a difference and release will stop
  3. Build & Release to maven central (use GitHub environments)
mvn clean deploy -Pbuild-without-spotbugs
  1. Close issues related to the release (see python script)
  2. Update CHANGELOG/releases (can we / do we want to automate this ❓), not sure with the dependabot PRs. We have the draft available, we need to have a human cleaning this.
  3. Update maven pom files and everything with the next snapshot version (see step 2):
mvn versions:set -DnewVersion=x.y.z-SNAPSHOT
  1. Commit/push (same question as step 5, we may not be able to push to main directly)

Acknowledgment

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

Status

Working on it

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions