Skip to content

Commit 0c59ece

Browse files
committed
Fix cleanup workflow.
1 parent 9b9919b commit 0c59ece

File tree

2 files changed

+125
-134
lines changed

2 files changed

+125
-134
lines changed

.github/workflows/build_tests.yaml

Lines changed: 122 additions & 119 deletions
Original file line numberDiff line numberDiff line change
@@ -82,143 +82,146 @@ jobs:
8282
matrix:
8383
python-version: ["3.10", "3.11"]
8484
steps:
85-
- 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'
90-
- uses: actions/setup-python@v5
91-
with:
92-
python-version: ${{ matrix.python-version }}
9385
- name: Check if cache exists
9486
id: check-cache
95-
uses: actions/cache@v3
87+
uses: actions/cache@v4
9688
with:
9789
path: |
9890
usr/local/bin/
9991
~/.cache/pip
10092
${{env.pythonLocation}}
10193
key: xpk-deps-${{ matrix.python-version }}-${{needs.set-variables.outputs.run-id}}
10294
lookup-only: true
95+
- uses: actions/checkout@v4
96+
if : steps.check-cache.outputs.cache-hit != 'true'
97+
- uses: google-github-actions/setup-gcloud@v2
98+
if : steps.check-cache.outputs.cache-hit != 'true'
99+
with:
100+
version: '>= 363.0.0'
101+
install_components: 'beta, gke-gcloud-auth-plugin'
102+
- uses: actions/setup-python@v5
103+
if : steps.check-cache.outputs.cache-hit != 'true'
104+
with:
105+
python-version: ${{ matrix.python-version }}
103106
- name: install dependencies
104107
if : steps.check-cache.outputs.cache-hit != 'true'
105108
run: make install-lint && make install-dev
106109
- name: Cache dependencies
107110
if : steps.check-cache.outputs.cache-hit != 'true'
108-
uses: actions/cache/save@v3
111+
uses: actions/cache/save@v4
109112
with:
110113
path: |
111114
/usr/local/bin/kubectl-kueue
112115
/usr/local/bin/kubectl-kjob
113116
~/.cache/pip
114117
${{env.pythonLocation}}
115118
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
119+
# linter:
120+
# needs: [install-dependencies, set-variables]
121+
# concurrency: # We support one build or nightly test to run at a time currently.
122+
# group: linter-${{needs.set-variables.outputs.run-id}}
123+
# cancel-in-progress: true
124+
# uses: ./.github/workflows/reusable_lint_and_format.yml
125+
# with:
126+
# run-id: '${{needs.set-variables.outputs.run-id}}'
127+
# run-unit-tests:
128+
# needs: [install-dependencies, set-variables]
129+
# uses: ./.github/workflows/reusable_unit_tests.yaml
130+
# with:
131+
# run-id: ${{needs.set-variables.outputs.run-id}}
132+
# concurrency: # We support one build or nightly test to run at a time currently.
133+
# group: unit-tests-${{needs.set-variables.outputs.run-id}}
134+
# cancel-in-progress: true
135+
# run-integration-tests:
136+
# needs: [install-dependencies, set-variables]
137+
# uses: ./.github/workflows/reusable_integration_tests.yaml
138+
# with:
139+
# run-id: '${{needs.set-variables.outputs.run-id}}'
140+
# concurrency: # We support one build or nightly test to run at a time currently.
141+
# group: integration-tests-${{needs.set-variables.outputs.run-id}}
142+
# cancel-in-progress: true
143+
# secrets: inherit
144+
# cluster-private:
145+
# needs: [linter, run-unit-tests, run-integration-tests, set-variables]
146+
# uses: ./.github/workflows/reusable_cluster_private.yaml
147+
# concurrency: # We support one build or nightly test to run at a time currently.
148+
# group: cluster-private-${{needs.set-variables.outputs.run-id}}
149+
# cancel-in-progress: true
150+
# with:
151+
# run-id: '${{needs.set-variables.outputs.run-id}}'
152+
# cluster-name: '${{needs.set-variables.outputs.cluster-name}}'
153+
# tpu-type: '${{needs.set-variables.outputs.tpu-type || inputs.tpu-type}}'
154+
# zone: '${{needs.set-variables.outputs.zone}}'
155+
# location: '${{needs.set-variables.outputs.location}}'
156+
# secrets: inherit
157+
# cluster-create:
158+
# needs: [linter, run-unit-tests, run-integration-tests, set-variables]
159+
# concurrency: # We support one build or nightly test to run at a time currently.
160+
# group: cluster-create-${{needs.set-variables.outputs.run-id}}
161+
# cancel-in-progress: true
162+
# uses: ./.github/workflows/reusable_cluster_create.yaml
163+
# with:
164+
# cluster-name: '${{needs.set-variables.outputs.cluster-name}}'
165+
# tpu-type: '${{needs.set-variables.outputs.tpu-type || inputs.tpu-type}}'
166+
# zone: '${{needs.set-variables.outputs.zone}}'
167+
# location: '${{needs.set-variables.outputs.location}}'
168+
# run-id: '${{needs.set-variables.outputs.run-id}}'
169+
# secrets: inherit
170+
# workloads-tests:
171+
# needs: [cluster-create, set-variables]
172+
# uses: ./.github/workflows/reusable_workload_tests.yaml
173+
# concurrency: # We support one build or nightly test to run at a time currently.
174+
# group: workload-tests-${{needs.set-variables.outputs.run-id}}
175+
# cancel-in-progress: true
176+
# with:
177+
# cluster-name: ${{needs.set-variables.outputs.cluster-name}}
178+
# tpu-type: ${{needs.set-variables.outputs.tpu-type}}
179+
# zone: ${{needs.set-variables.outputs.zone}}
180+
# run-id: '${{needs.set-variables.outputs.run-id}}'
181+
# secrets: inherit
182+
# batch-tests:
183+
# needs: [cluster-create, set-variables]
184+
# uses: ./.github/workflows/reusable_batch_tests.yaml
185+
# concurrency: # We support one build or nightly test to run at a time currently.
186+
# group: batch-tests-${{needs.set-variables.outputs.run-id}}
187+
# cancel-in-progress: true
188+
# with:
189+
# cluster-name: ${{needs.set-variables.outputs.cluster-name}}
190+
# zone: ${{needs.set-variables.outputs.zone}}
191+
# run-id: ${{needs.set-variables.outputs.run-id}}
192+
# secrets: inherit
193+
# filestore-tests:
194+
# needs: [cluster-create, set-variables, batch-tests, workloads-tests]
195+
# uses: ./.github/workflows/reusable_filestore_tests.yaml
196+
# concurrency: # We support one build or nightly test to run at a time currently.
197+
# group: filestore-tests-${{needs.set-variables.outputs.run-id}}
198+
# cancel-in-progress: true
199+
# with:
200+
# cluster-name: ${{needs.set-variables.outputs.cluster-name}}
201+
# tpu-type: ${{needs.set-variables.outputs.tpu-type}}
202+
# zone: ${{needs.set-variables.outputs.zone}}
203+
# location: ${{needs.set-variables.outputs.location}}
204+
# run-id: ${{needs.set-variables.outputs.run-id}}
205+
# secrets: inherit
206+
# fuse-tests:
207+
# needs: [filestore-tests, set-variables]
208+
# uses: ./.github/workflows/reusable_fuse_tests.yaml
209+
# concurrency: # We support one build or nightly test to run at a time currently.
210+
# group: fuse-tests-${{needs.set-variables.outputs.run-id}}
211+
# cancel-in-progress: true
212+
# with:
213+
# cluster-name: ${{needs.set-variables.outputs.cluster-name}}
214+
# tpu-type: ${{needs.set-variables.outputs.tpu-type}}
215+
# zone: ${{needs.set-variables.outputs.zone}}
216+
# location: ${{needs.set-variables.outputs.location}}
217+
# run-id: ${{needs.set-variables.outputs.run-id}}
218+
# secrets: inherit
219+
# cluster-delete:
220+
# if: always()
221+
# needs: [set-variables, fuse-tests]
222+
# uses: ./.github/workflows/reusable_cluster_delete.yaml
223+
# with:
224+
# cluster-name: ${{needs.set-variables.outputs.cluster-name}}
225+
# run-id: ${{needs.set-variables.outputs.run-id}}
226+
# zone: ${{needs.set-variables.outputs.zone}}
227+
# secrets: inherit

.github/workflows/cleanup.yaml

Lines changed: 3 additions & 15 deletions
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)