Skip to content

Commit 557f558

Browse files
committed
fix(ci): use 'sonar analyze --save' directly; agent-scan was a deleted skill-shell wrapper
The self-scan + parity workflows invoked '$SONAR_PREDICTOR_HOME/bin/sonar agent-scan analyze .', but 'agent-scan' was never a CLI subcommand — it was a shell function defined inside the OLD plugin/skills/sonar-predictor/bin/sonar wrapper that this branch deletes. The new distribution's bin/sonar is a thin pass-through to the Java CLI, so the call now errors: Unmatched argument at index 0: 'agent-scan' Did you mean: sonar analyze? Replace with the equivalent direct invocation: sonar --format json --save .sonar-predictor/scan.json analyze . --coverage <jacoco.xml> --save was already a global option on the CLI (visible in sonar --help) — it captures the same JSON the old wrapper redirected to scan.json. The downstream Render scan summary / Quality gate / Upload artifact steps in both workflows already read .sonar-predictor/scan.json, so no change needed there.
1 parent 2c792c2 commit 557f558

2 files changed

Lines changed: 13 additions & 11 deletions

File tree

.github/workflows/parity.yml

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -114,8 +114,10 @@ jobs:
114114
run: |
115115
set +e
116116
export SONAR_PREDICTOR_HOME="$(pwd)/target/sonar-predictor-dist-${{ steps.version.outputs.version }}/sonar-predictor"
117-
"$SONAR_PREDICTOR_HOME/bin/sonar" agent-scan analyze . \
118-
--coverage target/site/jacoco/jacoco.xml
117+
mkdir -p .sonar-predictor
118+
"$SONAR_PREDICTOR_HOME/bin/sonar" \
119+
--format json --save .sonar-predictor/scan.json \
120+
analyze . --coverage target/site/jacoco/jacoco.xml
119121
rc=$?
120122
set -e
121123
echo "Self-scan exit code: $rc (0=clean, 1=issues found, 2+=tool error)"

.github/workflows/sonar.yml

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -84,13 +84,11 @@ jobs:
8484
echo "version=${VERSION}" >> "$GITHUB_OUTPUT"
8585
echo "Project version: ${VERSION}"
8686
87-
# The actual self-scan. We override SONAR_PREDICTOR_HOME so the wrapper
88-
# script picks up THIS branch's freshly-built daemon jar and analyzer
89-
# plugins from the assembly's exploded staging directory, not whatever
90-
# happens to be installed globally. One JaCoCo XML is passed in as
91-
# coverage evidence (single module = one report). agent-scan writes
92-
# JSON to .sonar-predictor/scan.json and prints a human summary on
93-
# stdout; we want both.
87+
# The actual self-scan. We point bin/sonar at THIS branch's
88+
# freshly-built distribution under target/ (not whatever happens to
89+
# be installed globally), and capture the scan as JSON to
90+
# .sonar-predictor/scan.json via --save. One JaCoCo XML is passed
91+
# in as coverage evidence (single module = one report).
9492
#
9593
# IMPORTANT: the CLI uses three-state exit codes
9694
# 0 = clean (no findings at the floor)
@@ -104,8 +102,10 @@ jobs:
104102
run: |
105103
set +e
106104
export SONAR_PREDICTOR_HOME="$(pwd)/target/sonar-predictor-dist-${{ steps.version.outputs.version }}/sonar-predictor"
107-
"$SONAR_PREDICTOR_HOME/bin/sonar" agent-scan analyze . \
108-
--coverage target/site/jacoco/jacoco.xml
105+
mkdir -p .sonar-predictor
106+
"$SONAR_PREDICTOR_HOME/bin/sonar" \
107+
--format json --save .sonar-predictor/scan.json \
108+
analyze . --coverage target/site/jacoco/jacoco.xml
109109
rc=$?
110110
set -e
111111
echo "Self-scan exit code: $rc (0=clean, 1=issues found, 2+=tool error)"

0 commit comments

Comments
 (0)