Skip to content

[CNSL-1934] Add pre-release pending deploy branch management#105

Open
linhcrl wants to merge 1 commit intocockroachdb:mainfrom
linhcrl:pre-release-branch-management
Open

[CNSL-1934] Add pre-release pending deploy branch management#105
linhcrl wants to merge 1 commit intocockroachdb:mainfrom
linhcrl:pre-release-branch-management

Conversation

@linhcrl
Copy link
Copy Markdown
Contributor

@linhcrl linhcrl commented Apr 11, 2026

Introduces two workflows to manage the release process:

  1. pending-deploy-pr.yml (repository_dispatch trigger):

    • Finds the latest pending-deploy-YYYYMMDD-hhmmss branch
    • Creates or reuses a PR to merge it into main
  2. pending-deploy-check.yml (pull_request trigger):

    • Validates pending deploy PRs before merge
    • Checks that Managed-service-commit-SHA trailers reference deployed commits
    • Blocks merge until all changes are confirmed deployed in managed-service
    • Posts PR comments detailing any undeployed commits

This ensures SDK releases only include changes that are live in production.


Relevant screenshots

PR opened by pending-deploy-pr.yml

Screenshot 2026-04-28 at 9 15 40 PM

Comment left by pending-deploy-check.yml on failed check

Screenshot 2026-04-28 at 9 10 05 PM

@linhcrl linhcrl changed the title [CNSL-1934] Add automated pending deploy branch management [CNSL-1934] Add pre-release pending deploy branch management Apr 13, 2026
@linhcrl linhcrl force-pushed the pre-release-branch-management branch from f81608f to 427284b Compare April 13, 2026 15:19
@linhcrl linhcrl force-pushed the pre-release-branch-management branch 5 times, most recently from f9a2f35 to cb4189b Compare April 29, 2026 01:10
@linhcrl linhcrl requested a review from fantapop April 29, 2026 01:16
@linhcrl linhcrl force-pushed the pre-release-branch-management branch from cb4189b to 3f5a6bc Compare April 30, 2026 20:46
Copy link
Copy Markdown
Contributor

@fantapop fantapop left a comment

Choose a reason for hiding this comment

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

I left some feedback. In general, this feels like a lot of logic to be inlining into these workflows and going untested. Did you consider the approach we took in the actions repo to separate out some of the logic to actual code files?

GH_TOKEN: ${{ secrets.MANAGED_SERVICE_TOKEN }}
run: |
# Get all release tags matching release-YYYY-MM-DD-N pattern
all_tags=$(gh api repos/cockroachlabs/managed-service/tags --paginate --jq '.[].name' | grep -E '^release-[0-9]{4}-[0-9]{2}-[0-9]{2}-[0-9]+$')
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

what does --paginate do here? Does that restrict us to the first page?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

added a comment to explain why it's necessary

Comment on lines +75 to +77
> not_deployed.txt
> missing_trailer.txt
> unexpected_status.txt
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

This is kind of a weird syntax... I guess if it works. Normally I would use touch

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

updated to touch

while IFS='|' read -r sha subject; do
echo "Checking commit $sha: $subject"

# Extract Managed-service-commit-SHA trailer from commit message
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

I'm not really clear whats going on here. Is trailer the right terminology to be used?

Copy link
Copy Markdown
Contributor Author

@linhcrl linhcrl May 7, 2026

Choose a reason for hiding this comment

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

"Trailer" should be the correct Git terminology here. Git commit trailers are standardized key-value pairs at the end of commit messages (like Signed-off-by: or Co-Authored-By:).

See the git-interpret-trailers for more info.


Context:
SDK commits include a Managed-service-commit-SHA: trailer that links back to the managed-service commit that generated the SDK changes.

What this part of the code does:
For each commit in the pending deploy branch, this section:

  1. Extracts the managed service commit SHA trailer
  2. If the trailer is missing, the commit gets categorized in missing_trailer.txt (these are commits we can't verify the deployment status of)
  3. If the trailer exists, it checks whether that managed-service SHA has been deployed by verifying it's in the latest release tag. If the SHA has not been deployed yet, we write it to the not_deployed.txt file. If we can't determine deployment status, we write it to unexpected_status.txt.
  4. At the end, we look at the contents of missing_trailer.txt, not_deployed.txt, and unexpected_status.txt. If any of them contain data, we fail the PR and comment on the PR with information about why the check failed. I included a screenshot of what this looks like

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Comment left by pending-deploy-check.yml on failed check

Screenshot 2026-04-28 at 9 10 05 PM

Comment thread .github/workflows/pending-deploy-pr.yml Outdated
Comment on lines +31 to +35
- name: Fetch latest remote refs
run: |
# Ensure we have the latest branches and tags from origin
git fetch origin --tags --force
git fetch origin --prune
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

I was surprised this step would be necessary in either workflow. Can you document why that is in a comment?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

removed

Comment thread .github/workflows/pending-deploy-pr.yml Outdated
git fetch origin --tags --force
git fetch origin --prune

- name: Find latest pending deploy branch
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

It looks like a lot of the stuff from this workflow are copied from the other workflow. Maybe it would make sense to bundle this stuff into an action instead.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

It doesn't seem like there's enough overlap to warrant shared actions but I moved things into shell scripts for better readability and left comments to explain what's happening

@linhcrl linhcrl force-pushed the pre-release-branch-management branch 20 times, most recently from 1b798ac to 932dd50 Compare May 7, 2026 02:20
Introduces two workflows to manage the release process:

1. pending-deploy-pr.yml (workflow_dispatch trigger):
   - Finds the latest pending-deploy-YYYYMMDD-hhmmss branch
   - Creates a PR to merge it into main

2. pending-deploy-check.yml (pull_request trigger):
   - Validates pending deploy PRs before merge
   - Checks that Managed-service-commit-SHA trailers reference deployed
     commits
   - Blocks merge until all changes are confirmed deployed in
     managed-service
   - Posts PR comments detailing any undeployed commits

This ensures SDK releases only reference deployed CC API changes.

Co-Authored-By: roachdev-claude <[email protected]>
@linhcrl linhcrl force-pushed the pre-release-branch-management branch from 932dd50 to 5a243b1 Compare May 7, 2026 03:15
@linhcrl linhcrl requested a review from fantapop May 7, 2026 03:57
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.

2 participants