Skip to content

Conversation

@neo-jesse
Copy link
Collaborator

@neo-jesse neo-jesse commented Dec 4, 2025

feat: Add chore-release and internal-release scripts for automated tagging

This PR introduces two new Python scripts to automate our release tagging process across multiple repositories:

  1. chore-release:

    • Automates the tagging of ot3-firmware, buildroot, oe-core, and opentrons for alpha releases.
    • Dynamically detects the latest chore_release-X.Y.Z branch from the opentrons repository and prompts for user confirmation.
    • Supports different tag increment logic for each repository type (numeric, semver, alpha).
    • Includes a --dry-run option to simulate tagging without making actual changes.
    • Cleans up cloned repositories after execution.
  2. internal-release:

    • Automates the tagging of ot3-firmware, buildroot, oe-core, and opentrons for internal releases.
    • Uses fixed branches for each repository (edge for opentrons, main for ot3-firmware and oe-core, opentrons-develop for buildroot).
    • Requires a version argument (e.g., 8.8.0) which is converted to an internal version (e.g., 2.8.0).
    • Determines the next alpha number based on the opentrons repository's existing tags for the given version.
    • Supports specific tag formats like internal@v23, internal@2.8.0-alpha.0, and ot3@2.8.0-alpha.0.
    • Includes a --dry-run option that efficiently fetches only remote tags (without cloning) to show proposed tags.

These scripts aim to streamline our release workflow, reduce manual errors, and ensure consistent tagging across our repositories

@codecov
Copy link

codecov bot commented Dec 4, 2025

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 57.10%. Comparing base (7512850) to head (b7dc0cc).
⚠️ Report is 75 commits behind head on edge.

Additional details and impacted files

Impacted file tree graph

@@             Coverage Diff             @@
##             edge   #20286       +/-   ##
===========================================
+ Coverage   25.58%   57.10%   +31.52%     
===========================================
  Files        3640     3660       +20     
  Lines      303120   306159     +3039     
  Branches    42327    43189      +862     
===========================================
+ Hits        77552   174832    +97280     
+ Misses     225544   131107    -94437     
- Partials       24      220      +196     
Flag Coverage Δ
app 46.60% <ø> (+45.67%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.
see 1927 files with indirect coverage changes

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@neo-jesse neo-jesse marked this pull request as ready for review December 8, 2025 22:03
Copy link
Member

@sfoster1 sfoster1 left a comment

Choose a reason for hiding this comment

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

Couple improvements in style and the way we use git, looks like a solid script though

Clone opentrons repo to a temp dir, list all remote chore_release-* branches,
and return the one with the highest X.Y.Z version.
"""
from tempfile import TemporaryDirectory
Copy link
Member

Choose a reason for hiding this comment

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

avoid inline imports unless they're needed for specific reasons

with TemporaryDirectory() as tmpdir:
tmp_path = Path(tmpdir)
run_command(
["git", "clone", "--origin", "origin", clone_url, "tmp-opentrons"],
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
["git", "clone", "--origin", "origin", clone_url, "tmp-opentrons"],
["git", "clone", clone_url, "tmp-opentrons"],

uses the default origin name anyway

tmp_path = Path(tmpdir)
run_command(
["git", "clone", "--origin", "origin", clone_url, "tmp-opentrons"],
cwd=tmp_path,
Copy link
Member

Choose a reason for hiding this comment

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

rather than using the subprocess cwd argument, let's use the git -C argument:

 -C <path>
           Run as if git was started in <path> instead of the current working directory. When
           multiple -C options are given, each subsequent non-absolute -C <path> is interpreted
           relative to the preceding -C <path>. If <path> is present but empty, e.g.  -C "", then
           the current working directory is left unchanged.

           This option affects options that expect path name like --git-dir and --work-tree in
           that their interpretations of the path names would be made relative to the working
           directory caused by the -C option. For example the following invocations are
           equivalent:

               git --git-dir=a.git --work-tree=b -C c status
               git --git-dir=c/a.git --work-tree=c/b status

)
repo_path = tmp_path / "tmp-opentrons"

branches_raw = run_command(
Copy link
Member

Choose a reason for hiding this comment

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

you can do this task ("find the highest-versioned chore_release-* branch") with the command git ls-remote, which can be given a url and then doesn't need to be run from a repo, i.e. git ls-remote https://github.com/opentrons/opentrons.git can be run from anywhere. This can't do its own filtering, but you're in a python script anyway so python can do it. That avoids a full clone here.

print("=" * 60)

run_command(
["git", "clone", "--origin", "origin", repo["clone_url"], str(target_dir)]
Copy link
Member

Choose a reason for hiding this comment

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

don't need --origin origin, that's default. also, since we now know the branch we want, we can add "-b", branch_name and "--shallow" to make the clone process much much faster

parser = argparse.ArgumentParser(
description="Automated multi-repo alpha release tagging script."
)
parser.add_argument(
Copy link
Member

Choose a reason for hiding this comment

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

let's set the working directory (CLEAN_DIR) with an argument so you can override it if you want, and then pass it around as a parameter rather than keeping it as a global

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.

3 participants