Skip to content

Commit 2963c23

Browse files
ci: harden Remove Snapshots step against silent failure
From a Gemini CI review: `find ... | xargs rm -rf` masks a find failure (xargs exits 0 on empty stdin), and GNU xargs also runs `rm` once with no operands on empty input. Add `set -o pipefail` so a find failure fails the step, and `xargs -r` so rm is skipped when there is nothing to remove. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
1 parent f15d3c3 commit 2963c23

1 file changed

Lines changed: 9 additions & 3 deletions

File tree

‎.github/workflows/ci.yml‎

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,9 @@ jobs:
5656
- name: Build
5757
run: mvn -B -e -Papache-release -Dgpg.skip=true -Dmaven.compiler.release=${{ matrix.java }} verify
5858
- name: Remove Snapshots
59-
run: find ~/.m2/repository -name '*-SNAPSHOT' -a -type d -print0 | xargs -0 rm -rf
59+
run: |
60+
set -o pipefail
61+
find ~/.m2/repository -name '*-SNAPSHOT' -a -type d -print0 | xargs -0 -r rm -rf
6062
site:
6163
name: Site
6264
runs-on: ubuntu-24.04
@@ -79,7 +81,9 @@ jobs:
7981
- name: Build
8082
run: mvn -B -e -Dmaven.test.skip=true -Dmaven.compiler.release=${{ env.BASE_JAVA_VERSION }} package site-deploy
8183
- name: Remove Snapshots
82-
run: find ~/.m2/repository -name '*-SNAPSHOT' -a -type d -print0 | xargs -0 rm -rf
84+
run: |
85+
set -o pipefail
86+
find ~/.m2/repository -name '*-SNAPSHOT' -a -type d -print0 | xargs -0 -r rm -rf
8387
deploy:
8488
if: github.event_name == 'push' && github.ref == 'refs/heads/master' && github.repository == 'apache/axis-axis2-java-core'
8589
name: Deploy
@@ -112,4 +116,6 @@ jobs:
112116
NEXUS_USER: ${{ secrets.NEXUS_USER }}
113117
NEXUS_PW: ${{ secrets.NEXUS_PW }}
114118
- name: Remove Snapshots
115-
run: find ~/.m2/repository -name '*-SNAPSHOT' -a -type d -print0 | xargs -0 rm -rf
119+
run: |
120+
set -o pipefail
121+
find ~/.m2/repository -name '*-SNAPSHOT' -a -type d -print0 | xargs -0 -r rm -rf

0 commit comments

Comments
 (0)