File tree 3 files changed +45
-1
lines changed
actions/upload_failure_logs_if_exists
3 files changed +45
-1
lines changed Original file line number Diff line number Diff line change
1
+ name : ' upload failure-logs if exists'
2
+ description : ' upload failure-logs if exists'
3
+ inputs :
4
+ suffix :
5
+ description : suffix to append to the name of the artifact
6
+ required : false
7
+ default : ' '
8
+ runs :
9
+ using : " composite"
10
+ steps :
11
+ - name : " Check if failure-logs exists"
12
+ if : always()
13
+ id : check-if-failure-logs-exists
14
+ run : echo "exists=$([ -d "failure-logs" ] && echo "true" || echo "false")" >> "$GITHUB_OUTPUT"
15
+ shell : bash
16
+ - id : normalize-suffix
17
+ # To avoid using special characters in artifact name, normalize the suffix
18
+ if : steps.check-if-failure-logs-exists.outputs.exists == 'true'
19
+ run : |
20
+ suffix="${{ inputs.suffix }}"
21
+ suffix="${suffix//[^a-zA-Z0-9_]/_}"
22
+ suffix="${suffix:+-$suffix}"
23
+ echo "result=$suffix" >> "$GITHUB_OUTPUT"
24
+ shell : bash
25
+ - name : " Upload failure-logs"
26
+ if : steps.check-if-failure-logs-exists.outputs.exists == 'true'
27
+ uses : actions/upload-artifact@v4
28
+ with :
29
+ name : failure-logs-${{ github.job }}${{ steps.normalize-suffix.outputs.result }}
30
+ path : failure-logs/
Original file line number Diff line number Diff line change @@ -194,6 +194,8 @@ jobs:
194
194
# GHA macOS is slow and flaky, so we only test default.yaml here.
195
195
# Other yamls are tested on Linux instances.
196
196
#
197
+ - if : always()
198
+ uses : ./.github/actions/upload_failure_logs_if_exists
197
199
- name : " Show cache"
198
200
if : always()
199
201
run : ./hack/debug-cache.sh
@@ -258,6 +260,10 @@ jobs:
258
260
retry_on : error
259
261
max_attempts : 3
260
262
command : ./hack/test-templates.sh templates/${{ matrix.template }}
263
+ - if : always()
264
+ uses : ./.github/actions/upload_failure_logs_if_exists
265
+ with :
266
+ suffix : ${{ matrix.template }}
261
267
- name : " Show cache"
262
268
run : ./hack/debug-cache.sh
263
269
@@ -357,6 +363,8 @@ jobs:
357
363
retry_on : error
358
364
max_attempts : 3
359
365
command : ./hack/test-templates.sh templates/vmnet.yaml
366
+ - if : always()
367
+ uses : ./.github/actions/upload_failure_logs_if_exists
360
368
361
369
upgrade :
362
370
name : " Upgrade test"
@@ -425,3 +433,7 @@ jobs:
425
433
env :
426
434
LIMACTL_CREATE_ARGS : " --vm-type vz --mount-type virtiofs --rosetta --network vzNAT"
427
435
run : ./hack/test-templates.sh templates/${{ matrix.template }}
436
+ - if : failure()
437
+ uses : ./.github/actions/upload_failure_logs_if_exists
438
+ with :
439
+ suffix : ${{ matrix.template }}
Original file line number Diff line number Diff line change @@ -97,7 +97,9 @@ function diagnose() {
97
97
tail " $HOME /.lima/${NAME} " /* .log
98
98
limactl shell " $NAME " systemctl --no-pager status
99
99
limactl shell " $NAME " systemctl --no-pager
100
- limactl shell " $NAME " sudo cat /var/log/cloud-init-output.log
100
+ mkdir -p failure-logs
101
+ cp -pf " $HOME /.lima/${NAME} " /* .log failure-logs/
102
+ limactl shell " $NAME " sudo cat /var/log/cloud-init-output.log | tee failure-logs/cloud-init-output.log
101
103
set +x -e
102
104
}
103
105
You can’t perform that action at this time.
0 commit comments