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

Commit b751afe

Browse files
[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
1 parent d8b1e93 commit b751afe

File tree

4 files changed

+59
-17
lines changed

4 files changed

+59
-17
lines changed

‎.controlplane/controlplane.yml‎

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -71,3 +71,5 @@ apps:
7171
- rails
7272
# match_if_app_name_starts_with is used to identify these "qa" apps.
7373
match_if_app_name_starts_with: true
74+
image_retention_days: 5
75+
stale_app_image_deployed_days: 5 # If the app is older than 5 days, the nightly automations will clean stale apps.

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

Lines changed: 2 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -16,29 +16,14 @@ inputs:
1616
runs:
1717
using: 'composite'
1818
steps:
19-
- name: Set up Ruby
20-
uses: ruby/setup-ruby@v1
21-
with:
22-
ruby-version: '3.3.3' # Specify your Ruby version here
23-
24-
- name: Install Control Plane CLI
25-
shell: bash
26-
run: |
27-
sudo npm install -g @controlplane/cli@3.1.0
28-
cpln --version
29-
gem install cpflow -v 4.0.0
30-
cpflow --version
19+
- name: Setup Environment
20+
uses: ./.github/actions/setup-environment
3121

3222
- name: Set Short SHA
3323
id: vars
3424
shell: bash
3525
run: echo "::set-output name=sha_short::$(git rev-parse --short HEAD)"
3626

37-
- name: cpln profile
38-
shell: bash
39-
run: |
40-
cpln profile update default
41-
4227
# Caching step
4328
- uses: actions/cache@v2
4429
with:
Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
# Control Plane GitHub Action
2+
3+
name: 'Setup Environment'
4+
description: 'Sets up Ruby, installs Control Plane CLI, cpflow gem, and sets up the default profile'
5+
6+
runs:
7+
using: 'composite'
8+
steps:
9+
- name: Set up Ruby
10+
uses: ruby/setup-ruby@v1
11+
with:
12+
ruby-version: '3.3.3'
13+
14+
- name: Install Control Plane CLI and cpflow gem
15+
shell: bash
16+
run: |
17+
sudo npm install -g @controlplane/cli@3.1.0
18+
cpln --version
19+
gem install cpflow -v 4.0.0
20+
cpflow --version
21+
22+
- name: cpln profile
23+
shell: bash
24+
run: |
25+
cpln profile update default
Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
name: Nightly Remove Stale Review Apps and Images
2+
3+
on:
4+
# Allows you to run this workflow manually from the Actions tab
5+
workflow_dispatch:
6+
schedule:
7+
- cron: '0 0 * * *'
8+
9+
env:
10+
CPLN_ORG: ${{secrets.CPLN_ORG_STAGING}}
11+
CPLN_TOKEN: ${{secrets.CPLN_TOKEN_STAGING}}
12+
13+
jobs:
14+
remove-stale-review-apps:
15+
runs-on: ubuntu-latest
16+
17+
steps:
18+
- name: Checkout repository
19+
uses: actions/checkout@v4
20+
21+
- name: Setup Environment
22+
uses: ./.github/actions/setup-environment
23+
24+
- name: Run cleanup-stale-apps script
25+
run: |
26+
cpflow cleanup-stale-apps -a qa-react-webpack-rails-tutorial -y
27+
28+
- name: Run cleanup-images script
29+
run: |
30+
cpflow cleanup-images -a qa-react-webpack-rails-tutorial -y

0 commit comments

Comments
(0)

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