Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Github Actions Promote #625

Closed
wants to merge 11 commits into from
Closed
Show file tree
Hide file tree
Changes from 3 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 10 additions & 10 deletions .github/workflows/help-command.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,16 +18,16 @@ jobs:
help:
if: ${{ (github.event.issue.pull_request && github.event.comment.body == '/help') || github.event_name == 'workflow_dispatch' }}
runs-on: ubuntu-latest

steps:
- name: Show Available Commands
uses: actions/github-script@v7
with:
script: |
const sections = {
commands: {
deploy: {
title: '## `/deploy`',
"deploy-review-app": {
title: '## `/deploy-review-app`',
purpose: '**Purpose:** Deploy a review app for your pull request',
details: [
'**What it does:**',
Expand All @@ -42,8 +42,8 @@ jobs:
' - Example: `/deploy timeout=1800`'
]
},
destroy: {
title: '## `/destroy`',
"delete-review-app: {
Copy link

Choose a reason for hiding this comment

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

⚠️ Potential issue

Fix YAML syntax error in command definition.

There's a missing closing quote in the command key name.

-                "delete-review-app: {
+                "delete-review-app": {
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
"delete-review-app: {
"delete-review-app": {

title: '## `/delete-review-app`',
purpose: '**Purpose:** Remove the review app for your pull request',
details: [
'**What it does:**',
Expand Down Expand Up @@ -96,17 +96,18 @@ jobs:
details: [
'Review apps are automatically destroyed when:',
'1. The pull request is closed',
'2. The `/destroy` command is used',
'2. The `/delete-review-app` command is used',
'3. A new deployment is requested (old one is cleaned up first)'
]
},
help: {
title: '## Need Help?',
details: [
'For additional assistance:',
'1. Check the [Control Plane documentation](https://docs.controlplane.com/)',
'For additional assistance, ',
'1. Check the [Control Plane Flow documentation](https://www.shakacode.com/control-plane-flow/docs/)',
'2. Contact the infrastructure team',
'3. Open an issue in this repository'
'3. [Open an issue in this repository](https://github.com/shakacode/control-plane-flow/issues/new)',
'4. [Contact ShakaCode support](mailto:[email protected])'
]
}
};
Expand Down Expand Up @@ -148,4 +149,3 @@ jobs:
issue_number: prNumber,
body: helpText
});

21 changes: 14 additions & 7 deletions .github/workflows/promote-staging-to-production.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,28 +9,35 @@ on:
type: string

jobs:
debug:
uses: ./.github/workflows/debug-workflow.yml
with:
debug_enabled: false

promote-to-production:
runs-on: ubuntu-latest
if: github.event.inputs.confirm_promotion == 'promote'

env:
APP_NAME: react-webpack-rails-tutorial
CPLN_ORG: ${{ secrets.CPLN_ORG }}
UPSTREAM_TOKEN: ${{ secrets.STAGING_TOKEN }}
APP_NAME: ${{ vars.PRODUCTION_APP_NAME }}
CPLN_ORG: ${{ vars.CPLN_ORG_PRODUCTION }}
CPLN_TOKEN: ${{ secrets.CPLN_TOKEN_PRODUCTION }}
Copy link

Choose a reason for hiding this comment

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

⚠️ Potential issue

Resolve CPLN_TOKEN inconsistency.

There are two different CPLN_TOKEN references:

  • Line 19: CPLN_TOKEN: ${{ secrets.CPLN_TOKEN_PRODUCTION }}
  • Line 29: CPLN_TOKEN: ${{ secrets.CPLN_TOKEN }}

This could lead to confusion or errors.

Update line 29 to use the production token:

        uses: ./.github/actions/setup-environment
        env:
-         CPLN_TOKEN: ${{ secrets.CPLN_TOKEN }}
+         CPLN_TOKEN: ${{ secrets.CPLN_TOKEN_PRODUCTION }}

Also applies to: 29-29

UPSTREAM_TOKEN: ${{ secrets.CPLN_TOKEN_STAGING }}

steps:
- name: Checkout code
uses: actions/checkout@v4

- name: Setup Environment
uses: ./.github/actions/setup-environment
env:
CPLN_TOKEN: ${{ secrets.CPLN_TOKEN }}

with:
token: ${{ secrets.CPLN_TOKEN_PRODUCTION }}
org: ${{ vars.CPLN_ORG_PRODUCTION }}

- name: Promote Staging to Production
id: promote
run: |
echo "🚀 Starting promotion from staging to production..."
echo "🚀 Starting promotion from staging to production... for app ${APP_NAME}"

if ! cpflow promote-app-from-upstream -a "${APP_NAME}" -t "${UPSTREAM_TOKEN}" --org "${CPLN_ORG}"; then
echo "❌ Failed to promote staging to production"
Expand Down
Loading