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

Open
wants to merge 11 commits into
base: master
Choose a base branch
from
Open

Github Actions Promote #625

wants to merge 11 commits into from

Conversation

justin808
Copy link
Member

@justin808 justin808 commented Jan 29, 2025

This change is Reviewable

Summary by CodeRabbit

  • Chores
    • Updated GitHub Actions workflow configuration for promoting staging to production.
    • Enhanced clarity and structure in the workflow with the addition of a debug job.
    • Updated command names in the help command workflow for better usability.
    • Improved documentation and support resources in the help command workflow.
    • Clarified organization settings for the production environment in the configuration file.
    • Enhanced validation process for required secrets and variables in GitHub Actions.
    • Improved feedback messages in workflows for deleting review apps.
    • Simplified event handling and deployment logic in the review app deployment workflow.
    • Added comments regarding commission rates in the app configuration template.

Copy link

coderabbitai bot commented Jan 29, 2025

Walkthrough

The pull request modifies the GitHub Actions workflows for promoting staging to production and updating help commands. A new job named debug is added to the promotion workflow, and several environment variables are updated to reference production-specific values. The help command workflow sees command names changed for clarity, along with enhancements to the documentation. Additionally, the control plane configuration is updated to reflect changes in organization settings for production. These changes aim to improve the structure and usability of the workflows.

Changes

File Change Summary
.github/workflows/promote-staging-to-production.yml - Added debug job
- Updated APP_NAME to ${{ vars.PRODUCTION_APP_NAME }}
- Changed CPLN_ORG to ${{ vars.CPLN_ORG_PRODUCTION }}
- Modified UPSTREAM_TOKEN to ${{ secrets.CPLN_TOKEN_STAGING }}
- Added new CPLN_TOKEN with ${{ secrets.CPLN_TOKEN_PRODUCTION }}
- Updated Setup Environment step to use with syntax
- Enhanced echo command and promotion command with additional flags
.github/workflows/help-command.yml - Renamed command /deploy to /deploy-review-app
- Renamed command /destroy to /delete-review-app
- Updated help text for new command names and added links to documentation
.controlplane/controlplane.yml - Updated cpln_org to shakacode-open-source-examples-production
- Expanded comments for clarity regarding production organization
- Set allow_org_override_by_env and allow_app_override_by_env to false
.github/actions/validate-required-vars/action.yml - Updated references for secrets and variables to GitHub Actions syntax
- Added checks for CPLN_ORG_PRODUCTION, PRODUCTION_APP_NAME, and STAGING_APP_NAME
- Enhanced output message for missing secrets and variables
.github/workflows/delete-review-app.yml - Added inputs for production-related validation
- Changed comment body to include PR status
- Added Debug Environment step for additional context
.github/workflows/deploy-to-control-plane-review-app.yml - Added inputs for production-related validation
- Updated comment ID reference in deployment status

Possibly related PRs

  • Fix/no commit hash on the deployed project #611: The changes in this PR involve updates to the Dockerfile that may relate to environment variables used in deployment processes, similar to the changes in the main PR regarding environment variable management.
  • Improvements to deployments #615: This PR introduces new environment variables related to deployment, which aligns with the main PR's updates to environment variables in the workflow for promoting staging to production.
  • Github Actions separate to two jobs and staging #624: The modifications in this PR include changes to the deployment workflow structure and environment variables, which relate to the enhancements made in the main PR regarding the promotion of staging to production and the handling of environment variables.

Poem

🐇 In the garden of code where bunnies play,
We promote our staging without delay!
With tokens and secrets, we leap with glee,
To production's bright land, come hop with me!
Commands now clearer, our paths align,
In the world of workflows, everything's fine! 🌼


Thank you for using CodeRabbit. We offer it for free to the OSS community and would appreciate your support in helping us grow. If you find it useful, would you consider giving us a shout-out on your favorite social media?

❤️ Share
🪧 Tips

Chat

There are 3 ways to chat with CodeRabbit:

  • Review comments: Directly reply to a review comment made by CodeRabbit. Example:
    • I pushed a fix in commit <commit_id>, please review it.
    • Generate unit testing code for this file.
    • Open a follow-up GitHub issue for this discussion.
  • Files and specific lines of code (under the "Files changed" tab): Tag @coderabbitai in a new review comment at the desired location with your query. Examples:
    • @coderabbitai generate unit testing code for this file.
    • @coderabbitai modularize this function.
  • PR comments: Tag @coderabbitai in a new PR comment to ask questions about the PR branch. For the best results, please provide a very specific query, as very limited context is provided in this mode. Examples:
    • @coderabbitai gather interesting stats about this repository and render them as a table. Additionally, render a pie chart showing the language distribution in the codebase.
    • @coderabbitai read src/utils.ts and generate unit testing code.
    • @coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.
    • @coderabbitai help me debug CodeRabbit configuration file.

Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments.

CodeRabbit Commands (Invoked using PR comments)

  • @coderabbitai pause to pause the reviews on a PR.
  • @coderabbitai resume to resume the paused reviews.
  • @coderabbitai review to trigger an incremental review. This is useful when automatic reviews are disabled for the repository.
  • @coderabbitai full review to do a full review from scratch and review all the files again.
  • @coderabbitai summary to regenerate the summary of the PR.
  • @coderabbitai generate docstrings to generate docstrings for this PR. (Beta)
  • @coderabbitai resolve resolve all the CodeRabbit review comments.
  • @coderabbitai configuration to show the current CodeRabbit configuration for the repository.
  • @coderabbitai help to get help.

Other keywords and placeholders

  • Add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.
  • Add @coderabbitai summary to generate the high-level summary at a specific location in the PR description.
  • Add @coderabbitai anywhere in the PR title to generate the title automatically.

CodeRabbit Configuration File (.coderabbit.yaml)

  • You can programmatically configure CodeRabbit by adding a .coderabbit.yaml file to the root of your repository.
  • Please see the configuration documentation for more information.
  • If your editor has YAML language server enabled, you can add the path at the top of this file to enable auto-completion and validation: # yaml-language-server: $schema=https://coderabbit.ai/integrations/schema.v2.json

Documentation and Community

  • Visit our Documentation for detailed information on how to use CodeRabbit.
  • Join our Discord Community to get help, request features, and share feedback.
  • Follow us on X/Twitter for updates and announcements.

Copy link

Hi 👋 Here are the commands available for this PR:

  • /deploy-review-app: Deploy your changes to a review environment
  • /delete-review-app: Clean up the review environment when you're done
  • /help: Show detailed information about all commands

Use /help to see full documentation, including configuration options.

Copy link

🚀 Quick Review App Commands

Welcome! Here are the commands you can use in this PR:

/deploy-review-app

Deploy your PR branch for testing

/delete-review-app

Remove the review app when done

/help

Show detailed instructions, environment setup, and configuration options.


@justin808
Copy link
Member Author

/help

Copy link

Available Commands

/deploy

Purpose: Deploy a review app for your pull request

What it does:

  • Creates a new review app in Control Plane
  • Deploys your changes to the review environment
  • Provides a unique URL to preview your changes
  • Shows build and deployment progress in real-time

Optional Configuration:

  • WAIT_TIMEOUT: Deployment timeout in seconds (default: 900)
    • Must be a positive integer
    • Example: /deploy timeout=1800

/destroy

Purpose: Remove the review app for your pull request

What it does:

  • Deletes the review app from Control Plane
  • Cleans up associated resources
  • Updates PR with deletion status

Environment Setup

Required Environment Secrets:

  • CPLN_TOKEN_STAGING: Control Plane authentication token
  • CPLN_TOKEN_PRODUCTION: Control Plane authentication token

Required GitHub Actions Variables:

  • CPLN_ORG_STAGING: Control Plane authentication token
  • CPLN_ORG_PRODUCTION: Control Plane authentication token

Required GitHub Actions Variables (these need to match your control_plane.yml file:

  • PRODUCTION_APP_NAME: Control Plane production app name
  • STAGING_APP_NAME: Control Plane staging app name
  • REVIEW_APP_PREFIX: Control Plane review app prefix

Optional: Configure WAIT_TIMEOUT in GitHub Actions variables to customize deployment timeout

Control Plane Integration

  1. Review app naming convention:
    qa-react-webpack-rails-tutorial-<pr-number>
    
  2. Console URL: https://console.cpln.io/console/org/{CPLN_ORG}/gvc/{APP_NAME}/-info

Automatic Cleanup

Review apps are automatically destroyed when:

  1. The pull request is closed
  2. The /destroy command is used
  3. A new deployment is requested (old one is cleaned up first)

Need Help?

For additional assistance:

  1. Check the Control Plane documentation
  2. Contact the infrastructure team
  3. Open an issue in this repository

Copy link

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 1

🧹 Nitpick comments (1)
.github/workflows/promote-staging-to-production.yml (1)

Line range hint 44-55: Add error handling to release creation step.

While the promotion step has proper error handling, the release creation step could benefit from similar error handling to ensure failures are clearly reported.

Consider updating the release creation step:

      - name: Create GitHub Release
        if: success()
        env:
          GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
        run: |
          # Get the current date in YYYY-MM-DD format
          RELEASE_DATE=$(date '+%Y-%m-%d')
          
          # Create a release tag
          RELEASE_TAG="production-${RELEASE_DATE}"
          
          # Create GitHub release
+         if ! \
          gh release create "${RELEASE_TAG}" \
            --title "Production Release ${RELEASE_DATE}" \
-            --notes "🚀 Production deployment on ${RELEASE_DATE}"
+            --notes "🚀 Production deployment on ${RELEASE_DATE}"; then
+           echo "❌ Failed to create GitHub release"
+           exit 1
+         fi
+         
+         echo "✅ Successfully created GitHub release ${RELEASE_TAG}"
🧰 Tools
🪛 YAMLlint (1.35.1)

[error] 15-15: trailing spaces

(trailing-spaces)


[error] 21-21: trailing spaces

(trailing-spaces)

📜 Review details

Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 586dac3 and 662be14.

📒 Files selected for processing (1)
  • .github/workflows/promote-staging-to-production.yml (2 hunks)
⏰ Context from checks skipped due to timeout of 90000ms (1)
  • GitHub Check: test (22.x, 3.3.4)
🔇 Additional comments (2)
.github/workflows/promote-staging-to-production.yml (2)

17-20: LGTM! Environment variables now use production-specific secrets.

The changes improve security and maintainability by:

  • Using environment-specific organization secrets
  • Making the app name configurable via variables
  • Using clearly named production tokens

34-34: LGTM! Improved logging with app name.

The echo message now clearly identifies which app is being promoted, improving observability.

UPSTREAM_TOKEN: ${{ secrets.STAGING_TOKEN }}
APP_NAME: ${{ vars.PRODUCTION_APP_NAME }}
CPLN_ORG: ${{ secrets.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

Copy link

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 1

📜 Review details

Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 662be14 and 1ef522b.

📒 Files selected for processing (2)
  • .github/workflows/help-command.yml (3 hunks)
  • .github/workflows/promote-staging-to-production.yml (1 hunks)
🧰 Additional context used
🪛 YAMLlint (1.35.1)
.github/workflows/promote-staging-to-production.yml

[error] 20-20: trailing spaces

(trailing-spaces)


[error] 26-26: trailing spaces

(trailing-spaces)


[error] 30-30: trailing spaces

(trailing-spaces)

⏰ Context from checks skipped due to timeout of 90000ms (1)
  • GitHub Check: test (22.x, 3.3.4)
🔇 Additional comments (7)
.github/workflows/promote-staging-to-production.yml (4)

22-25: LGTM! Good security practices in environment configuration.

  • Using separate tokens for staging and production environments
  • Moving non-sensitive values to variables instead of secrets
  • Clear naming convention with _PRODUCTION suffix

33-35: LGTM! Improved action configuration syntax.

The change from env to with syntax is more explicit and better aligns with GitHub Actions best practices.


40-40: LGTM! Enhanced logging with app name.

Adding the app name to the log message improves observability.


12-16: Verify the external debug workflow file exists.

The workflow references ./.github/workflows/debug-workflow.yml. Please ensure this file exists and is properly configured.

✅ Verification successful

External debug workflow exists and is properly configured

🏁 Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Check if the debug workflow file exists
if [ -f .github/workflows/debug-workflow.yml ]; then
    echo "Debug workflow file exists"
    cat .github/workflows/debug-workflow.yml
else
    echo "Debug workflow file not found"
fi

Length of output: 1155

.github/workflows/help-command.yml (3)

Line range hint 29-44: LGTM! Improved command naming and documentation.

The rename from /deploy to /deploy-review-app makes the command's purpose clearer. Documentation is comprehensive and well-structured.


99-99: LGTM! Documentation consistently uses new command name.

The cleanup section correctly references the renamed /delete-review-app command.


106-110: LGTM! Enhanced help resources and support options.

Good improvements to the help section:

  • Added Control Plane Flow documentation link
  • Included ShakaCode support contact
  • Clear formatting of help options

@@ -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": {

Copy link

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 0

🧹 Nitpick comments (1)
.controlplane/controlplane.yml (1)

48-49: LGTM! Good security practice using a dedicated production organization.

The explicit "-production" suffix in the organization name and the clear comment about production-only usage enhance security by:

  • Clearly distinguishing production resources
  • Reducing the risk of accidentally targeting production
  • Following the principle of separation of concerns

This change, combined with the existing security controls (allow_org_override_by_env: false), provides robust protection for production deployments.

Consider documenting these security controls in your team's deployment runbook to ensure all team members understand the significance of the separate production organization.

📜 Review details

Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 1ef522b and 84359ef.

📒 Files selected for processing (1)
  • .controlplane/controlplane.yml (1 hunks)
⏰ Context from checks skipped due to timeout of 90000ms (1)
  • GitHub Check: test (22.x, 3.3.4)
🔇 Additional comments (1)
.controlplane/controlplane.yml (1)

48-49: Verify alignment with GitHub Actions workflows.

Since this change is part of a larger update involving GitHub Actions workflows, ensure that all workflow files correctly reference the new production organization name.

Run this script to verify the organization references in GitHub Actions workflows:

✅ Verification successful

✅ Organization configuration is correctly implemented

The workflows properly use GitHub Variables (CPLN_ORG_PRODUCTION and CPLN_ORG_STAGING) instead of hardcoded values, allowing for flexible organization management across environments. The Control Plane configuration aligns with this approach by setting the production organization value.

🏁 Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Description: Check for references to the Control Plane organization in GitHub Actions workflows
# and verify they align with the new production organization name

echo "Checking organization references in GitHub Actions workflows..."
rg -l "CPLN_ORG|shakacode-open-source-examples" .github/workflows/

echo -e "\nChecking specific organization value usage..."
rg "shakacode-open-source-examples" .github/workflows/ -A 2 -B 2

Length of output: 670


Script:

#!/bin/bash
# Check for CPLN_ORG environment variable usage and organization references in workflows
echo "Checking CPLN_ORG usage in workflows..."
rg "CPLN_ORG" .github/workflows/ -A 2 -B 2

echo -e "\nChecking production organization references..."
rg "shakacode-open-source-examples-production" .github/workflows/ -A 2 -B 2

echo -e "\nChecking staging organization references..."
rg "shakacode-open-source-examples-staging" .github/workflows/ -A 2 -B 2

Length of output: 12262

@justin808
Copy link
Member Author

/help

Copy link

Available Commands

/deploy

Purpose: Deploy a review app for your pull request

What it does:

  • Creates a new review app in Control Plane
  • Deploys your changes to the review environment
  • Provides a unique URL to preview your changes
  • Shows build and deployment progress in real-time

Optional Configuration:

  • WAIT_TIMEOUT: Deployment timeout in seconds (default: 900)
    • Must be a positive integer
    • Example: /deploy timeout=1800

/destroy

Purpose: Remove the review app for your pull request

What it does:

  • Deletes the review app from Control Plane
  • Cleans up associated resources
  • Updates PR with deletion status

Environment Setup

Required Environment Secrets:

  • CPLN_TOKEN_STAGING: Control Plane authentication token
  • CPLN_TOKEN_PRODUCTION: Control Plane authentication token

Required GitHub Actions Variables:

  • CPLN_ORG_STAGING: Control Plane authentication token
  • CPLN_ORG_PRODUCTION: Control Plane authentication token

Required GitHub Actions Variables (these need to match your control_plane.yml file:

  • PRODUCTION_APP_NAME: Control Plane production app name
  • STAGING_APP_NAME: Control Plane staging app name
  • REVIEW_APP_PREFIX: Control Plane review app prefix

Optional: Configure WAIT_TIMEOUT in GitHub Actions variables to customize deployment timeout

Control Plane Integration

  1. Review app naming convention:
    qa-react-webpack-rails-tutorial-<pr-number>
    
  2. Console URL: https://console.cpln.io/console/org/{CPLN_ORG}/gvc/{APP_NAME}/-info

Automatic Cleanup

Review apps are automatically destroyed when:

  1. The pull request is closed
  2. The /destroy command is used
  3. A new deployment is requested (old one is cleaned up first)

Need Help?

For additional assistance:

  1. Check the Control Plane documentation
  2. Contact the infrastructure team
  3. Open an issue in this repository

@justin808
Copy link
Member Author

/deploy-review-app

Copy link

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 0

🧹 Nitpick comments (1)
.github/workflows/promote-staging-to-production.yml (1)

42-42: Fix command line formatting.

The command line contains multiple consecutive spaces before --verbose. This might cause readability issues in logs.

-          if ! cpflow promote-app-from-upstream -a "${APP_NAME}" -t "${UPSTREAM_TOKEN}" --org "${CPLN_ORG}"  --verbose --trace   ; then
+          if ! cpflow promote-app-from-upstream -a "${APP_NAME}" -t "${UPSTREAM_TOKEN}" --org "${CPLN_ORG}" --verbose --trace; then
📜 Review details

Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 84359ef and ec947bf.

📒 Files selected for processing (3)
  • .controlplane/controlplane.yml (1 hunks)
  • .github/actions/validate-required-vars/action.yml (1 hunks)
  • .github/workflows/promote-staging-to-production.yml (1 hunks)
🚧 Files skipped from review as they are similar to previous changes (1)
  • .controlplane/controlplane.yml
🧰 Additional context used
🪛 YAMLlint (1.35.1)
.github/actions/validate-required-vars/action.yml

[error] 20-20: trailing spaces

(trailing-spaces)


[error] 41-41: trailing spaces

(trailing-spaces)

.github/workflows/promote-staging-to-production.yml

[error] 41-41: trailing spaces

(trailing-spaces)


[error] 46-46: trailing spaces

(trailing-spaces)

🪛 GitHub Actions: Deploy PR Review App - PR
.github/actions/validate-required-vars/action.yml

[error] 9-9: Unrecognized named-value: 'secrets'. Located at position 1 within expression: secrets.CPLN_TOKEN_STAGING

⏰ Context from checks skipped due to timeout of 90000ms (1)
  • GitHub Check: test (22.x, 3.3.4)
🔇 Additional comments (6)
.github/actions/validate-required-vars/action.yml (3)

22-40: LGTM! Comprehensive validation of required variables.

The implementation properly validates all necessary variables with clear separation between staging and production environments.


43-45: LGTM! Improved error message formatting.

The change to use formatted list output makes missing variables easier to identify.


13-19: Verify GitHub Actions runner version compatibility.

The pipeline failure suggests a syntax issue with secrets context, but the syntax is correct for current GitHub Actions. This might indicate an outdated runner version.

Please check your GitHub Actions runner version and ensure it supports the current secrets context syntax. Consider adding this step before the validation:

- name: Check GitHub Actions Runner Version
  shell: bash
  run: |
    echo "GitHub Actions Runner Version: ${{ runner.os }}-${{ runner.arch }} (${{ runner.name }})"
.github/workflows/promote-staging-to-production.yml (3)

12-16: LGTM! Well-structured debug configuration.

Good addition of debug capability with safe defaults (disabled).


22-26: LGTM! Improved security and environment configuration.

Good separation of concerns:

  • Non-sensitive data moved to vars
  • Clear distinction between staging and production tokens
  • Proper use of secrets for sensitive data

33-36: LGTM! Improved parameter passing.

Good change to use explicit with syntax for parameter passing, maintaining consistency with production context.

Copy link

github-actions bot commented Jan 29, 2025

🏗️ Building Docker image for PR #625, commit b1d0b14

📝 View Build Logs

@github-actions github-actions bot requested a deployment to review-app January 29, 2025 08:24 In progress
Copy link

github-actions bot commented Jan 29, 2025

🏗️ Building Docker image for PR #625, commit b1d0b14

📝 View Build Logs

@github-actions github-actions bot requested a deployment to review-app January 29, 2025 08:24 In progress
Copy link

github-actions bot commented Jan 29, 2025

🚀 Deploying to Control Plane...

⏳ Waiting for deployment to be ready...

📝 View Deploy Logs

@github-actions github-actions bot requested a deployment to review-app January 29, 2025 08:35 In progress
Copy link

github-actions bot commented Jan 29, 2025

🏗️ Building Docker image for PR #625, commit a2f8923

📝 View Build Logs

@github-actions github-actions bot requested a deployment to review-app January 29, 2025 08:35 In progress
Copy link

🏗️ Building Docker image for PR #625, commit 1ca2e06

📝 View Build Logs

@github-actions github-actions bot requested a deployment to review-app January 29, 2025 08:40 In progress
Copy link

🏗️ Building Docker image for PR #625, commit 66701a4

📝 View Build Logs

@github-actions github-actions bot requested a deployment to review-app January 29, 2025 08:40 In progress
Copy link

🏗️ Building Docker image for PR #625, commit 3ddf8a5

📝 View Build Logs

@github-actions github-actions bot requested a deployment to review-app January 29, 2025 08:44 In progress
Copy link

github-actions bot commented Jan 29, 2025

🚀 Deploying to Control Plane...

⏳ Waiting for deployment to be ready...

📝 View Deploy Logs

@github-actions github-actions bot requested a deployment to review-app January 29, 2025 08:44 In progress
Copy link

🏗️ Building Docker image for PR #625, commit 7d6eeb7

🚀 Deploying to Control Plane...

⏳ Waiting for deployment to be ready...

📝 View Build and Deploy Logs

@github-actions github-actions bot requested a deployment to review-app January 29, 2025 09:01 In progress
Copy link

🏗️ Building Docker image for PR #625, commit 938e5ca

🚀 Deploying to Control Plane...

⏳ Waiting for deployment to be ready...

📝 View Build and Deploy Logs

@github-actions github-actions bot requested a deployment to review-app January 29, 2025 09:01 In progress
Copy link

🏗️ Building Docker image for PR #625, commit e7595a6

🚀 Deploying to Control Plane...

⏳ Waiting for deployment to be ready...

📝 View Build and Deploy Logs

@github-actions github-actions bot requested a deployment to review-app January 29, 2025 09:21 In progress
Copy link

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 1

🧹 Nitpick comments (2)
.github/workflows/deploy-to-control-plane-review-app.yml (2)

176-179: Improve error handling in event validation

The validation step should set DO_DEPLOY=false instead of exiting with an error when encountering unsupported event types. This would align better with the workflow's error handling pattern and prevent job failures.

  # Validate supported event types
  if ! [[ "${{ github.event_name }}" == "workflow_dispatch" || \
         "${{ github.event_name }}" == "issue_comment" || \
         "${{ github.event_name }}" == "pull_request" ]]; then
-   echo "Error: Unsupported event type ${{ github.event_name }}"
-   exit 1
+   echo "Warning: Unsupported event type ${{ github.event_name }}"
+   echo "DO_DEPLOY=false" >> $GITHUB_ENV
+   exit 0
  fi

408-410: Simplify deployment log links

The success and failure messages include redundant log links that point to similar information. This could confuse users about which link to follow.

Simplify by keeping only the most specific log link:

  // In success message
- '📝 [View Build and Deploy Logs](' + workflowUrl + ')',
- '',
  `📋 [View Completed Build and Deploy Logs](${process.env.GITHUB_SERVER_URL}/${context.repo.owner}/${context.repo.repo}/actions/runs/${context.runId}/jobs/${context.job.id})`

  // In failure message
- '📝 [View Build and Deploy Logs](' + workflowUrl + ')',
- '',
  `📋 [View Build and Deploy Logs with Errors](${process.env.GITHUB_SERVER_URL}/${context.repo.owner}/${context.repo.repo}/actions/runs/${context.runId}/jobs/${context.job.id})`

Also applies to: 418-420

📜 Review details

Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between a2f8923 and 2305861.

📒 Files selected for processing (1)
  • .github/workflows/deploy-to-control-plane-review-app.yml (7 hunks)
🧰 Additional context used
🪛 YAMLlint (1.35.1)
.github/workflows/deploy-to-control-plane-review-app.yml

[error] 342-342: trailing spaces

(trailing-spaces)


[error] 412-412: trailing spaces

(trailing-spaces)


[error] 422-422: trailing spaces

(trailing-spaces)

⏰ Context from checks skipped due to timeout of 90000ms (2)
  • GitHub Check: build
  • GitHub Check: test (22.x, 3.3.4)
🔇 Additional comments (2)
.github/workflows/deploy-to-control-plane-review-app.yml (2)

202-212: Verify console link availability in initial comment

The initial comment template uses process.env.CONSOLE_LINK which might be undefined at this stage if the app hasn't been created yet. This could result in "undefined" appearing in the comment.

Add a conditional check:

  body: [
    `🏗️ Building Docker image for PR [#${process.env.PR_NUMBER}](${process.env.GITHUB_SERVER_URL}/${context.repo.owner}/${context.repo.repo}/pull/${process.env.PR_NUMBER}), commit [${context.sha.substring(0, 7)}](${process.env.GITHUB_SERVER_URL}/${context.repo.owner}/${context.repo.repo}/commit/${context.sha})`,
    '',
    '🚀 Deploying to Control Plane...',
    '',
    '⏳ Waiting for deployment to be ready...',
    '',
    `📝 [View Build and Deploy Logs](${process.env.GITHUB_SERVER_URL}/${context.repo.owner}/${context.repo.repo}/actions/runs/${context.runId}/job/${context.job})`,
    '',
-   process.env.CONSOLE_LINK
+   process.env.CONSOLE_LINK ? process.env.CONSOLE_LINK : ''
  ].join('\n')

326-334: ⚠️ Potential issue

Fix inconsistent deployment ID reference

The deployment status update uses needs.process-deployment.outputs.deployment_id, but the final status update uses steps.init-deployment.outputs.result. This inconsistency could cause the final status update to fail.

Standardize the deployment ID reference:

  await github.rest.repos.createDeploymentStatus({
    owner: context.repo.owner,
    repo: context.repo.repo,
-   deployment_id: ${{ needs.process-deployment.outputs.deployment_id }},
+   deployment_id: ${{ needs.process-deployment.outputs.deployment_id }},
    state: 'in_progress',
    description: 'Deployment in progress',
    log_url: process.env.BUILD_LOGS_URL
  });

Likely invalid or redundant comment.

Comment on lines +69 to +76
with:
CPLN_TOKEN_STAGING: ${{ secrets.CPLN_TOKEN_STAGING }}
CPLN_TOKEN_PRODUCTION: ${{ secrets.CPLN_TOKEN_PRODUCTION }}
CPLN_ORG_STAGING: ${{ vars.CPLN_ORG_STAGING }}
CPLN_ORG_PRODUCTION: ${{ vars.CPLN_ORG_PRODUCTION }}
REVIEW_APP_PREFIX: ${{ vars.REVIEW_APP_PREFIX }}
PRODUCTION_APP_NAME: ${{ vars.PRODUCTION_APP_NAME }}
STAGING_APP_NAME: ${{ vars.STAGING_APP_NAME }}
Copy link

Choose a reason for hiding this comment

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

⚠️ Potential issue

Security: Remove unnecessary production credentials validation

The validation step includes production-related variables (CPLN_TOKEN_PRODUCTION, CPLN_ORG_PRODUCTION) which are not used in this review app deployment workflow. Including production credentials unnecessarily increases the security attack surface.

Remove the production-related validations:

  with:
    CPLN_TOKEN_STAGING: ${{ secrets.CPLN_TOKEN_STAGING }}
-   CPLN_TOKEN_PRODUCTION: ${{ secrets.CPLN_TOKEN_PRODUCTION }}
    CPLN_ORG_STAGING: ${{ vars.CPLN_ORG_STAGING }}
-   CPLN_ORG_PRODUCTION: ${{ vars.CPLN_ORG_PRODUCTION }}
    REVIEW_APP_PREFIX: ${{ vars.REVIEW_APP_PREFIX }}
-   PRODUCTION_APP_NAME: ${{ vars.PRODUCTION_APP_NAME }}
    STAGING_APP_NAME: ${{ vars.STAGING_APP_NAME }}
📝 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
with:
CPLN_TOKEN_STAGING: ${{ secrets.CPLN_TOKEN_STAGING }}
CPLN_TOKEN_PRODUCTION: ${{ secrets.CPLN_TOKEN_PRODUCTION }}
CPLN_ORG_STAGING: ${{ vars.CPLN_ORG_STAGING }}
CPLN_ORG_PRODUCTION: ${{ vars.CPLN_ORG_PRODUCTION }}
REVIEW_APP_PREFIX: ${{ vars.REVIEW_APP_PREFIX }}
PRODUCTION_APP_NAME: ${{ vars.PRODUCTION_APP_NAME }}
STAGING_APP_NAME: ${{ vars.STAGING_APP_NAME }}
with:
CPLN_TOKEN_STAGING: ${{ secrets.CPLN_TOKEN_STAGING }}
CPLN_ORG_STAGING: ${{ vars.CPLN_ORG_STAGING }}
REVIEW_APP_PREFIX: ${{ vars.REVIEW_APP_PREFIX }}
STAGING_APP_NAME: ${{ vars.STAGING_APP_NAME }}

Copy link

🏗️ Building Docker image for PR #625, commit 7a6ec87

🚀 Deploying to Control Plane...

⏳ Waiting for deployment to be ready...

📝 View Build and Deploy Logs

@github-actions github-actions bot requested a deployment to review-app January 29, 2025 09:26 In progress
Copy link

🏗️ Building Docker image for PR #625, commit 2f7732d

🚀 Deploying to Control Plane...

⏳ Waiting for deployment to be ready...

📝 View Build and Deploy Logs

@github-actions github-actions bot requested a deployment to review-app January 31, 2025 07:33 In progress
Copy link

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 1

♻️ Duplicate comments (1)
.github/workflows/deploy-to-control-plane-review-app.yml (1)

69-76: ⚠️ Potential issue

Security: Remove unnecessary production credentials validation

The validation step includes production-related variables (CPLN_TOKEN_PRODUCTION, CPLN_ORG_PRODUCTION, PRODUCTION_APP_NAME) which are not used in this review app deployment workflow. Including production credentials unnecessarily increases the security attack surface.

Apply this diff to remove the production-related validations:

  with:
    CPLN_TOKEN_STAGING: ${{ secrets.CPLN_TOKEN_STAGING }}
-   CPLN_TOKEN_PRODUCTION: ${{ secrets.CPLN_TOKEN_PRODUCTION }}
    CPLN_ORG_STAGING: ${{ vars.CPLN_ORG_STAGING }}
-   CPLN_ORG_PRODUCTION: ${{ vars.CPLN_ORG_PRODUCTION }}
    REVIEW_APP_PREFIX: ${{ vars.REVIEW_APP_PREFIX }}
-   PRODUCTION_APP_NAME: ${{ vars.PRODUCTION_APP_NAME }}
    STAGING_APP_NAME: ${{ vars.STAGING_APP_NAME }}
🧹 Nitpick comments (1)
.github/workflows/deploy-to-control-plane-review-app.yml (1)

326-362: Enhance deployment status updates with error handling

The deployment status update lacks error handling for the GitHub API calls. Consider wrapping the API calls in try-catch blocks to handle potential failures gracefully.

Apply this diff to add error handling:

+ try {
    // Create deployment status for deploying state
    await github.rest.repos.createDeploymentStatus({
      owner: context.repo.owner,
      repo: context.repo.repo,
      deployment_id: ${{ needs.process-deployment.outputs.deployment_id }},
      state: 'in_progress',
      description: 'Deployment in progress',
      log_url: process.env.BUILD_LOGS_URL
    });

    // Get the current job URL and ID
    const { data: jobs } = await github.rest.actions.listJobsForWorkflowRun({
      owner: context.repo.owner,
      repo: context.repo.repo,
      run_id: context.runId
    });
    
    const currentJob = jobs.jobs.find(job => job.name === context.job);
    const currentJobUrl = `${process.env.GITHUB_SERVER_URL}/${context.repo.owner}/${context.repo.repo}/actions/runs/${context.runId}/job/${currentJob.id}`;

    // Update the PR comment with correct job URLs
    await github.rest.issues.updateComment({
      owner: context.repo.owner,
      repo: context.repo.repo,
      comment_id: ${{ needs.build.outputs.comment_id }},
      body: [
        // ... comment body ...
      ].join('\n')
    });
+ } catch (error) {
+   core.warning(`Failed to update deployment status: ${error.message}`);
+ }
🧰 Tools
🪛 YAMLlint (1.35.1)

[error] 342-342: trailing spaces

(trailing-spaces)

📜 Review details

Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 2305861 and 544cce4.

📒 Files selected for processing (2)
  • .controlplane/templates/app.yml (1 hunks)
  • .github/workflows/deploy-to-control-plane-review-app.yml (8 hunks)
🧰 Additional context used
🪛 YAMLlint (1.35.1)
.controlplane/templates/app.yml

[error] 31-31: trailing spaces

(trailing-spaces)


[error] 41-41: trailing spaces

(trailing-spaces)


[error] 43-43: trailing spaces

(trailing-spaces)


[error] 32-32: syntax error: expected , but found ''

(syntax)

.github/workflows/deploy-to-control-plane-review-app.yml

[error] 342-342: trailing spaces

(trailing-spaces)


[error] 394-394: trailing spaces

(trailing-spaces)


[error] 397-397: trailing spaces

(trailing-spaces)


[error] 420-420: trailing spaces

(trailing-spaces)


[error] 428-428: trailing spaces

(trailing-spaces)

⏰ Context from checks skipped due to timeout of 90000ms (2)
  • GitHub Check: build
  • GitHub Check: test (22.x, 3.3.4)
🔇 Additional comments (3)
.github/workflows/deploy-to-control-plane-review-app.yml (3)

137-139: LGTM! Robust PR number validation and app name setup.

The code correctly validates the PR number and sets up the app name with proper environment variables.


176-179: LGTM! Event type validation is comprehensive.

The validation correctly checks for supported event types (workflow_dispatch, issue_comment, pull_request).


388-397: LGTM! Deployment status updates with proper log URLs.

The code correctly retrieves and uses job-specific log URLs for deployment status updates and comment updates.

Also applies to: 405-405, 418-418, 426-426, 433-433

🧰 Tools
🪛 YAMLlint (1.35.1)

[error] 394-394: trailing spaces

(trailing-spaces)


[error] 397-397: trailing spaces

(trailing-spaces)

Comment on lines +31 to +44

I stay at 3% and … believe it or not - I recommend that the Buyer’s Agent also gets 3%!

Here’s WHY:

-Buyers are still ’SCARCE’… and ANY Buyer's Agent, that actually has one of these rare things called Beachfront Buyers, is looking to earn a full 3% of the Sales Price.

NOTE: They are all going to put 3% in their Buyer Agency Agreements… just ‘in case’ that 3% 'hoped for' commission is offered.

Therefore - if you lower that commission - the Buyer has to come up with the difference “In Cash” … and, that’s not good for the Buyer who wants to finance 80%, or more, of that commission he’s agreed to pay his Agent.

SO

Why not OFFER that 3% and stick to this Asking Price (or near it)!?
Copy link

Choose a reason for hiding this comment

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

⚠️ Potential issue

Remove misplaced business logic from infrastructure configuration.

The added text about commission rates and buyer's agent recommendations does not belong in an infrastructure configuration file. This type of business logic and documentation should be moved to a more appropriate location, such as:

  • Business documentation in the project's wiki or docs folder
  • Product requirements document
  • Sales/Marketing documentation

Additionally, the added text is causing YAML syntax errors. If you need to add comments to this file, use the YAML comment syntax with #:

-  
-  I stay at 3% and … believe it or not - I recommend that the Buyer's Agent also gets 3%!
-
- Here's WHY:
-
- -Buyers are still 'SCARCE'… and ANY Buyer's Agent, that actually has one of these rare things called Beachfront Buyers, is looking to earn a full 3% of the Sales Price.
-
- NOTE:  They are all going to put 3% in their Buyer Agency Agreements… just 'in case' that 3% 'hoped for' commission is offered.
-
- Therefore - if you lower that commission - the Buyer has to come up with the difference "In Cash" … and, that's not good for the Buyer who wants to finance 80%, or more, of that commission he's agreed to pay his Agent.
- 
- SO
- 
- Why not OFFER that 3% and stick to this Asking Price (or near it)!?

Would you like me to help create a new documentation file in a more appropriate location for this business logic?

🧰 Tools
🪛 YAMLlint (1.35.1)

[error] 31-31: trailing spaces

(trailing-spaces)


[error] 41-41: trailing spaces

(trailing-spaces)


[error] 43-43: trailing spaces

(trailing-spaces)


[error] 32-32: syntax error: expected , but found ''

(syntax)

Copy link

🏗️ Building Docker image for PR #625, commit c4f9e9a

🚀 Deploying to Control Plane...

⏳ Waiting for deployment to be ready...

📝 View Build and Deploy Logs

@github-actions github-actions bot requested a deployment to review-app January 31, 2025 07:50 In progress
Copy link

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 0

🧹 Nitpick comments (2)
.github/workflows/promote-staging-to-production.yml (2)

40-43: Improve command readability using line continuation.

While the added flags and informative echo message are good improvements, the command readability could be enhanced.

Consider using explicit line continuation for better readability:

-          echo "🚀 Starting promotion from staging to production for app ${APP_NAME}"
-         
-          echo "upstream_token is ${UPSTREAM_TOKEN}"
-          if ! cpflow promote-app-from-upstream -a "${APP_NAME}" -t "${UPSTREAM_TOKEN}" --org "${CPLN_ORG}"  --verbose --trace   ; then
+          echo "🚀 Starting promotion from staging to production for app ${APP_NAME}"
+          echo "upstream_token is ${UPSTREAM_TOKEN}"
+          if ! cpflow promote-app-from-upstream \
+            -a "${APP_NAME}" \
+            -t "${UPSTREAM_TOKEN}" \
+            --org "${CPLN_ORG}" \
+            --verbose \
+            --trace; then
🧰 Tools
🪛 YAMLlint (1.35.1)

[error] 41-41: trailing spaces

(trailing-spaces)


41-41: Remove trailing spaces.

Static analysis detected trailing spaces. While this is a minor issue, it's good practice to maintain clean code.

Remove trailing spaces from lines 41 and 47.

Also applies to: 47-47

🧰 Tools
🪛 YAMLlint (1.35.1)

[error] 41-41: trailing spaces

(trailing-spaces)

📜 Review details

Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 544cce4 and fa96ca0.

📒 Files selected for processing (1)
  • .github/workflows/promote-staging-to-production.yml (1 hunks)
🧰 Additional context used
🪛 YAMLlint (1.35.1)
.github/workflows/promote-staging-to-production.yml

[error] 41-41: trailing spaces

(trailing-spaces)


[error] 47-47: trailing spaces

(trailing-spaces)

⏰ Context from checks skipped due to timeout of 90000ms (2)
  • GitHub Check: build
  • GitHub Check: test (22.x, 3.3.4)
🔇 Additional comments (3)
.github/workflows/promote-staging-to-production.yml (3)

12-16: LGTM! Well-structured debug job configuration.

The debug job is properly configured using an external workflow, promoting reusability. The explicit debug_enabled parameter provides good control over debug functionality.


22-25: LGTM! Improved environment variables configuration.

Good improvements in the environment variables setup:

  • Using vars for non-sensitive values like PRODUCTION_APP_NAME and CPLN_ORG_PRODUCTION
  • Using secrets for sensitive values like tokens
  • Consistent use of production-specific values

33-35: LGTM! Improved action configuration using 'with' syntax.

Good change to use the more idiomatic 'with' syntax for action inputs, maintaining consistency with production-specific values.

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