Skip to content

Approval Workflow

This page provides a detailed walkthrough of the deploy approval workflow, from request creation to deployment completion.

When CI tests pass, the pipeline creates an approval request.

Terminal window
rack-gateway deploy-approval request \
--app myapp \
--git-commit "$CIRCLE_SHA1" \
--branch "$CIRCLE_BRANCH" \
--ci-metadata '{"workflow_id":"$CIRCLE_WORKFLOW_ID","pipeline_number":<< pipeline.number >>}' \
--message "Deploy $CIRCLE_BRANCH to production"
FieldSourcePurpose
git_commit_hash--git-commitIdentifies approved code
git_branch--branchContext for reviewers
ci_metadata--ci-metadataCI provider integration
message--messageHuman-readable description
target_api_token_idAuto-detectedToken that will use approval
app--appApplication name

If GitHub integration is configured, the gateway verifies the commit:

Verification modes:

  • latest: Commit must be the latest on the branch
  • branch: Commit must exist on the branch (uses git compare API)

Admins see pending requests in the web UI.

The review UI shows:

  • Git commit hash - Links to VCS provider
  • Branch name - Source branch
  • PR link - If GitHub verification found one
  • CI pipeline - Links to CircleCI pipeline
  • Message - Context from CI
  • Created by - CI/CD token used
  • Time - When request was created
ActionRequiresResult
ApproveMFA step-upRequest approved, CI auto-approved
RejectNoneRequest rejected with notes
IgnoreNoneRequest expires automatically
  1. Admin clicks Approve

    Initiates approval flow

  2. MFA challenge presented

    Admin must verify with TOTP, WebAuthn, or backup code

  3. MFA verified

    Server validates the MFA response

  4. Request marked approved

    Status changes, expiration timer starts

  5. CI auto-approval triggered

    If configured, gateway calls CI API

Admins can add notes when approving:

{
"status": "approved",
"approval_notes": "Reviewed diff, LGTM. PR #123 approved by team.",
"approved_by_user_id": 42,
"approved_at": "2024-01-15T10:30:00Z",
"approval_expires_at": "2024-01-15T10:45:00Z"
}

If CircleCI integration is configured, the gateway automatically approves the waiting job.

SettingValueExample
CIRCLECI_TOKENAPI tokenyour-token
ci_provider (per-app)circleci-
circleci_approval_job_nameJob nameapprove_deploy_prod
circleci_auto_approve_on_approvaltrue-

When CI calls rack-gateway build, the gateway validates the manifest.

Default pattern: .*:{{GIT_COMMIT}}

convox.yml
services:
web:
image: myorg/app:abc123f-amd64 # Must match approved commit
worker:
image: myorg/app:abc123f-amd64

The gateway replaces {{GIT_COMMIT}} with the approved commit hash and validates all service images match.

After successful build:

FieldValue
object_urlS3 URL of build artifact
build_idConvox build ID

Every deployment action validates the approval.

ActionEndpointValidation
Build createPOST /apps/:app/buildsManifest + approval
Object uploadPOST /apps/:app/objectsApproval exists
Release promotePOST /apps/:app/releases/:id/promoteRelease linked to approval
Process execPOST /apps/:app/processes/:id/execApproval + command allowlist

After successful deployment, the request is marked as deployed.

{
"status": "deployed",
"build_id": "BABC123",
"release_id": "RABC123",
"deployed_at": "2024-01-15T10:42:00Z"
}

The complete workflow generates audit entries:

EventActorDetails
deploy_approval_request.createCI/CD tokenCommit, branch, message
deploy_approval_request.approveAdmin userNotes, MFA method
build.createCI/CD tokenBuild ID, manifest
release.promoteCI/CD tokenRelease ID
deploy_approval_request.rejectAdmin userNotes
Error: No active deploy approval found for this commit

Causes:

  • Approval request not created
  • Approval expired
  • Different commit hash

Resolution:

  • Create new approval request
  • Check commit hash matches exactly
ScenarioBehavior
CI job fails after approvalApproval still valid until expiry
Build failsCan retry build with same approval
Promote failsCan retry promote with same approval
Approval expiredMust create new request and get new approval
  • Always include accurate CI metadata
  • Use descriptive messages with branch and commit
  • Set appropriate timeout for --wait flag
  • Handle approval rejection gracefully
  • Review the diff before approving
  • Add meaningful notes explaining approval
  • Verify the PR is approved by team
  • Check CI status before approving
  • Keep approval window short (15 min recommended)
  • Require PR for production deployments
  • Review audit logs regularly
  • Use MFA for all admin accounts