-
Notifications
You must be signed in to change notification settings - Fork 383
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[FEATURE]: Nightly clean review apps and images (#603)
* feat: set review apps as stale after 5 days * refactor: move common env setup to a different file * feat: nightly github action to remove stale apps and images * fix: rename folder * feat: allow manual triggers of removing stale review apps * feat: temporarily allow running workflow on pull requests events to debug * feat: add CPLN_TOKEN, CPLN_ORG * feat: add image_retention_days: 5 * feat: remove triggering stale-apps removal on PR events
- Loading branch information
1 parent
d8b1e93
commit b751afe
Showing
4 changed files
with
59 additions
and
17 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -16,29 +16,14 @@ inputs: | |
runs: | ||
using: 'composite' | ||
steps: | ||
- name: Set up Ruby | ||
uses: ruby/setup-ruby@v1 | ||
with: | ||
ruby-version: '3.3.3' # Specify your Ruby version here | ||
|
||
- name: Install Control Plane CLI | ||
shell: bash | ||
run: | | ||
sudo npm install -g @controlplane/[email protected] | ||
cpln --version | ||
gem install cpflow -v 4.0.0 | ||
cpflow --version | ||
- name: Setup Environment | ||
uses: ./.github/actions/setup-environment | ||
|
||
- name: Set Short SHA | ||
id: vars | ||
shell: bash | ||
run: echo "::set-output name=sha_short::$(git rev-parse --short HEAD)" | ||
|
||
- name: cpln profile | ||
shell: bash | ||
run: | | ||
cpln profile update default | ||
# Caching step | ||
- uses: actions/cache@v2 | ||
with: | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
# Control Plane GitHub Action | ||
|
||
name: 'Setup Environment' | ||
description: 'Sets up Ruby, installs Control Plane CLI, cpflow gem, and sets up the default profile' | ||
|
||
runs: | ||
using: 'composite' | ||
steps: | ||
- name: Set up Ruby | ||
uses: ruby/setup-ruby@v1 | ||
with: | ||
ruby-version: '3.3.3' | ||
|
||
- name: Install Control Plane CLI and cpflow gem | ||
shell: bash | ||
run: | | ||
sudo npm install -g @controlplane/[email protected] | ||
cpln --version | ||
gem install cpflow -v 4.0.0 | ||
cpflow --version | ||
- name: cpln profile | ||
shell: bash | ||
run: | | ||
cpln profile update default |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
name: Nightly Remove Stale Review Apps and Images | ||
|
||
on: | ||
# Allows you to run this workflow manually from the Actions tab | ||
workflow_dispatch: | ||
schedule: | ||
- cron: '0 0 * * *' | ||
|
||
env: | ||
CPLN_ORG: ${{secrets.CPLN_ORG_STAGING}} | ||
CPLN_TOKEN: ${{secrets.CPLN_TOKEN_STAGING}} | ||
|
||
jobs: | ||
remove-stale-review-apps: | ||
runs-on: ubuntu-latest | ||
|
||
steps: | ||
- name: Checkout repository | ||
uses: actions/checkout@v4 | ||
|
||
- name: Setup Environment | ||
uses: ./.github/actions/setup-environment | ||
|
||
- name: Run cleanup-stale-apps script | ||
run: | | ||
cpflow cleanup-stale-apps -a qa-react-webpack-rails-tutorial -y | ||
- name: Run cleanup-images script | ||
run: | | ||
cpflow cleanup-images -a qa-react-webpack-rails-tutorial -y |