Skip to content

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

Merged
linhcrl merged 1 commit into
cockroachdb:mainfrom
linhcrl:pre-release-branch-management
May 19, 2026
Merged

[CNSL-1934] Add automated pending deploy branch management#105
linhcrl merged 1 commit into
cockroachdb: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 (workflow_dispatch trigger):

    • Finds the latest automation/pending-deploy-YYYYMMDD-hhmmss branch
    • Creates a PR to merge it into main
    • Triggers a pending deploy check
  2. pending-deploy-check.yml (pull_request and workflow_dispatch 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.


Testing

Did a mini bug bash testing the SDK release workflows end to end. Here are some test cases I tested for this workflow: https://docs.google.com/spreadsheets/d/1_SJbN6T9XU3_r01guk-KrCYoLQocs6ECaRNghr28X5A?gid=1453507795#gid=1453507795

Example PR: https://github.com/cockroachlabs/cockroach-cloud-sdk-go-automation-testing/pull/184


Relevant screenshots

PR opened by pending-deploy-pr.yml (before all the problematic commits got removed)

Screenshot 2026-05-15 at 2 58 59 AM

Comment left by pending-deploy-check.yml on failed check (before the problematic commits got removed)

Screenshot 2026-05-15 at 2 59 10 AM

@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?

Comment thread .github/workflows/pending-deploy-check.yml Outdated
Comment thread .github/workflows/pending-deploy-check.yml Outdated
Comment thread .github/workflows/pending-deploy-check.yml Outdated
Comment thread .github/workflows/pending-deploy-pr.yml Outdated
Comment thread .github/workflows/pending-deploy-pr.yml Outdated
@linhcrl linhcrl force-pushed the pre-release-branch-management branch 20 times, most recently from 1b798ac to 932dd50 Compare May 7, 2026 02:20
@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
@linhcrl linhcrl force-pushed the pre-release-branch-management branch from 5a243b1 to 3f08d25 Compare May 8, 2026 18:23
@linhcrl linhcrl changed the title [CNSL-1934] Add pre-release pending deploy branch management [CNSL-1934] Add automated pending deploy branch management May 8, 2026
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 a few nits on this. It would be nice to generate some tests as well for what we can.

Comment thread scripts/pending-deploy-pr.sh Outdated
Comment thread scripts/pending-deploy-pr.sh Outdated
Comment thread scripts/pending-deploy-pr.sh Outdated
@linhcrl linhcrl force-pushed the pre-release-branch-management branch 5 times, most recently from ba9fc08 to c6b7cac Compare May 12, 2026 00:52
@linhcrl
Copy link
Copy Markdown
Contributor Author

linhcrl commented May 12, 2026

I left a few nits on this. It would be nice to generate some tests as well for what we can.

added some tests

@linhcrl linhcrl requested a review from fantapop May 12, 2026 02:30
@linhcrl linhcrl force-pushed the pre-release-branch-management branch 4 times, most recently from 0427cba to 7b3ab47 Compare May 15, 2026 06:47
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've left some nits and small feedback. signing off though.

check_all_commits "release-2024-01-01-1"

# Check that commit was added to missing_trailer.txt
grep -q "abc123|Add new feature" missing_trailer.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.

is there a long opt we can use?

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

Comment thread scripts/lib/pending-deploy-helpers.sh Outdated
Comment on lines +193 to +194
# Check if the branch has commits not in main
check_commits() {
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.

nit: This name seems too similar to the check_all_commits function above. Are there some more specific names we can use?

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.

renamed to check_branch_has_new_commits

Comment thread scripts/lib/pending-deploy-helpers.sh Outdated
return 0
fi

export GH_TOKEN="$GITHUB_TOKEN"
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.

nit: If possible we should do this further up in the call chain. Having such similar env vars we're shuffling between down here is not ideal.

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.

moved it to right after the validation step

Comment thread scripts/lib/validation.sh

# Check if required commands are available in PATH
# Usage: check_required_commands "cmd1" "cmd2" "cmd3"
check_required_commands() {
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 see this in the #108 pr as well. Looks like you'll have to do some rebasing.

Comment on lines +52 to +54
# Fetch the latest managed-service release tag for comparison
if ! get_latest_release_tag; then
exit 1
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.

Should we log an error here?

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.

done!

Comment thread scripts/pending-deploy-pr.sh Outdated
Comment on lines +29 to +42
if [[ -z "${GITHUB_TOKEN:-}" ]]; then
log_error "GITHUB_TOKEN environment variable is required"
exit 1
fi

if [[ -z "${GITHUB_REPOSITORY:-}" ]]; then
log_error "GITHUB_REPOSITORY environment variable is required"
exit 1
fi

if [[ -z "${GITHUB_OUTPUT:-}" ]]; then
log_error "GITHUB_OUTPUT environment variable is required"
exit 1
fi
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.

nit: I think I've seen this pattern a few times. We could have a check_required_env vars similar to check_required_params.

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 check_required_env and added some test cases! Great idea, thanks!

@linhcrl linhcrl force-pushed the pre-release-branch-management branch 3 times, most recently from db3f910 to b0de887 Compare May 15, 2026 21:50
Introduces two workflows to manage the release process:

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

2. pending-deploy-check.yml (pull_request and workflow_dispatch
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 <roachdev-claude-bot@cockroachlabs.com>
@linhcrl linhcrl force-pushed the pre-release-branch-management branch from b0de887 to d529ed4 Compare May 19, 2026 01:21
@linhcrl linhcrl merged commit 7c37c8c into cockroachdb:main May 19, 2026
2 checks passed
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