Skip to content

Add Control Plane GitHub flow#44

Open
justin808 wants to merge 6 commits into
mainfrom
add-cpflow-github-flow
Open

Add Control Plane GitHub flow#44
justin808 wants to merge 6 commits into
mainfrom
add-cpflow-github-flow

Conversation

@justin808
Copy link
Copy Markdown
Member

@justin808 justin808 commented Apr 15, 2026

Summary

  • add the shared cpflow review app, staging deploy, and production promotion workflows
  • convert .controlplane config to staging/review/production app definitions and dynamic secret references
  • document the required GitHub settings for this repo, including DOCKER_BUILD_SSH_KEY for private GitHub dependencies

Validation

  • ruby /Users/justin/codex/control-plane-flow/cpflow config -a react-server-components-marketplace-demo-staging
  • ruby -e 'require "yaml"; Dir[".github/actions//.yml", ".github/workflows/.yml", ".controlplane//*.yml"].sort.each { |path| YAML.load_file(path, aliases: true) }'
  • DOCKER_BUILDKIT=1 docker build --ssh default --build-arg REACT_ON_RAILS_PRO_LICENSE=dummy -f .controlplane/Dockerfile -t react-server-components-marketplace-demo-cpflow-test .

Note

Medium Risk
Adds multiple GitHub Actions workflows that build Docker images with optional SSH keys and can deploy/delete apps in Control Plane; misconfiguration could impact deployment automation or accidentally tear down review apps (guarded by prefix checks).

Overview
Introduces a shared cpflow-based GitHub Actions deployment flow: opt-in PR review apps (/deploy-review-app), automatic staging deploys on branch pushes, manual staging→production promotion (with health check/rollback), and scheduled stale review app cleanup.

Updates Control Plane configuration to define separate staging/review/production apps (including upstream promotion) and switches template secret references to a dynamic {{APP_SECRETS}} placeholder with secrets managed directly in Control Plane.

Refreshes deployment docs and local Docker instructions (including SSH-forwarding for private GitHub dependencies) and points the main README.md deployment section to .controlplane/README.md.

Reviewed by Cursor Bugbot for commit 3ec73f2. Bugbot is set up for automated code reviews on this repo. Configure here.

@github-actions
Copy link
Copy Markdown

Control Plane review app commands

/deploy-review-app
Create the review app or redeploy the PR branch to it.

/delete-review-app
Delete the review app and its temporary resources.

/help
Show the required GitHub variables, secrets, and workflow behavior.

@coderabbitai
Copy link
Copy Markdown

coderabbitai Bot commented Apr 15, 2026

Warning

Rate limit exceeded

@justin808 has exceeded the limit for the number of commits that can be reviewed per hour. Please wait 23 minutes and 8 seconds before requesting another review.

Your organization is not enrolled in usage-based pricing. Contact your admin to enable usage-based pricing to continue reviews beyond the rate limit, or try again in 23 minutes and 8 seconds.

⌛ How to resolve this issue?

After the wait time has elapsed, a review can be triggered using the @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

We recommend that you space out your commits to avoid hitting the rate limit.

🚦 How do rate limits work?

CodeRabbit enforces hourly rate limits for each developer per organization.

Our paid plans have higher rate limits than the trial, open-source and free plans. In all cases, we re-allow further reviews after a brief timeout.

Please see our FAQ for further information.

ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: 2b5ee752-8b1d-4456-b165-ad8a894cba48

📥 Commits

Reviewing files that changed from the base of the PR and between b9bbd9b and 3ec73f2.

📒 Files selected for processing (15)
  • .controlplane/README.md
  • .controlplane/controlplane.yml
  • .controlplane/templates/app.yml
  • .github/actions/cpflow-build-docker-image/action.yml
  • .github/actions/cpflow-delete-control-plane-app/action.yml
  • .github/actions/cpflow-delete-control-plane-app/delete-app.sh
  • .github/actions/cpflow-setup-environment/action.yml
  • .github/workflows/cpflow-cleanup-stale-review-apps.yml
  • .github/workflows/cpflow-delete-review-app.yml
  • .github/workflows/cpflow-deploy-review-app.yml
  • .github/workflows/cpflow-deploy-staging.yml
  • .github/workflows/cpflow-help-command.yml
  • .github/workflows/cpflow-promote-staging-to-production.yml
  • .github/workflows/cpflow-review-app-help.yml
  • README.md
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch add-cpflow-github-flow

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

Copy link
Copy Markdown

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Choose a reason for hiding this comment

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

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 838f04f204

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment on lines +39 to +41
(github.event_name == 'issue_comment' &&
github.event.issue.pull_request &&
github.event.comment.body == '/deploy-review-app')
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P1 Badge Restrict /deploy-review-app to trusted commenters

The issue_comment trigger only checks github.event.comment.body == '/deploy-review-app', so any user who can comment on a PR can start this job. In that path the workflow resolves the PR SHA, checks out PR code, and then builds/deploys with repository secrets (CPLN_TOKEN_STAGING, optionally DOCKER_BUILD_SSH_KEY), which lets an untrusted fork PR exfiltrate credentials during build/deploy. Gate this command on trusted actor permissions (for example author_association/repo permission checks) before checking out or executing PR code.

Useful? React with 👍 / 👎.

Comment on lines +29 to +31
(github.event_name == 'issue_comment' &&
github.event.issue.pull_request &&
github.event.comment.body == '/delete-review-app') ||
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P2 Badge Restrict /delete-review-app to trusted commenters

The slash-command path for issue_comment accepts any PR comment with /delete-review-app and does not verify commenter trust level. On public repos this allows arbitrary external users to tear down active review apps for open PRs, causing avoidable outages/noise in the review workflow. Add an authorization check (e.g., OWNER/MEMBER/COLLABORATOR or equivalent permission) before executing the delete action.

Useful? React with 👍 / 👎.

Comment thread .github/actions/cpflow-build-docker-image/action.yml Outdated
Comment thread .github/workflows/cpflow-deploy-staging.yml
Comment thread .github/actions/cpflow-setup-environment/action.yml Outdated
jobs:
promote-to-production:
if: github.event.inputs.confirm_promotion == 'promote'
runs-on: ubuntu-latest
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Production promotion workflow lacks concurrency control

Medium Severity

The production promotion workflow is the only deployment workflow missing a concurrency group. The cleanup, review-app deploy, and staging deploy workflows all define concurrency controls, but this most critical workflow does not. If two promotions are triggered close together, both capture the same pre-promotion rollback state. If one succeeds and the other fails its health check, the failing run's rollback would revert the successful promotion — silently undoing a good deploy.

Fix in Cursor Fix in Web

Reviewed by Cursor Bugbot for commit 93293a5. Configure here.

value: cpln://secret/{{APP_SECRETS}}.RENDERER_PASSWORD
- name: REACT_ON_RAILS_PRO_LICENSE
value: cpln://secret/react-server-components-demo-secrets.REACT_ON_RAILS_PRO_LICENSE
value: cpln://secret/{{APP_SECRETS}}.REACT_ON_RAILS_PRO_LICENSE
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Undocumented template variable may not resolve in secrets

High Severity

{{APP_SECRETS}} is not among the documented cpflow v4.2.0 template variables (APP_ORG, APP_NAME, APP_LOCATION, APP_LOCATION_LINK, APP_IMAGE, APP_IMAGE_LINK, APP_IDENTITY, APP_IDENTITY_LINK). The PR validation used a local dev build of cpflow (ruby /Users/justin/codex/control-plane-flow/cpflow), but CI installs the published v4.2.0 gem. If the published gem doesn't resolve {{APP_SECRETS}}, every secret reference (DATABASE_URL, SECRET_KEY_BASE, etc.) would be a literal broken string, and the app would fail at runtime.

Fix in Cursor Fix in Web

Reviewed by Cursor Bugbot for commit 93293a5. Configure here.

Copy link
Copy Markdown

@cursor cursor Bot left a comment

Choose a reason for hiding this comment

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

Cursor Bugbot has reviewed your changes and found 1 potential issue.

There are 3 total unresolved issues (including 2 from previous reviews).

Fix All in Cursor

Bugbot Autofix is ON, but it could not run because on-demand usage is turned off. To enable Bugbot Autofix, turn on on-demand usage and set a spend limit in the Cursor dashboard.

Reviewed by Cursor Bugbot for commit 3ec73f2. Configure here.

ruby -e 'require "yaml"; app = ARGV.fetch(0); data = YAML.load_file(".controlplane/controlplane.yml", aliases: true); app_config = data.fetch("apps").fetch(app); workloads = Array(app_config["app_workloads"]); workloads = ["rails"] if workloads.empty?; puts workloads.join(",")' "${{ vars.PRODUCTION_APP_NAME }}"
)"

echo "names=${workloads}" >> "$GITHUB_OUTPUT"
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Ruby used before setup-ruby action runs

Medium Severity

The "Resolve production app workloads" step invokes ruby -e with YAML.load_file(..., aliases: true) before the "Setup production environment" step installs Ruby 3.4.6 via ruby/setup-ruby. This relies on the runner's system Ruby (currently 3.2.3 on ubuntu-24.04), which happens to support aliases: true, but the workflow explicitly configures a different Ruby version. If the runner image changes or the system Ruby is removed, this step will fail.

Additional Locations (1)
Fix in Cursor Fix in Web

Reviewed by Cursor Bugbot for commit 3ec73f2. Configure here.

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