File tree Expand file tree Collapse file tree 3 files changed +45
-1
lines changed
actions/upload_failure_logs_if_exists Expand file tree Collapse file tree 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:
194194 # GHA macOS is slow and flaky, so we only test default.yaml here.
195195 # Other yamls are tested on Linux instances.
196196 #
197+ - if : always()
198+ uses : ./.github/actions/upload_failure_logs_if_exists
197199 - name : " Show cache"
198200 if : always()
199201 run : ./hack/debug-cache.sh
@@ -258,6 +260,10 @@ jobs:
258260 retry_on : error
259261 max_attempts : 3
260262 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 }}
261267 - name : " Show cache"
262268 run : ./hack/debug-cache.sh
263269
@@ -357,6 +363,8 @@ jobs:
357363 retry_on : error
358364 max_attempts : 3
359365 command : ./hack/test-templates.sh templates/vmnet.yaml
366+ - if : always()
367+ uses : ./.github/actions/upload_failure_logs_if_exists
360368
361369 upgrade :
362370 name : " Upgrade test"
@@ -425,3 +433,7 @@ jobs:
425433 env :
426434 LIMACTL_CREATE_ARGS : " --vm-type vz --mount-type virtiofs --rosetta --network vzNAT"
427435 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() {
9797 tail " $HOME /.lima/${NAME} " /* .log
9898 limactl shell " $NAME " systemctl --no-pager status
9999 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
101103 set +x -e
102104}
103105
You can’t perform that action at this time.
0 commit comments