Skip to content

Commit

Permalink
[PAN-2036] Clean docker cache for PR branch (pantos-io#45)
Browse files Browse the repository at this point in the history
* feature: clean docker cache for PR branch
  • Loading branch information
juanmanuel-tirado authored Jul 1, 2024
1 parent ca24867 commit 14a29e0
Show file tree
Hide file tree
Showing 3 changed files with 44 additions and 6 deletions.
11 changes: 6 additions & 5 deletions .github/workflows/ci.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ jobs:
runs-on: ubuntu-latest
permissions:
contents: read

steps:
- name: Harden Runner
uses: step-security/harden-runner@17d0e2bd7d51742c71671bd19fa12bdc9d40a3d6 # v2.8.1
Expand Down Expand Up @@ -52,7 +53,7 @@ jobs:
uses: actions/cache@v3
with:
path: /tmp/.buildx-cache
key: ${{ runner.os }}-buildx-v1.0-service-node-${{ github.sha }}
key: ${{ runner.os }}-buildx-v1.0-service-node-${{ github.ref_name }}
restore-keys: |
${{ runner.os }}-buildx-v1.0-service-node-
Expand Down Expand Up @@ -84,10 +85,6 @@ jobs:
cat password.key | ./.github/workflows/scripts/generate-signer-key.py
mv signer-key*.pem signer_key.pem
# - name: Test image
# run: |
# docker compose up -d

- name: Move cache
run: |
rm -rf /tmp/.buildx-cache
Expand Down Expand Up @@ -144,3 +141,7 @@ jobs:
with:
name: install-logs-${{ matrix.os }}
path: /var/log/pantos




37 changes: 37 additions & 0 deletions .github/workflows/clean.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
name: Clean

# Collection of functions to clean any generated and no-longer-needed item

on:
pull_request_target:
types:
- closed


permissions:
contents: read
actions: write

jobs:

clean:
name: "Clean"
runs-on: ubuntu-latest
steps:
- uses: step-security/harden-runner@17d0e2bd7d51742c71671bd19fa12bdc9d40a3d6 # v2.8.1
with:
disable-sudo: true
egress-policy: audit

- name: Clean Docker cache
env:
TARGET: ${{ runner.os }}-buildx-v1.0-service-node-${{ github.ref_name }}
run: |
curl -L \
-X DELETE \
-H "Accept: application/vnd.github+json" \
-H "Authorization: Bearer ${{ secrets.GITHUB_TOKEN }}" \
-H "X-GitHub-Api-Version: 2022-11-28" \
"https://api.github.com/repos/pantos-io/servicenode/actions/caches?key=${{ env.TARGET }}"
2 changes: 1 addition & 1 deletion .github/workflows/docker-vulnerabilities.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ jobs:
production.cloudflare.docker.com:443
pypi.org:443
registry-1.docker.io:443
repo.anaconda.com:443
repo.anaconda.com:443
- uses: actions/checkout@v4

Expand Down

0 comments on commit 14a29e0

Please sign in to comment.