Skip to content

Commit dfc82c4

Browse files
committed
revert changes to deploy script
1 parent 328f25f commit dfc82c4

File tree

1 file changed

+19
-42
lines changed
  • .github/actions/deploy-to-control-plane/scripts

1 file changed

+19
-42
lines changed
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
#!/bin/bash
22

33
# This script handles the deployment to Control Plane and extracts the Rails URL
4-
#
4+
#
55
# Required environment variables:
66
# - APP_NAME: Name of the application to deploy
77
# - CPLN_ORG: Control Plane organization
@@ -11,17 +11,14 @@
1111
# Must be a positive integer
1212
#
1313
# Outputs:
14-
# - ENV APP_URL: URL of the deployed application
14+
# - rails_url: URL of the deployed Rails application
1515

1616
set -e
1717

1818
# Validate required environment variables
1919
: "${APP_NAME:?APP_NAME environment variable is required}"
2020
: "${CPLN_ORG:?CPLN_ORG environment variable is required}"
2121

22-
auth_check=$(cpln profile get 2>&1)
23-
echo "$auth_check"
24-
2522
# Set and validate deployment timeout
2623
WAIT_TIMEOUT=${WAIT_TIMEOUT:-900}
2724
if ! [[ "${WAIT_TIMEOUT}" =~ ^[0-9]+$ ]]; then
@@ -34,41 +31,21 @@ trap 'rm -f "$TEMP_OUTPUT"' EXIT
3431

3532
# Deploy the application
3633
echo "🚀 Deploying to Control Plane (timeout: ${WAIT_TIMEOUT}s)"
37-
if ! timeout "${WAIT_TIMEOUT}" cpflow deploy-image -a "$APP_NAME" --run-release-phase --org "$CPLN_ORG" --verbose 2>&1 | tee "$TEMP_OUTPUT"; then
38-
echo "❌ Deployment failed"
39-
echo "Full output:"
40-
cat "$TEMP_OUTPUT"
41-
exit 1
42-
fi
43-
44-
echo "🚀 Rocket launched!"
45-
46-
# Wait for all workloads to be ready
47-
echo "⏳ Waiting for all workloads to be ready (timeout: ${WAIT_TIMEOUT}s)"
48-
if ! timeout "${WAIT_TIMEOUT}" bash -c "cpflow ps:wait -a \"$APP_NAME\"" 2>&1 | tee -a "$TEMP_OUTPUT"; then
49-
TIMEOUT_EXIT=$?
50-
if [ ${TIMEOUT_EXIT} -eq 124 ]; then
51-
echo "❌ Timed out waiting for workloads after ${WAIT_TIMEOUT} seconds"
52-
else
53-
echo "❌ Workloads did not become ready"
54-
fi
55-
echo "Full output:"
56-
cat "$TEMP_OUTPUT"
57-
exit 1
58-
fi
59-
60-
echo "⏳ Wait complete!"
61-
62-
# Extract app URL from deployment output
63-
echo "🙏 Extracting app URL"
64-
APP_URL=$(grep -oP 'https://[^[:space:]]*\.cpln\.app(?=\s|$)' "$TEMP_OUTPUT" | head -n1)
65-
if [ -z "$APP_URL" ]; then
66-
echo "❌ Error: Could not find app URL in deployment output"
67-
echo "Full output:"
68-
cat "$TEMP_OUTPUT"
69-
exit 1
34+
if timeout "$WAIT_TIMEOUT" cpflow deploy-image -a "$APP_NAME" --run-release-phase --org "$CPLN_ORG" --verbose | tee "$TEMP_OUTPUT"; then
35+
# Extract Rails URL from deployment output
36+
RAILS_URL=$(grep -oP 'https://rails-[^[:space:]]*\.cpln\.app(?=\s|$)' "$TEMP_OUTPUT" | head -n1)
37+
if [ -n "$RAILS_URL" ]; then
38+
echo "rails_url=$RAILS_URL" >> "$GITHUB_OUTPUT"
39+
echo "✅ Deployment successful"
40+
echo "🚀 Rails URL: $RAILS_URL"
41+
else
42+
echo "❌ Failed to extract Rails URL from deployment output"
43+
exit 1
44+
fi
45+
elif [ $? -eq 124 ]; then
46+
echo "❌ Deployment timed out after $WAIT_TIMEOUT seconds"
47+
exit 1
48+
else
49+
echo "❌ Deployment to Control Plane failed"
50+
exit 1
7051
fi
71-
72-
echo "✅ Deployment successful"
73-
echo "🌐 App URL: $APP_URL"
74-
echo "APP_URL=$APP_URL" >> "$GITHUB_OUTPUT"

0 commit comments

Comments
 (0)