[CNSL-1934] Add automated pending deploy branch management#105
Conversation
f81608f to
427284b
Compare
f9a2f35 to
cb4189b
Compare
cb4189b to
3f5a6bc
Compare
fantapop
left a comment
There was a problem hiding this comment.
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?
1b798ac to
932dd50
Compare
932dd50 to
5a243b1
Compare
5a243b1 to
3f08d25
Compare
fantapop
left a comment
There was a problem hiding this comment.
I left a few nits on this. It would be nice to generate some tests as well for what we can.
ba9fc08 to
c6b7cac
Compare
added some tests |
0427cba to
7b3ab47
Compare
fantapop
left a comment
There was a problem hiding this comment.
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 |
There was a problem hiding this comment.
is there a long opt we can use?
| # Check if the branch has commits not in main | ||
| check_commits() { |
There was a problem hiding this comment.
nit: This name seems too similar to the check_all_commits function above. Are there some more specific names we can use?
There was a problem hiding this comment.
renamed to check_branch_has_new_commits
| return 0 | ||
| fi | ||
|
|
||
| export GH_TOKEN="$GITHUB_TOKEN" |
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
moved it to right after the validation step
|
|
||
| # Check if required commands are available in PATH | ||
| # Usage: check_required_commands "cmd1" "cmd2" "cmd3" | ||
| check_required_commands() { |
There was a problem hiding this comment.
I see this in the #108 pr as well. Looks like you'll have to do some rebasing.
| # Fetch the latest managed-service release tag for comparison | ||
| if ! get_latest_release_tag; then | ||
| exit 1 |
There was a problem hiding this comment.
Should we log an error here?
| 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 |
There was a problem hiding this comment.
nit: I think I've seen this pattern a few times. We could have a check_required_env vars similar to check_required_params.
There was a problem hiding this comment.
Added check_required_env and added some test cases! Great idea, thanks!
db3f910 to
b0de887
Compare
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>
b0de887 to
d529ed4
Compare
Introduces two workflows to manage the release process:
pending-deploy-pr.yml (workflow_dispatch trigger):
pending-deploy-check.yml (pull_request and workflow_dispatch trigger):
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)
Comment left by pending-deploy-check.yml on failed check (before the problematic commits got removed)