Skip to content

New gh promotion steps#1

Draft
JohnAmican wants to merge 18 commits intomainfrom
new-gh-promotion-steps
Draft

New gh promotion steps#1
JohnAmican wants to merge 18 commits intomainfrom
new-gh-promotion-steps

Conversation

@JohnAmican
Copy link
Copy Markdown
Collaborator

No description provided.

JohnAmican and others added 18 commits January 2, 2026 16:11
Add JSON schema definitions for two new promotion steps:
- gha-dispatch-workflow: dispatches GitHub Actions workflows
- gha-wait-for-workflow: waits for workflow completion

Key schema features:
- inputs.promotion_id required for deterministic run discovery
- runID as string type to avoid float64 precision loss
- perPage option for high-concurrency repositories
- cancelOnAbort option for workflow cancellation on abort

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
Run `make codegen` to generate Go types from the new GHA step schemas:
- GhaDispatchWorkflowConfig
- GhaWaitForWorkflowConfig
- ExpectedConclusion enum type

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
Implement GitHubActionsClient for interacting with the GitHub Actions API:
- DispatchWorkflow: triggers workflow_dispatch events
- ListWorkflowRuns: lists runs filtered by event and branch
- GetWorkflowRun: retrieves a specific run by ID
- CancelWorkflowRun: cancels in-progress runs

Features:
- GitHubActionsAPI interface for testability
- Rate limit detection with retry information
- TLS skip verification option for testing
- Proper GitHub API headers and authentication

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
Implement the dispatcher step for GitHub Actions workflows:
- Dispatches workflow_dispatch events via GitHub API
- Discovers the run ID using promotion_id in run-name
- Polls for matching runs with configurable timeout and perPage
- Outputs runID (as string) and runURL for downstream steps

Key features:
- Deterministic run discovery via ::promotion_id:: pattern matching
- Rate limit handling with backoff
- Context cancellation support
- Helpful warnings when run discovery fails

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
Implements the wait step for GitHub Actions workflows. This step:
- Polls for workflow run completion using GetWorkflowRun API
- Returns StatusRunning while workflow is in progress
- Returns StatusSucceeded when workflow completes (optionally checking expectedConclusion)
- Returns StatusFailed with TerminalError on unexpected conclusion or 404
- Supports cancelOnAbort (defaults to true) to cancel workflow when promotion aborts
- Uses string type for runID to avoid JSON float64 precision loss

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
Implements FakeGitHubActionsClient that satisfies GitHubActionsAPI interface.
Each method can be configured with a custom function, enabling isolated testing
of dispatcher and waiter steps without real GitHub API calls.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
Add function field getClientFn to dispatcher and waiter structs to allow
injecting fake clients in tests without global state. This follows patterns
used elsewhere in the codebase for testing external service integrations.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
Comprehensive unit test coverage for GitHub Actions promotion steps:

- gha_client_test.go: HTTP client tests using httptest.NewServer
  - Tests for dispatch, list, get, and cancel workflow operations
  - Rate limit detection tests

- gha_dispatcher_test.go: Dispatcher step tests
  - Schema validation tests for all required/optional fields
  - matchPromotionID function tests for all delimiter patterns
  - parseGitHubRepoURL tests for URL parsing edge cases
  - Run discovery tests including timeout and rate limit handling
  - Integration tests with FakeGitHubActionsClient

- gha_waiter_test.go: Waiter step tests
  - Schema validation tests
  - Status handling (queued, in_progress, completed)
  - Expected conclusion matching
  - Cancel on abort behavior
  - Error handling (404, rate limit, API errors)

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
Mock server simulates GitHub Actions API endpoints:
- POST /repos/{owner}/{repo}/actions/workflows/{workflow}/dispatches
- GET /repos/{owner}/{repo}/actions/workflows/{workflow}/runs
- GET /repos/{owner}/{repo}/actions/runs/{run_id}
- POST /repos/{owner}/{repo}/actions/runs/{run_id}/cancel

Control endpoints for testing:
- /_control/reset - Reset server state
- /_control/config - Configure delays and conclusions
- /_control/health - Health check
- /test/dispatches - Get captured dispatches for assertions

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
Adds GHA mock server as a Tilt resource:
- Docker build from hack/gha-mock/
- Port forward on 30084 for local access
- Labeled under 'testing' for organization

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
Changes:
- Remove professional/beta tags (now open source)
- Remove "Akuity Platform only" notices
- Change runID type from integer to string (avoids JSON precision issues)
- Add inputs.promotion_id as required field with run-name pattern docs
- Add perPage option for high-concurrency repos
- Add cancelOnAbort option for waiter step
- Add runURL and status to outputs
- Add Run Discovery section with workflow configuration examples

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
The Dockerfile now copies go.mod to ensure proper module resolution
during the Docker build process. Updated Go version to 1.25-alpine.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
Add deriveGitHubAPIBaseURL() to extract the API base URL from repository
URLs. For github.com, uses the default api.github.com. For other hosts
(GitHub Enterprise or mock servers), derives the URL from the repo host.

Also imports builtin promotion runner package in kubernetes webhooks to
ensure GHA step schemas are registered for validation.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
Add test manifests for GHA promotion steps integration testing:
- Project and ProjectConfig with auto-promotion enabled
- Secret with mock server credentials
- Warehouse with image subscription
- Stage with gha-dispatch-workflow and gha-wait-for-workflow steps

Use quote() function for runID to prevent expression evaluator from
converting string to number (avoids type validation error).

Enable allowCredentialsOverHTTP in dev values for local testing with
the HTTP-only mock server.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
Add assertions to verify that RetryAfter is set to 10 seconds when
the workflow is in a running state (queued, in_progress). This ensures
faster polling than the default 5-minute requeue interval.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
Document that quote() must be used when referencing runID from
gha-dispatch-workflow output to preserve the string type and prevent
type validation errors from the expression evaluator.

Update all examples to use the quote() function pattern and add
promotion_id to the multi-step workflow example.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
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.

1 participant