Skip to content

[scripts] Introduce a script that will create release/prerelease #6954

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

Open
wants to merge 12 commits into
base: master
Choose a base branch
from

Conversation

3vilhamster
Copy link
Contributor

@3vilhamster 3vilhamster commented May 26, 2025

What changed?
New script that helps to ensure prereleases/releases for all modular components
Example output:

./cadence-releaser prerelease
Getting known releases
Version transition: v1.2.19-prerelease16 → v1.2.19-prerelease17
⚠️  you are not on master
Continue? [y/N]: y

Planned Release Actions:

Create Tags:
  git tag v1.2.19-prerelease17
  git tag common/archiver/gcloud/v1.2.19-prerelease17
  git tag service/sharddistributor/leader/leaderstore/etcd/v1.2.19-prerelease17

Push Tags:
  git push origin v1.2.19-prerelease17
  git push origin common/archiver/gcloud/v1.2.19-prerelease17
  git push origin service/sharddistributor/leader/leaderstore/etcd/v1.2.19-prerelease17

Addition information that pushed to usage for help:

   # Development workflow
   ./cadence-releaser minor           # Start new minor version: v1.2.3 → v1.3.0-prerelease01
   ./cadence-releaser major           # Start new major version: v1.2.3 → v2.0.0-prerelease01
   ./cadence-releaser patch           # Start new patch version: v1.2.3 → v1.2.4-prerelease01
   ./cadence-releaser prerelease      # Iterate: v1.3.0-prerelease01 → v1.3.0-prerelease02
   ./cadence-releaser release         # Finalize: v1.3.0-prerelease03 → v1.3.0

   # Major version workflow  
   ./cadence-releaser major           # Start major version: v1.3.0 → v2.0.0-prerelease01
   ./cadence-releaser prerelease      # Iterate: v2.0.0-prerelease01 → v2.0.0-prerelease02
   ./cadence-releaser release         # Finalize: v2.0.0-prerelease02 → v2.0.0

   # Manual version override
   ./cadence-releaser release --set-version v1.4.0    # Override automatic calculation

Status overview

./cadence-releaser status
Getting known releases
Repository Release Status
========================
Branch: release-script
Global Version: v1.2.19-prerelease17

Modules and Versions:
  root                 v1.2.19-prerelease16
  common/archiver/gcloud v1.2.19-prerelease17
  service/sharddistributor/leader/leaderstore/etcd v1.2.19-prerelease16

Available Commands:
  releaser prerelease              # Increment prerelease number
  releaser release                 # Promote to final release
  releaser release -s v1.4.0       # Override with specific version

Why?
To simplify the release process and ensure that nothing is missed.

How did you test it?
Running local on my repo.

Potential risks
Invalid release tags

Release notes

Documentation Changes

@3vilhamster 3vilhamster changed the title [scripte] Introduce a script that will create release/prerelease [scripts] Introduce a script that will create release/prerelease May 26, 2025
Copy link
Member

@Groxx Groxx left a comment

Choose a reason for hiding this comment

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

(in progress and still thinking things through, submitted too soon by accident, sorry!)


other vague feelings, to use however you feel like:

  • tbh I don't see the point in checking build / etc. we shouldn't be tagging things that aren't already reviewed and available remotely, in which case the local state is almost completely meaningless.
    • same with tidying, the PR process covers that. or if we're actually checking for safety we should probably do a full make pr and make test but that's a bajillion times slower.
    • main branch as a limitation too: this would mean we wouldn't be able to make a hotfix branch and tag it. warning seems like a good idea, but enforcing doesn't seem beneficial.
    • removing that would cut out like 1/3 of the code here.
  • dir-walking to find modules feels kinda excessive... but the only alternative I can think of is go list -m github.com/uber/cadence/... which needs to download stuff and might be listing remote versions rather than local... which is weird but I can't find a way around it.
    • if we want to force "has zsh" then ls **/go.mod maybe, but that's not really any simpler with exec boilerplate so probably not.
    • this is not really a comment about the code, more "it feels strange that go list doesn't have a trivial option for this".
    • arguably reading go.work would be a good choice? it's the list of modules we want to release.
  • dry-run mode figures out versions, but doesn't help you figure out what to do if non-dry-run fails, and if it does fail then CheckVersionExists will just leave you with an incomplete process that you can't resume.
  • no exec.CommandContext means... can this be interrupted? or does urfave just kill the process (which would hide error output if killed while a command was busy)

tbh I kinda feel like this whole thing could be reduced to:

  • find modules (likely what you're already doing)
  • find versions (same)
  • increment (same) or set
    • warn about already-existing (definitely useful!) but don't stop
  • just print out the tagging and pushing commands to run by hand.

then there would be no need for dry run vs not, it'd be like half the code or less, hanging operations (like internal git auth) would be visible rather than simply hang forever, and working around any of the infinite variety of git errors is trivial because you don't have to fix the tool to do so.

and the tool could essentially be just a few keywords. I'd even skip urfave tbh.

# increments prerelease
> ./release
most-recent versions:
  v1.2.3-prerelease01
  .../gcloud v1.2.2   # helps find when out of sync

to tag:
  git tag v1.2.3-prerelease02
  git tag common/archiver/gcloud/v1.2.3-prerelease02

to release:
  git push origin v1.2.3-prerelease02
  git push origin common/archiver/gcloud/v1.2.3-prerelease02

# increment minor and make it a prerelease
> ./release minor
... v1.3.0-prerelease01 output

# drop prerelease
> ./release release
... v1.2.3 output

# choose a version if the arg passes semver parsing, with some simple issues
> ./release v1.2.3
warning: you are not on master
continue? [y/N]: y

warning: these tags already exist
  v1.2.3  GITSHAHERE
continue? [y/N]: y

to tag:
  git tag v1.2.3
  git tag common/archiver/gcloud/v1.2.3

to release:
  git push origin v1.2.3
  git push origin common/archiver/gcloud/v1.2.3

case "minor":
newVersion = currentVersion.IncMinor()
case "patch":
newVersion = currentVersion.IncPatch()
Copy link
Member

Choose a reason for hiding this comment

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

ah, nice, these do the right thing around prerelease / zeroing lower fields / etc. thanks, mastermind!

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 this pull request may close these issues.

4 participants