-
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
Fix Github Action / Control Plane Pipeline #626
Changes from 6 commits
8f7c638
1454772
d70b546
0562a28
d17ca4e
1039020
a6fe0a3
ee5c4f4
c334031
5f30098
328f25f
dfc82c4
d63cfb9
95415c1
1442b41
62c6465
fd00379
6f4ef1e
99a6c33
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
This file was deleted.
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -2,14 +2,12 @@ name: Deploy PR Review App to Control Plane | |
|
||
run-name: Deploy PR Review App - PR #${{ github.event.pull_request.number || github.event.issue.number || github.event.inputs.pr_number }} | ||
|
||
|
||
on: | ||
pull_request: | ||
types: [opened, synchronize, reopened] | ||
push: | ||
branches: | ||
- '**' # Any branch | ||
- '!main' # Except main | ||
- '!master' # Except master | ||
branches: [ "master" ] | ||
pull_request: | ||
branches: [ "master" ] | ||
issue_comment: | ||
types: [created] | ||
workflow_dispatch: | ||
|
@@ -24,6 +22,7 @@ concurrency: | |
cancel-in-progress: true | ||
|
||
env: | ||
PREFIX: ${{ vars.REVIEW_APP_PREFIX }} | ||
APP_NAME: ${{ vars.REVIEW_APP_PREFIX }}-pr-${{ github.event.pull_request.number || github.event.issue.number || github.event.inputs.pr_number }} | ||
CPLN_TOKEN: ${{ secrets.CPLN_TOKEN_STAGING }} | ||
CPLN_ORG: ${{ vars.CPLN_ORG_STAGING }} | ||
|
@@ -70,7 +69,28 @@ jobs: | |
fetch-depth: 0 | ||
|
||
- name: Validate Required Secrets and Variables | ||
uses: ./.github/actions/validate-required-vars | ||
shell: bash | ||
run: | | ||
missing=() | ||
|
||
# Check required secrets | ||
if [ -z "$CPLN_TOKEN" ]; then | ||
missing+=("Secret: CPLN_TOKEN_STAGING") | ||
fi | ||
|
||
# Check required variables | ||
if [ -z "$CPLN_ORG" ]; then | ||
missing+=("Variable: CPLN_ORG_STAGING") | ||
fi | ||
|
||
if [ -z "$PREFIX" ]; then | ||
missing+=("Variable: REVIEW_APP_PREFIX") | ||
fi | ||
|
||
if [ ${#missing[@]} -ne 0 ]; then | ||
echo "Required secrets/variables are not set: ${missing[*]}" | ||
exit 1 | ||
fi | ||
|
||
- name: Get PR HEAD Ref | ||
id: getRef | ||
|
@@ -294,9 +314,6 @@ jobs: | |
runs-on: ubuntu-latest | ||
outputs: | ||
image_tag: ${{ steps.build.outputs.image_tag }} | ||
comment_id: ${{ needs.process-deployment.outputs.comment_id }} | ||
pr_number: ${{ needs.process-deployment.outputs.pr_number }} | ||
do_deploy: ${{ needs.process-deployment.outputs.do_deploy }} | ||
steps: | ||
- name: Checkout code | ||
uses: actions/checkout@v4 | ||
|
@@ -341,6 +358,8 @@ jobs: | |
needs: build | ||
if: needs.build.outputs.do_deploy != 'false' | ||
runs-on: ubuntu-latest | ||
env: | ||
COMMENT_ID: ${{ needs.process-deployment.outputs.comment_id }} | ||
coderabbitai[bot] marked this conversation as resolved.
Show resolved
Hide resolved
|
||
steps: | ||
- name: Checkout code | ||
uses: actions/checkout@v4 | ||
|
@@ -351,6 +370,12 @@ jobs: | |
token: ${{ secrets.CPLN_TOKEN_STAGING }} | ||
org: ${{ vars.CPLN_ORG_STAGING }} | ||
|
||
- name: Print Comment id as job output | ||
run: echo '${{ needs.process-deployment.outputs.comment_id }}' | ||
|
||
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 ❓ Verification inconclusiveCorrect Variable Substitution in Output Print echo '${{ needs.process-deployment.outputs.comment_id }}' Single quotes prevent the GitHub Actions expression from being evaluated. Replace them with double quotes: - echo '${{ needs.process-deployment.outputs.comment_id }}'
+ echo "${{ needs.process-deployment.outputs.comment_id }}" This change is needed for the correct value to be printed. Critical Fix Needed: Update Quoting for Correct Variable Expansion Please replace the single quotes in the echo command with double quotes so that GitHub Actions correctly interpolates the variable. This is required to output the actual value from
🧰 Tools🪛 actionlint (1.7.4)375-375: property "process-deployment" is not defined in object type {build: {outputs: {image_tag: string}; result: string}} (expression) |
||
- name: Print Comment id as env var | ||
run: echo '${process.env.COMMENT_ID}' | ||
|
||
coderabbitai[bot] marked this conversation as resolved.
Show resolved
Hide resolved
|
||
- name: Update Status - Deploying | ||
uses: actions/github-script@v7 | ||
with: | ||
|
@@ -368,7 +393,7 @@ jobs: | |
await github.rest.issues.updateComment({ | ||
owner: context.repo.owner, | ||
repo: context.repo.repo, | ||
comment_id: ${{ steps.create-comment.outputs.comment-id }}, | ||
comment_id: '${process.env.COMMENT_ID}', | ||
body: deployingMessage | ||
}); | ||
|
||
|
@@ -399,7 +424,7 @@ jobs: | |
const deploymentStatus = { | ||
owner: context.repo.owner, | ||
repo: context.repo.repo, | ||
deployment_id: ${{ steps.init-deployment.outputs.result }}, | ||
deployment_id: ${{ needs.process-deployment.outputs.deployment_id }}, | ||
state: isSuccess ? 'success' : 'failure', | ||
environment_url: isSuccess ? appUrl : undefined, | ||
log_url: workflowUrl, | ||
|
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.
Validation Script: Critical Syntax Issue in Variable Check.
In the validation step (line 61), the condition
is syntactically incorrect. Please change it to:
to correctly validate if
PREFIX
is set.🧰 Tools
🪛 YAMLlint (1.35.1)
[error] 50-50: trailing spaces
(trailing-spaces)
[error] 55-55: trailing spaces
(trailing-spaces)
[error] 64-64: trailing spaces
(trailing-spaces)
[error] 68-68: trailing spaces
(trailing-spaces)