-
Notifications
You must be signed in to change notification settings - Fork 384
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
Revert all recent changes #627
Changes from all commits
40f7244
fb23490
eda7219
fbfa9ee
fcc5caf
7b1b010
28a6761
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
name: Delete Control Plane App | ||
description: 'Deletes a Control Plane application and all its resources' | ||
|
||
inputs: | ||
app_name: | ||
description: 'Name of the application to delete' | ||
required: true | ||
org: | ||
description: 'Organization name' | ||
required: true | ||
|
||
runs: | ||
using: "composite" | ||
steps: | ||
- name: Delete Application | ||
shell: bash | ||
run: ${{ github.action_path }}/../deploy-to-control-plane/scripts/delete-app.sh | ||
env: | ||
APP_NAME: ${{ inputs.app_name }} | ||
CPLN_ORG: ${{ inputs.org }} |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
#!/bin/bash | ||
|
||
# Script to delete a Control Plane application | ||
# Required environment variables: | ||
# - APP_NAME: Name of the application to delete | ||
# - CPLN_ORG: Organization name | ||
|
||
set -e | ||
|
||
# Validate required environment variables | ||
: "${APP_NAME:?APP_NAME environment variable is required}" | ||
: "${CPLN_ORG:?CPLN_ORG environment variable is required}" | ||
|
||
# Safety check: prevent deletion of production or staging apps | ||
if echo "$APP_NAME" | grep -iqE '(production|staging)'; then | ||
echo "❌ ERROR: Cannot delete apps containing 'production' or 'staging' in their name" >&2 | ||
echo "🛑 This is a safety measure to prevent accidental deletion of production or staging environments" >&2 | ||
echo " App name: $APP_NAME" >&2 | ||
exit 1 | ||
fi | ||
|
||
# Check if app exists before attempting to delete | ||
echo "🔍 Checking if application exists: $APP_NAME" | ||
if ! cpflow exists -a "$APP_NAME"; then | ||
echo "⚠️ Application does not exist: $APP_NAME" | ||
exit 0 | ||
fi | ||
|
||
# Delete the application | ||
echo "🗑️ Deleting application: $APP_NAME" | ||
if ! cpflow delete -a "$APP_NAME" --force; then | ||
echo "❌ Failed to delete application: $APP_NAME" >&2 | ||
exit 1 | ||
fi | ||
|
||
echo "✅ Successfully deleted application: $APP_NAME" |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,7 @@ | ||
#!/bin/bash | ||
|
||
# This script handles the deployment to Control Plane and extracts the Rails URL | ||
# | ||
# | ||
# Required environment variables: | ||
# - APP_NAME: Name of the application to deploy | ||
# - CPLN_ORG: Control Plane organization | ||
|
@@ -11,7 +11,7 @@ | |
# Must be a positive integer | ||
# | ||
# Outputs: | ||
# - ENV APP_URL: URL of the deployed application | ||
# - rails_url: URL of the deployed Rails application | ||
|
||
set -e | ||
|
||
|
@@ -31,34 +31,21 @@ trap 'rm -f "$TEMP_OUTPUT"' EXIT | |
|
||
# Deploy the application | ||
echo "🚀 Deploying to Control Plane (timeout: ${WAIT_TIMEOUT}s)" | ||
if ! timeout "${WAIT_TIMEOUT}" cpflow deploy-image -a "$APP_NAME" --run-release-phase --org "$CPLN_ORG" --verbose 2>&1 | tee "$TEMP_OUTPUT"; then | ||
echo "❌ Deployment failed" | ||
echo "Full output:" | ||
cat "$TEMP_OUTPUT" | ||
exit 1 | ||
fi | ||
|
||
# Extract app URL from deployment output | ||
APP_URL=$(grep -oP 'https://[^[:space:]]*\.cpln\.app(?=\s|$)' "$TEMP_OUTPUT" | head -n1) | ||
if [ -z "$APP_URL" ]; then | ||
echo "❌ Error: Could not find app URL in deployment output" | ||
exit 1 | ||
if timeout "$WAIT_TIMEOUT" cpflow deploy-image -a "$APP_NAME" --run-release-phase --org "$CPLN_ORG" --verbose | tee "$TEMP_OUTPUT"; then | ||
# Extract Rails URL from deployment output | ||
RAILS_URL=$(grep -oP 'https://rails-[^[:space:]]*\.cpln\.app(?=\s|$)' "$TEMP_OUTPUT" | head -n1) | ||
if [ -n "$RAILS_URL" ]; then | ||
echo "rails_url=$RAILS_URL" >> "$GITHUB_OUTPUT" | ||
echo "✅ Deployment successful" | ||
echo "🚀 Rails URL: $RAILS_URL" | ||
else | ||
echo "❌ Failed to extract Rails URL from deployment output" | ||
exit 1 | ||
fi | ||
elif [ $? -eq 124 ]; then | ||
echo "❌ Deployment timed out after $WAIT_TIMEOUT seconds" | ||
exit 1 | ||
else | ||
echo "❌ Deployment to Control Plane failed" | ||
exit 1 | ||
fi | ||
Comment on lines
33
to
51
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 💡 Verification agent 🧩 Analysis chainRevert Deployment Logic Changes I'll start by verifying whether the updated Rails URL extraction logic is present in the deployment script. This will confirm that the new changes (and thus the revert request) are indeed applied. Here’s a shell script to check for the regex used to extract the Rails URL: Once the results confirm that the extraction logic using the modified regex is present in the file, you can be sure that the deployment script includes the changes that the PR is intended to revert. 🏁 Script executed: #!/bin/bash
# Verify if the updated Rails URL extraction logic is present in the deployment script.
grep -n "grep -oP 'https://rails-[^[:space:]]*\.cpln\.app(?=\\s|$)'" .github/actions/deploy-to-control-plane/scripts/deploy.sh Length of output: 255 Below is a revised review comment. Since the initial search for the modified Rails URL extraction logic did not return any output, I'm asking for manual re‑verification to confirm whether the new code is present or if the changes have already been reverted. Action Required:
🏁 Script executed: #!/bin/bash
echo "Searching for updated Rails URL extraction logic in deploy.sh..."
rg "grep -oP 'https://rails-[^[:space:]]*\.cpln\.app(?=\\s|$)'" .github/actions/deploy-to-control-plane/scripts/deploy.sh
echo "Searching for the cpflow deploy-image and timeout handling block..."
rg "timeout .* cpflow deploy-image" .github/actions/deploy-to-control-plane/scripts/deploy.sh Length of output: 1076 Action Required: Revert Updated Deployment Logic Changes
Manual verification is advised to confirm that the updated logic is effectively reverted. |
||
|
||
# Wait for all workloads to be ready | ||
echo "⏳ Waiting for all workloads to be ready (timeout: ${WAIT_TIMEOUT}s)" | ||
if ! timeout "${WAIT_TIMEOUT}" bash -c "cpflow ps:wait -a \"$APP_NAME\"" 2>&1 | tee -a "$TEMP_OUTPUT"; then | ||
TIMEOUT_EXIT=$? | ||
if [ ${TIMEOUT_EXIT} -eq 124 ]; then | ||
echo "❌ Timed out waiting for workloads after ${WAIT_TIMEOUT} seconds" | ||
else | ||
echo "❌ Workloads did not become ready" | ||
fi | ||
echo "Full output:" | ||
cat "$TEMP_OUTPUT" | ||
exit 1 | ||
fi | ||
|
||
echo "✅ Deployment successful" | ||
echo "🌐 App URL: $APP_URL" | ||
echo "APP_URL=$APP_URL" >> "$GITHUB_OUTPUT" |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
#!/bin/bash | ||
|
||
# This script retrieves the commit SHA for deployment | ||
# It handles both PR and direct branch deployments | ||
# | ||
# Required environment variables: | ||
# - PR_NUMBER: Pull request number (optional) | ||
# - GITHUB_TOKEN: GitHub token for API access | ||
# | ||
# Outputs: | ||
# - sha: Full commit SHA | ||
# - sha_short: Short (7 char) commit SHA | ||
|
||
set -e | ||
|
||
if [ -n "${PR_NUMBER}" ]; then | ||
# If PR_NUMBER is set, get the PR's head SHA | ||
if ! PR_SHA=$(gh pr view "${PR_NUMBER}" --json headRefOid --jq '.headRefOid'); then | ||
echo "Failed to get PR head SHA" >&2 | ||
exit 1 | ||
fi | ||
echo "sha=${PR_SHA}" >> "$GITHUB_OUTPUT" | ||
echo "sha_short=${PR_SHA:0:7}" >> "$GITHUB_OUTPUT" | ||
echo "Using PR head commit SHA: ${PR_SHA:0:7}" | ||
else | ||
# For direct branch deployments, use the current commit SHA | ||
if ! CURRENT_SHA=$(git rev-parse HEAD); then | ||
echo "Failed to get current SHA" >&2 | ||
exit 1 | ||
fi | ||
echo "sha=${CURRENT_SHA}" >> "$GITHUB_OUTPUT" | ||
echo "sha_short=${CURRENT_SHA:0:7}" >> "$GITHUB_OUTPUT" | ||
echo "Using branch commit SHA: ${CURRENT_SHA:0:7}" | ||
fi |
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -3,14 +3,6 @@ | |
name: 'Setup Environment' | ||
description: 'Sets up Ruby, installs Control Plane CLI, cpflow gem, and sets up the default profile' | ||
|
||
inputs: | ||
token: | ||
description: 'Control Plane token' | ||
required: true | ||
org: | ||
description: 'Control Plane organization' | ||
required: true | ||
|
||
runs: | ||
using: 'composite' | ||
steps: | ||
|
@@ -22,30 +14,27 @@ runs: | |
- name: Install Control Plane CLI and cpflow gem | ||
shell: bash | ||
run: | | ||
sudo npm install -g @controlplane/[email protected].1 | ||
sudo npm install -g @controlplane/[email protected].0 | ||
cpln --version | ||
gem install cpflow -v 4.1.0 | ||
cpflow --version | ||
|
||
- name: Setup Control Plane Profile | ||
shell: bash | ||
run: | | ||
TOKEN="${{ inputs.token }}" | ||
ORG="${{ inputs.org }}" | ||
|
||
if [ -z "$TOKEN" ]; then | ||
echo " Error: Control Plane token not provided" | ||
if [ -z "$CPLN_TOKEN" ]; then | ||
echo " Error: CPLN_TOKEN environment variable is not set" | ||
exit 1 | ||
fi | ||
|
||
if [ -z "$ORG" ]; then | ||
echo " Error: Control Plane organization not provided" | ||
if [ -z "$CPLN_ORG" ]; then | ||
echo " Error: CPLN_ORG environment variable is not set" | ||
exit 1 | ||
fi | ||
|
||
echo "Setting up Control Plane profile..." | ||
echo "Organization: $ORG" | ||
cpln profile update default --org "$ORG" --token "$TOKEN" | ||
echo "Organization: $CPLN_ORG" | ||
cpln profile update default --org "$CPLN_ORG" --token "$CPLN_TOKEN" | ||
|
||
echo "Setting up Docker login for Control Plane registry..." | ||
cpln image docker-login --org "$ORG" | ||
cpln image docker-login --org "$CPLN_ORG" |
This file was deleted.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Revert Added Environment Setup and Commit SHA Steps
Additional steps have been added for setting up the environment and retrieving the commit SHA (via get-commit-sha.sh). As the intent is to revert recent changes, remove these steps and restore the original inputs and workflow logic.