Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Improvements to deployments #615

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

Merged
justin808 merged 59 commits into master from justin808-testing-2025-01
Jan 26, 2025
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
59 commits
Select commit Hold shift + click to select a range
ee08d3a
Pass correct arg
justin808 Jan 23, 2025
c790151
Set args with =
justin808 Jan 23, 2025
8355030
Address deprecation messages
justin808 Jan 23, 2025
f19d79f
Updates to deployment
justin808 Jan 23, 2025
e487791
updates
justin808 Jan 23, 2025
25e9502
Fixed the deployment_id output in the
justin808 Jan 23, 2025
de55983
fixes
justin808 Jan 23, 2025
5240c9b
fixes
justin808 Jan 23, 2025
2a1b9a3
fixes
justin808 Jan 23, 2025
8918cd2
fixes
justin808 Jan 23, 2025
fe262cb
fixes
justin808 Jan 23, 2025
80d841b
fixes
justin808 Jan 23, 2025
084f0d0
fixes
justin808 Jan 23, 2025
cac41c4
Fixed failure to deploy to review app
justin808 Jan 23, 2025
745ca0e
fixes
justin808 Jan 23, 2025
f77a610
fixes
justin808 Jan 23, 2025
87662fa
Updates, fix crash
justin808 Jan 24, 2025
4970fbe
fixes
justin808 Jan 24, 2025
e26cc72
fixes
justin808 Jan 24, 2025
29ade6f
Fixes
justin808 Jan 24, 2025
8db0511
fixes
justin808 Jan 24, 2025
b7a7229
fixes
justin808 Jan 24, 2025
1cff976
fixes
justin808 Jan 24, 2025
6cbdb04
fixes
justin808 Jan 24, 2025
0b15816
fixes
justin808 Jan 24, 2025
ae8a473
fixes
justin808 Jan 24, 2025
e6d5025
fixes
justin808 Jan 24, 2025
444ec85
fixes
justin808 Jan 24, 2025
8041a01
fixes
justin808 Jan 24, 2025
b03b6d7
fixes
justin808 Jan 24, 2025
a12e0d4
fixes
justin808 Jan 24, 2025
98649f2
fixes
justin808 Jan 24, 2025
b2e710a
fixes
justin808 Jan 24, 2025
c54a544
fixes
justin808 Jan 24, 2025
c80ff43
fixes
justin808 Jan 24, 2025
40473cc
fixes
justin808 Jan 25, 2025
038cf8f
fixes
justin808 Jan 25, 2025
c25211f
fixes
justin808 Jan 25, 2025
304e642
fixes
justin808 Jan 25, 2025
4744c76
fixes
justin808 Jan 25, 2025
5c8b3ab
fixes
justin808 Jan 26, 2025
2a51c92
fixes
justin808 Jan 26, 2025
61213b9
fixes
justin808 Jan 26, 2025
e431bdf
fixes
justin808 Jan 26, 2025
895986c
fixes
justin808 Jan 26, 2025
3fe506e
fixes
justin808 Jan 26, 2025
585c02d
fixes
justin808 Jan 26, 2025
c46f595
fixes
justin808 Jan 26, 2025
65c64d1
fixes
justin808 Jan 26, 2025
e96ac82
doc changes
justin808 Jan 26, 2025
2be9c2f
Changes made:
justin808 Jan 26, 2025
5f50639
fixes
justin808 Jan 26, 2025
e0cf883
fixes
justin808 Jan 26, 2025
b27783e
added promotion and other fixes
justin808 Jan 26, 2025
66a4114
fixes
justin808 Jan 26, 2025
3426aca
fix-for-delete
justin808 Jan 26, 2025
92ad3a7
fix-for-delete
justin808 Jan 26, 2025
7d75738
fix-for-delete
justin808 Jan 26, 2025
d5b8b7f
fix-for-delete
justin808 Jan 26, 2025
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
fix-for-delete
  • Loading branch information
justin808 committed Jan 26, 2025
commit 7d75738cc7267c3e04b20ee17c61854b7b561669
51 changes: 22 additions & 29 deletions .github/workflows/delete-review-app.yml
View file Open in desktop
Original file line number Diff line number Diff line change
Expand Up @@ -11,58 +11,51 @@ permissions:
issues: write

env:
CPLN_ORG: ${{ secrets.CPLN_ORG_STAGING }}
CPLN_TOKEN: ${{ secrets.CPLN_TOKEN_STAGING }}
CPLN_ORG: ${{ secrets.CPLN_ORG }}
CPLN_TOKEN: ${{ secrets.CPLN_TOKEN }}
APP_NAME: qa-react-webpack-rails-tutorial-pr-${{ github.event.issue.number }}
PR_NUMBER: ${{ github.event.issue.number }}

jobs:
Process-Delete-Command:
if: |
github.event_name == 'issue_comment' &&
github.event.issue.pull_request &&
github.event.comment.body == '/delete-review-app'
debug-trigger:
if: always()
runs-on: ubuntu-latest

steps:
- name: Debug Trigger Conditions
env:
EVENT_NAME: ${{ github.event_name }}
IS_PR: ${{ github.event.issue.pull_request != '' }}
IS_PR: ${{ toJSON(github.event.issue.pull_request) }}
COMMENT: ${{ github.event.comment.body }}
PR_NUMBER: ${{ github.event.issue.number }}
run: |
echo "Debug information for delete-review-app command:"
echo "Event name: $EVENT_NAME"
echo "Is PR: $IS_PR"
echo "Is PR (raw): $IS_PR"
echo "Comment body: $COMMENT"
echo "PR number: $PR_NUMBER"
echo "Raw event payload:"
echo '${{ toJSON(github.event) }}'

- name: Get PR number
id: pr
uses: actions/github-script@v7
with:
script: |
const prNumber = context.payload.issue.number;
core.setOutput('pr_number', prNumber);
core.exportVariable('PR_NUMBER', prNumber);

- name: Set App Name
run: echo "APP_NAME=qa-react-webpack-rails-tutorial-pr-${{ env.PR_NUMBER }}" >> $GITHUB_ENV
Process-Delete-Command:
needs: debug-trigger
if: |
github.event_name == 'issue_comment' &&
github.event.issue.pull_request &&
github.event.comment.body == '/delete-review-app'
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v4

- name: Validate Required Secrets
run: |
missing_secrets=()
for secret in "CPLN_TOKEN_STAGING" "CPLN_ORG_STAGING"; do
for secret in "CPLN_TOKEN" "CPLN_ORG"; do
if [ -z "${!secret}" ]; then
missing_secrets+=("$secret")
fi
done

if [ ${#missing_secrets[@]} -ne 0 ]; then
echo " Required secrets are not set: ${missing_secrets[*]}"
echo " Required secrets are not set: ${missing_secrets[*]}"
exit 1
fi

Expand All @@ -78,7 +71,7 @@ jobs:
issue_number: process.env.PR_NUMBER,
owner: context.repo.owner,
repo: context.repo.repo,
body: '🗑️ Starting app deletion...'
body: ' Starting app deletion...'
});
return { commentId: comment.data.id };

Expand All @@ -101,11 +94,11 @@ jobs:
const cpConsoleUrl = `https://console.cpln.io/org/${process.env.CPLN_ORG}/workloads/${process.env.APP_NAME}`;

const message = success
? ' Review app for PR #' + prNumber + ' was successfully deleted'
? ' Review app for PR #' + prNumber + ' was successfully deleted'
: [
' Review app for PR #' + prNumber + ' failed to be deleted',
' Review app for PR #' + prNumber + ' failed to be deleted',
'',
'[View in Control Plane Console](' + cpConsoleUrl + ')'
'[Control Plane Console for Review App with PR #' + prNumber + '](' + cpConsoleUrl + ')'
].join('\n');

await github.rest.issues.updateComment({
Expand Down
157 changes: 154 additions & 3 deletions .github/workflows/deploy-to-control-plane.yml
View file Open in desktop
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,8 @@ concurrency:

env:
APP_NAME: qa-react-webpack-rails-tutorial-pr-${{ github.event.pull_request.number || github.event.issue.number }}
CPLN_ORG: ${{ secrets.CPLN_ORG_STAGING }}
CPLN_TOKEN: ${{ secrets.CPLN_TOKEN_STAGING }}
CPLN_ORG: ${{ secrets.CPLN_ORG }}
CPLN_TOKEN: ${{ secrets.CPLN_TOKEN }}
PR_NUMBER: ${{ github.event.pull_request.number || github.event.issue.number }}

jobs:
Expand Down Expand Up @@ -53,7 +53,7 @@ jobs:
- name: Validate Required Secrets
run: |
missing_secrets=()
for secret in "CPLN_TOKEN_STAGING" "CPLN_ORG_STAGING"; do
for secret in "CPLN_TOKEN" "CPLN_ORG"; do
if [ -z "${!secret}" ]; then
missing_secrets+=("$secret")
fi
Expand Down Expand Up @@ -249,4 +249,155 @@ jobs:
repo: context.repo.repo,
comment_id: process.env.COMMENT_ID,
body: isSuccess ? successMessage : failureMessage
});

debug-help:
if: always()
runs-on: ubuntu-latest
steps:
- name: Debug Trigger Conditions
env:
EVENT_NAME: ${{ github.event_name }}
IS_PR: ${{ toJSON(github.event.issue.pull_request) }}
COMMENT: ${{ github.event.comment.body }}
run: |
echo "Debug information for help command:"
echo "Event name: $EVENT_NAME"
echo "Is PR (raw): $IS_PR"
echo "Comment body: $COMMENT"
echo "Raw event payload:"
echo '${{ toJSON(github.event) }}'

show-help:
needs: debug-help
if: |
github.event_name == 'issue_comment' &&
github.event.issue.pull_request &&
github.event.comment.body == '/help'
runs-on: ubuntu-latest

steps:
- name: Show Available Commands
uses: actions/github-script@v7
with:
script: |
const helpMessage = [
'## 📚 Available Commands',
'',
'### `/deploy`',
'Deploys your PR branch to a review environment on Control Plane.',
'- Creates a new review app if one doesn\'t exist',
'- Updates the existing review app if it already exists',
'- Provides a unique URL to preview your changes',
'- Shows build and deployment progress in real-time',
'',
'### `/delete-review-app`',
'Deletes the review app associated with this PR.',
'- Removes all resources from Control Plane',
'- Helpful for cleaning up when you\'re done testing',
'- Can be re-deployed later using `/deploy`',
'',
'### `/help`',
'Shows this help message explaining available commands.',
'',
'---',
'_Note: These commands only work in pull request comments._'
].join('\n');

await github.rest.issues.createComment({
owner: context.repo.owner,
repo: context.repo.repo,
issue_number: context.payload.issue.number,
body: helpMessage
});

debug-delete:
if: always()
runs-on: ubuntu-latest
steps:
- name: Debug Trigger Conditions
env:
EVENT_NAME: ${{ github.event_name }}
IS_PR: ${{ toJSON(github.event.issue.pull_request) }}
COMMENT: ${{ github.event.comment.body }}
run: |
echo "Debug information for delete-review-app command:"
echo "Event name: $EVENT_NAME"
echo "Is PR (raw): $IS_PR"
echo "Comment body: $COMMENT"
echo "Raw event payload:"
echo '${{ toJSON(github.event) }}'

Process-Delete-Command:
needs: debug-delete
if: |
github.event_name == 'issue_comment' &&
github.event.issue.pull_request &&
github.event.comment.body == '/delete-review-app'
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v4

- name: Validate Required Secrets
run: |
missing_secrets=()
for secret in "CPLN_TOKEN" "CPLN_ORG"; do
if [ -z "${!secret}" ]; then
missing_secrets+=("$secret")
fi
done

if [ ${#missing_secrets[@]} -ne 0 ]; then
echo "❌ Required secrets are not set: ${missing_secrets[*]}"
exit 1
fi

- name: Setup Environment
uses: ./.github/actions/setup-environment

- name: Create Initial Delete Comment
id: init-delete
uses: actions/github-script@v7
with:
script: |
const comment = await github.rest.issues.createComment({
issue_number: process.env.PR_NUMBER,
owner: context.repo.owner,
repo: context.repo.repo,
body: '🗑️ Starting app deletion...'
});
return { commentId: comment.data.id };

- name: Delete Review App
uses: ./.github/actions/delete-control-plane-app
with:
app_name: ${{ env.APP_NAME }}
org: ${{ env.CPLN_ORG }}
github_token: ${{ secrets.GITHUB_TOKEN }}
env:
CPLN_TOKEN: ${{ secrets.CPLN_TOKEN }}

- name: Update Delete Status
if: always()
uses: actions/github-script@v7
with:
script: |
const success = '${{ job.status }}' === 'success';
const prNumber = process.env.PR_NUMBER;
const cpConsoleUrl = `https://console.cpln.io/org/${process.env.CPLN_ORG}/workloads/${process.env.APP_NAME}`;

const message = success
? '✅ Review app for PR #' + prNumber + ' was successfully deleted'
: [
'❌ Review app for PR #' + prNumber + ' failed to be deleted',
'',
'🎮 [Control Plane Console for Review App with PR #' + prNumber + '](' + cpConsoleUrl + ')'
].join('\n');

await github.rest.issues.updateComment({
owner: context.repo.owner,
repo: context.repo.repo,
comment_id: ${{ fromJSON(steps.init-delete.outputs.result).commentId }},
body: message
});
23 changes: 14 additions & 9 deletions .github/workflows/help-command.yml
View file Open in desktop
Original file line number Diff line number Diff line change
Expand Up @@ -9,33 +9,38 @@ permissions:
pull-requests: write

jobs:
show-help:
if: |
github.event_name == 'issue_comment' &&
github.event.issue.pull_request &&
github.event.comment.body == '/help'
debug-trigger:
if: always()
runs-on: ubuntu-latest

steps:
- name: Debug Trigger Conditions
env:
EVENT_NAME: ${{ github.event_name }}
IS_PR: ${{ github.event.issue.pull_request != '' }}
IS_PR: ${{ toJSON(github.event.issue.pull_request) }}
COMMENT: ${{ github.event.comment.body }}
run: |
echo "Debug information for help command:"
echo "Event name: $EVENT_NAME"
echo "Is PR: $IS_PR"
echo "Is PR (raw): $IS_PR"
echo "Comment body: $COMMENT"
echo "Raw event payload:"
echo '${{ toJSON(github.event) }}'

show-help:
needs: debug-trigger
if: |
github.event_name == 'issue_comment' &&
github.event.issue.pull_request &&
github.event.comment.body == '/help'
runs-on: ubuntu-latest

steps:
- name: Show Available Commands
uses: actions/github-script@v7
with:
script: |
const helpMessage = [
'## 📚 Available Commands',
'## Available Commands',
'',
'### `/deploy`',
'Deploys your PR branch to a review environment on Control Plane.',
Expand Down
Loading

AltStyle によって変換されたページ (->オリジナル) /