Skip to content

Commit 7bef5cc

Browse files
Add GitHub CI Container Clean Up Job (#1685)
* Add main filter to PR CI image builds * Add github CI image cleanup job --------- Co-authored-by: mergify[bot] <37929162+mergify[bot]@users.noreply.github.com>
1 parent 2a95084 commit 7bef5cc

2 files changed

Lines changed: 53 additions & 0 deletions

File tree

.github/workflows/build-ci-image.yml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,8 @@ on:
2222
paths:
2323
- ".github/containers/ci/**"
2424
- ".github/workflows/build-ci-image.yml"
25+
branches:
26+
- main
2527
push: # Trigger rebuilds when pushing relevant files to main.
2628
paths:
2729
- ".github/containers/ci/**"
Lines changed: 51 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,51 @@
1+
# Copyright 2010 New Relic, Inc.
2+
#
3+
# Licensed under the Apache License, Version 2.0 (the "License");
4+
# you may not use this file except in compliance with the License.
5+
# You may obtain a copy of the License at
6+
#
7+
# http://www.apache.org/licenses/LICENSE-2.0
8+
#
9+
# Unless required by applicable law or agreed to in writing, software
10+
# distributed under the License is distributed on an "AS IS" BASIS,
11+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12+
# See the License for the specific language governing permissions and
13+
# limitations under the License.
14+
---
15+
name: Delete CI Images
16+
17+
on:
18+
schedule:
19+
- cron: "15 17 1 * *" # At 17:15 UTC on the 1st day of every month
20+
workflow_dispatch: # Allow manual trigger
21+
inputs:
22+
dry-run:
23+
description: "Dry run mode"
24+
required: false
25+
default: false
26+
type: boolean
27+
28+
permissions:
29+
contents: read
30+
packages: write
31+
32+
concurrency:
33+
group: ${{ github.workflow }} # Only 1 job ever allowed at a time
34+
cancel-in-progress: true
35+
36+
jobs:
37+
ghcr-cleanup-image:
38+
name: ghcr cleanup action
39+
runs-on: ubuntu-latest
40+
steps:
41+
- uses: dataaxiom/ghcr-cleanup-action@cd0cdb900b5dbf3a6f2cc869f0dbb0b8211f50c4 # 1.0.16
42+
with:
43+
package: newrelic-python-agent-ci
44+
exclude-tags: latest
45+
delete-untagged: true
46+
delete-ghost-images: true
47+
delete-partial-images: true
48+
delete-orphaned-images: true
49+
older-than: 90 days
50+
validate: true
51+
dry-run: ${{ inputs.dry-run }}

0 commit comments

Comments
 (0)