Skip to content

Commit 08dfb1c

Browse files
committed
Fix cleanup workflow.
1 parent 9b9919b commit 08dfb1c

File tree

2 files changed

+121
-131
lines changed

2 files changed

+121
-131
lines changed

.github/workflows/build_tests.yaml

+118-116
Original file line numberDiff line numberDiff line change
@@ -83,142 +83,144 @@ jobs:
8383
python-version: ["3.10", "3.11"]
8484
steps:
8585
- uses: actions/checkout@v4
86-
- uses: google-github-actions/setup-gcloud@v2
87-
with:
88-
version: '>= 363.0.0'
89-
install_components: 'beta, gke-gcloud-auth-plugin'
9086
- uses: actions/setup-python@v5
9187
with:
9288
python-version: ${{ matrix.python-version }}
9389
- name: Check if cache exists
9490
id: check-cache
95-
uses: actions/cache@v3
91+
uses: actions/cache@v4
9692
with:
9793
path: |
98-
usr/local/bin/
94+
/usr/local/bin/kubectl-kueue
95+
/usr/local/bin/kubectl-kjob
9996
~/.cache/pip
10097
${{env.pythonLocation}}
10198
key: xpk-deps-${{ matrix.python-version }}-${{needs.set-variables.outputs.run-id}}
10299
lookup-only: true
100+
- uses: google-github-actions/setup-gcloud@v2
101+
if : steps.check-cache.outputs.cache-hit != 'true'
102+
with:
103+
version: '>= 363.0.0'
104+
install_components: 'beta, gke-gcloud-auth-plugin'
103105
- name: install dependencies
104106
if : steps.check-cache.outputs.cache-hit != 'true'
105107
run: make install-lint && make install-dev
106108
- name: Cache dependencies
107109
if : steps.check-cache.outputs.cache-hit != 'true'
108-
uses: actions/cache/save@v3
110+
uses: actions/cache/save@v4
109111
with:
110112
path: |
111113
/usr/local/bin/kubectl-kueue
112114
/usr/local/bin/kubectl-kjob
113115
~/.cache/pip
114116
${{env.pythonLocation}}
115117
key: xpk-deps-${{ matrix.python-version }}-${{needs.set-variables.outputs.run-id}}
116-
linter:
117-
needs: [install-dependencies, set-variables]
118-
concurrency: # We support one build or nightly test to run at a time currently.
119-
group: linter-${{needs.set-variables.outputs.run-id}}
120-
cancel-in-progress: true
121-
uses: ./.github/workflows/reusable_lint_and_format.yml
122-
with:
123-
run-id: '${{needs.set-variables.outputs.run-id}}'
124-
run-unit-tests:
125-
needs: [install-dependencies, set-variables]
126-
uses: ./.github/workflows/reusable_unit_tests.yaml
127-
with:
128-
run-id: ${{needs.set-variables.outputs.run-id}}
129-
concurrency: # We support one build or nightly test to run at a time currently.
130-
group: unit-tests-${{needs.set-variables.outputs.run-id}}
131-
cancel-in-progress: true
132-
run-integration-tests:
133-
needs: [install-dependencies, set-variables]
134-
uses: ./.github/workflows/reusable_integration_tests.yaml
135-
with:
136-
run-id: '${{needs.set-variables.outputs.run-id}}'
137-
concurrency: # We support one build or nightly test to run at a time currently.
138-
group: integration-tests-${{needs.set-variables.outputs.run-id}}
139-
cancel-in-progress: true
140-
secrets: inherit
141-
cluster-private:
142-
needs: [linter, run-unit-tests, run-integration-tests, set-variables]
143-
uses: ./.github/workflows/reusable_cluster_private.yaml
144-
concurrency: # We support one build or nightly test to run at a time currently.
145-
group: cluster-private-${{needs.set-variables.outputs.run-id}}
146-
cancel-in-progress: true
147-
with:
148-
run-id: '${{needs.set-variables.outputs.run-id}}'
149-
cluster-name: '${{needs.set-variables.outputs.cluster-name}}'
150-
tpu-type: '${{needs.set-variables.outputs.tpu-type || inputs.tpu-type}}'
151-
zone: '${{needs.set-variables.outputs.zone}}'
152-
location: '${{needs.set-variables.outputs.location}}'
153-
secrets: inherit
154-
cluster-create:
155-
needs: [linter, run-unit-tests, run-integration-tests, set-variables]
156-
concurrency: # We support one build or nightly test to run at a time currently.
157-
group: cluster-create-${{needs.set-variables.outputs.run-id}}
158-
cancel-in-progress: true
159-
uses: ./.github/workflows/reusable_cluster_create.yaml
160-
with:
161-
cluster-name: '${{needs.set-variables.outputs.cluster-name}}'
162-
tpu-type: '${{needs.set-variables.outputs.tpu-type || inputs.tpu-type}}'
163-
zone: '${{needs.set-variables.outputs.zone}}'
164-
location: '${{needs.set-variables.outputs.location}}'
165-
run-id: '${{needs.set-variables.outputs.run-id}}'
166-
secrets: inherit
167-
workloads-tests:
168-
needs: [cluster-create, set-variables]
169-
uses: ./.github/workflows/reusable_workload_tests.yaml
170-
concurrency: # We support one build or nightly test to run at a time currently.
171-
group: workload-tests-${{needs.set-variables.outputs.run-id}}
172-
cancel-in-progress: true
173-
with:
174-
cluster-name: ${{needs.set-variables.outputs.cluster-name}}
175-
tpu-type: ${{needs.set-variables.outputs.tpu-type}}
176-
zone: ${{needs.set-variables.outputs.zone}}
177-
run-id: '${{needs.set-variables.outputs.run-id}}'
178-
secrets: inherit
179-
batch-tests:
180-
needs: [cluster-create, set-variables]
181-
uses: ./.github/workflows/reusable_batch_tests.yaml
182-
concurrency: # We support one build or nightly test to run at a time currently.
183-
group: batch-tests-${{needs.set-variables.outputs.run-id}}
184-
cancel-in-progress: true
185-
with:
186-
cluster-name: ${{needs.set-variables.outputs.cluster-name}}
187-
zone: ${{needs.set-variables.outputs.zone}}
188-
run-id: ${{needs.set-variables.outputs.run-id}}
189-
secrets: inherit
190-
filestore-tests:
191-
needs: [cluster-create, set-variables, batch-tests, workloads-tests]
192-
uses: ./.github/workflows/reusable_filestore_tests.yaml
193-
concurrency: # We support one build or nightly test to run at a time currently.
194-
group: filestore-tests-${{needs.set-variables.outputs.run-id}}
195-
cancel-in-progress: true
196-
with:
197-
cluster-name: ${{needs.set-variables.outputs.cluster-name}}
198-
tpu-type: ${{needs.set-variables.outputs.tpu-type}}
199-
zone: ${{needs.set-variables.outputs.zone}}
200-
location: ${{needs.set-variables.outputs.location}}
201-
run-id: ${{needs.set-variables.outputs.run-id}}
202-
secrets: inherit
203-
fuse-tests:
204-
needs: [filestore-tests, set-variables]
205-
uses: ./.github/workflows/reusable_fuse_tests.yaml
206-
concurrency: # We support one build or nightly test to run at a time currently.
207-
group: fuse-tests-${{needs.set-variables.outputs.run-id}}
208-
cancel-in-progress: true
209-
with:
210-
cluster-name: ${{needs.set-variables.outputs.cluster-name}}
211-
tpu-type: ${{needs.set-variables.outputs.tpu-type}}
212-
zone: ${{needs.set-variables.outputs.zone}}
213-
location: ${{needs.set-variables.outputs.location}}
214-
run-id: ${{needs.set-variables.outputs.run-id}}
215-
secrets: inherit
216-
cluster-delete:
217-
if: always()
218-
needs: [set-variables, fuse-tests]
219-
uses: ./.github/workflows/reusable_cluster_delete.yaml
220-
with:
221-
cluster-name: ${{needs.set-variables.outputs.cluster-name}}
222-
run-id: ${{needs.set-variables.outputs.run-id}}
223-
zone: ${{needs.set-variables.outputs.zone}}
224-
secrets: inherit
118+
# linter:
119+
# needs: [install-dependencies, set-variables]
120+
# concurrency: # We support one build or nightly test to run at a time currently.
121+
# group: linter-${{needs.set-variables.outputs.run-id}}
122+
# cancel-in-progress: true
123+
# uses: ./.github/workflows/reusable_lint_and_format.yml
124+
# with:
125+
# run-id: '${{needs.set-variables.outputs.run-id}}'
126+
# run-unit-tests:
127+
# needs: [install-dependencies, set-variables]
128+
# uses: ./.github/workflows/reusable_unit_tests.yaml
129+
# with:
130+
# run-id: ${{needs.set-variables.outputs.run-id}}
131+
# concurrency: # We support one build or nightly test to run at a time currently.
132+
# group: unit-tests-${{needs.set-variables.outputs.run-id}}
133+
# cancel-in-progress: true
134+
# run-integration-tests:
135+
# needs: [install-dependencies, set-variables]
136+
# uses: ./.github/workflows/reusable_integration_tests.yaml
137+
# with:
138+
# run-id: '${{needs.set-variables.outputs.run-id}}'
139+
# concurrency: # We support one build or nightly test to run at a time currently.
140+
# group: integration-tests-${{needs.set-variables.outputs.run-id}}
141+
# cancel-in-progress: true
142+
# secrets: inherit
143+
# cluster-private:
144+
# needs: [linter, run-unit-tests, run-integration-tests, set-variables]
145+
# uses: ./.github/workflows/reusable_cluster_private.yaml
146+
# concurrency: # We support one build or nightly test to run at a time currently.
147+
# group: cluster-private-${{needs.set-variables.outputs.run-id}}
148+
# cancel-in-progress: true
149+
# with:
150+
# run-id: '${{needs.set-variables.outputs.run-id}}'
151+
# cluster-name: '${{needs.set-variables.outputs.cluster-name}}'
152+
# tpu-type: '${{needs.set-variables.outputs.tpu-type || inputs.tpu-type}}'
153+
# zone: '${{needs.set-variables.outputs.zone}}'
154+
# location: '${{needs.set-variables.outputs.location}}'
155+
# secrets: inherit
156+
# cluster-create:
157+
# needs: [linter, run-unit-tests, run-integration-tests, set-variables]
158+
# concurrency: # We support one build or nightly test to run at a time currently.
159+
# group: cluster-create-${{needs.set-variables.outputs.run-id}}
160+
# cancel-in-progress: true
161+
# uses: ./.github/workflows/reusable_cluster_create.yaml
162+
# with:
163+
# cluster-name: '${{needs.set-variables.outputs.cluster-name}}'
164+
# tpu-type: '${{needs.set-variables.outputs.tpu-type || inputs.tpu-type}}'
165+
# zone: '${{needs.set-variables.outputs.zone}}'
166+
# location: '${{needs.set-variables.outputs.location}}'
167+
# run-id: '${{needs.set-variables.outputs.run-id}}'
168+
# secrets: inherit
169+
# workloads-tests:
170+
# needs: [cluster-create, set-variables]
171+
# uses: ./.github/workflows/reusable_workload_tests.yaml
172+
# concurrency: # We support one build or nightly test to run at a time currently.
173+
# group: workload-tests-${{needs.set-variables.outputs.run-id}}
174+
# cancel-in-progress: true
175+
# with:
176+
# cluster-name: ${{needs.set-variables.outputs.cluster-name}}
177+
# tpu-type: ${{needs.set-variables.outputs.tpu-type}}
178+
# zone: ${{needs.set-variables.outputs.zone}}
179+
# run-id: '${{needs.set-variables.outputs.run-id}}'
180+
# secrets: inherit
181+
# batch-tests:
182+
# needs: [cluster-create, set-variables]
183+
# uses: ./.github/workflows/reusable_batch_tests.yaml
184+
# concurrency: # We support one build or nightly test to run at a time currently.
185+
# group: batch-tests-${{needs.set-variables.outputs.run-id}}
186+
# cancel-in-progress: true
187+
# with:
188+
# cluster-name: ${{needs.set-variables.outputs.cluster-name}}
189+
# zone: ${{needs.set-variables.outputs.zone}}
190+
# run-id: ${{needs.set-variables.outputs.run-id}}
191+
# secrets: inherit
192+
# filestore-tests:
193+
# needs: [cluster-create, set-variables, batch-tests, workloads-tests]
194+
# uses: ./.github/workflows/reusable_filestore_tests.yaml
195+
# concurrency: # We support one build or nightly test to run at a time currently.
196+
# group: filestore-tests-${{needs.set-variables.outputs.run-id}}
197+
# cancel-in-progress: true
198+
# with:
199+
# cluster-name: ${{needs.set-variables.outputs.cluster-name}}
200+
# tpu-type: ${{needs.set-variables.outputs.tpu-type}}
201+
# zone: ${{needs.set-variables.outputs.zone}}
202+
# location: ${{needs.set-variables.outputs.location}}
203+
# run-id: ${{needs.set-variables.outputs.run-id}}
204+
# secrets: inherit
205+
# fuse-tests:
206+
# needs: [filestore-tests, set-variables]
207+
# uses: ./.github/workflows/reusable_fuse_tests.yaml
208+
# concurrency: # We support one build or nightly test to run at a time currently.
209+
# group: fuse-tests-${{needs.set-variables.outputs.run-id}}
210+
# cancel-in-progress: true
211+
# with:
212+
# cluster-name: ${{needs.set-variables.outputs.cluster-name}}
213+
# tpu-type: ${{needs.set-variables.outputs.tpu-type}}
214+
# zone: ${{needs.set-variables.outputs.zone}}
215+
# location: ${{needs.set-variables.outputs.location}}
216+
# run-id: ${{needs.set-variables.outputs.run-id}}
217+
# secrets: inherit
218+
# cluster-delete:
219+
# if: always()
220+
# needs: [set-variables, fuse-tests]
221+
# uses: ./.github/workflows/reusable_cluster_delete.yaml
222+
# with:
223+
# cluster-name: ${{needs.set-variables.outputs.cluster-name}}
224+
# run-id: ${{needs.set-variables.outputs.run-id}}
225+
# zone: ${{needs.set-variables.outputs.zone}}
226+
# secrets: inherit

.github/workflows/cleanup.yaml

+3-15
Original file line numberDiff line numberDiff line change
@@ -23,19 +23,7 @@ jobs:
2323
runs-on: ubuntu-latest
2424
steps:
2525
- name: Cleanup
26-
run: |
27-
echo "Fetching list of cache key"
28-
cacheKeysForPR=$(gh cache list --ref $BRANCH --limit 100 --json id --jq '.[].id')
29-
30-
## Setting this to not fail the workflow while deleting cache keys.
31-
set +e
32-
echo "Deleting caches..."
33-
for cacheKey in $cacheKeysForPR
34-
do
35-
gh cache delete $cacheKey
36-
done
37-
echo "Done"
3826
env:
39-
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
40-
GH_REPO: ${{ github.repository }}
41-
BRANCH: refs/pull/${{ github.event.pull_request.number }}/merge
27+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
28+
BRANCH: refs/pull/${{ github.event.number }}/merge
29+
run: gh cache list --ref $BRANCH --json id --jq '.[].id' | xargs -I {} gh cache delete {}

0 commit comments

Comments
 (0)