Skip to content

Commit 2be9c2f

Browse files
committed
Changes made:
Fixed the workflow URL to include the job ID by using context.job.id Improved the deployment timeout handling: Wrapped ps:wait in bash -c to ensure proper signal handling Added more detailed error output including the deployment output Fixed variable expansion for WAIT_TIMEOUT Added exit code to error message for better debugging Added deployment output to error messages to help diagnose issues The workflow URL will now correctly point to the specific job, and we should get better error messages if the deployment fails or times out.
1 parent e96ac82 commit 2be9c2f

File tree

2 files changed

+16
-8
lines changed

2 files changed

+16
-8
lines changed

.github/actions/deploy-to-control-plane/action.yml

Lines changed: 11 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -53,18 +53,25 @@ runs:
5353
RAILS_URL=$(echo "$DEPLOY_OUTPUT" | grep -oP 'https://rails-[^[:space:]]*\.cpln\.app(?=\s|$)' | head -n1)
5454
if [ -z "$RAILS_URL" ]; then
5555
echo "❌ Failed to get Rails URL from deployment output"
56+
echo "Deployment output:"
57+
echo "$DEPLOY_OUTPUT"
5658
exit 1
5759
fi
5860
5961
# Wait for all workloads to be ready
60-
WAIT_TIMEOUT=${WAIT_TIMEOUT:-${inputs.wait_timeout}}
62+
WAIT_TIMEOUT=${WAIT_TIMEOUT:-${{ inputs.wait_timeout }}}
6163
echo "⏳ Waiting for all workloads to be ready (timeout: ${WAIT_TIMEOUT}s)..."
62-
if ! timeout $WAIT_TIMEOUT cpflow ps:wait -a ${{ inputs.app_name }}; then
63-
if [ $? -eq 124 ]; then
64+
65+
# Use timeout command with ps:wait
66+
if ! timeout $WAIT_TIMEOUT bash -c "cpflow ps:wait -a ${{ inputs.app_name }}"; then
67+
TIMEOUT_EXIT=$?
68+
if [ $TIMEOUT_EXIT -eq 124 ]; then
6469
echo "❌ Timed out waiting for workloads after ${WAIT_TIMEOUT} seconds"
6570
else
66-
echo "❌ Workloads did not become ready for PR #$PR_NUMBER"
71+
echo "❌ Workloads did not become ready for PR #$PR_NUMBER (exit code: $TIMEOUT_EXIT)"
6772
fi
73+
echo "Last deployment output:"
74+
echo "$DEPLOY_OUTPUT"
6875
exit 1
6976
fi
7077

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

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ jobs:
2424
if: |
2525
github.event_name == 'pull_request' ||
2626
(github.event_name == 'issue_comment' &&
27-
(github.event.comment.body == '/deploy-review-pp' ||
27+
(github.event.comment.body == '/deploy-review-app' ||
2828
github.event.comment.body == '/delete-review-app') &&
2929
github.event.issue.pull_request)
3030
runs-on: ubuntu-latest
@@ -116,10 +116,11 @@ jobs:
116116
uses: actions/github-script@v7
117117
with:
118118
script: |
119-
const prNumber = process.env.PR_NUMBER;
120-
const getWorkflowUrl = (runId) =>
121-
`${process.env.GITHUB_SERVER_URL}/${context.repo.owner}/${context.repo.repo}/actions/runs/${runId}`;
119+
function getWorkflowUrl(runId) {
120+
return `${process.env.GITHUB_SERVER_URL}/${context.repo.owner}/${context.repo.repo}/actions/runs/${runId}/job/${context.job.id}`;
121+
}
122122
123+
const prNumber = process.env.PR_NUMBER;
123124
const getJobUrl = (runId, jobId, prNumber) =>
124125
`${process.env.GITHUB_SERVER_URL}/${context.repo.owner}/${context.repo.repo}/actions/runs/${runId}/job/${jobId}?pr=${prNumber}`;
125126

0 commit comments

Comments
 (0)