Skip to content

Commit 15e026f

Browse files
authored
Merge pull request #12 from Vickydew1/main
Updated action.yaml and FIxed skip_sonar_scan flag
2 parents 632956e + fe4a0de commit 15e026f

File tree

1 file changed

+31
-18
lines changed

1 file changed

+31
-18
lines changed

action.yaml

Lines changed: 31 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -1,39 +1,39 @@
11
name: "AccuKnox SQ-SAST Scanner"
22
description: "Run SonarQube-based SAST scan and upload results to AccuKnox Panel."
33

4-
branding:
5-
icon: "shield"
4+
branding:
5+
icon: "shield"
66
color: "purple"
77

88
inputs:
99
skip_sonar_scan:
10-
description: 'Whether to skip the SonarQube scan.'
10+
description: "Whether to skip the SonarQube scan."
1111
required: false
12-
default: 'false'
12+
default: "false"
1313
sonar_project_key:
14-
description: 'SonarQube project key'
14+
description: "SonarQube project key"
1515
required: true
1616
sonar_org_id:
17-
description: 'SonarQube organisation ID (cloud only)'
17+
description: "SonarQube organisation ID (cloud only)"
1818
required: false
1919
sonar_token:
20-
description: 'SonarQube authentication token'
20+
description: "SonarQube authentication token"
2121
required: true
2222
sonar_host_url:
23-
description: 'SonarQube host URL'
23+
description: "SonarQube host URL"
2424
required: true
2525
soft_fail:
26-
description: 'Do not fail the pipeline if scan finds issues'
26+
description: "Do not fail the pipeline if scan finds issues"
2727
required: false
28-
default: 'false'
28+
default: "false"
2929
accuknox_endpoint:
30-
description: 'AccuKnox CSPM panel endpoint URL'
30+
description: "AccuKnox CSPM panel endpoint URL"
3131
required: true
3232
accuknox_token:
33-
description: 'AccuKnox authentication token'
33+
description: "AccuKnox authentication token"
3434
required: true
3535
accuknox_label:
36-
description: 'Label for associating scan results in AccuKnox'
36+
description: "Label for associating scan results in AccuKnox"
3737
required: true
3838

3939
runs:
@@ -51,7 +51,11 @@ runs:
5151
ACCUKNOX_ENDPOINT: ${{ inputs.accuknox_endpoint }}
5252
ACCUKNOX_TOKEN: ${{ inputs.accuknox_token }}
5353
ACCUKNOX_LABEL: ${{ inputs.accuknox_label }}
54+
5455
run: |
56+
echo "🔹 Starting AccuKnox SQ-SAST Scan..."
57+
58+
# Normalise soft fail flag
5559
SOFT_FAIL="${SOFT_FAIL//[$'\t\r\n ']}"
5660
SOFT_FAIL_ARG=""
5761
if [ "$SOFT_FAIL" = "true" ]; then
@@ -62,18 +66,27 @@ runs:
6266
curl -L https://github.com/accuknox/aspm-scanner-cli/releases/download/v0.13.4/accuknox-aspm-scanner -o accuknox-aspm-scanner
6367
chmod +x accuknox-aspm-scanner
6468
65-
# Build SonarQube command string
69+
# Build SonarQube properties (no skip flag here)
6670
CMD_ARGS="-Dsonar.projectKey=$SONAR_PROJECT_KEY \
6771
-Dsonar.token=$SONAR_TOKEN \
6872
-Dsonar.host.url=$SONAR_HOST_URL \
6973
-Dsonar.qualitygate.wait=true"
7074
75+
# Add optional org id
7176
[ -n "$SONAR_ORG_ID" ] && CMD_ARGS="$CMD_ARGS -Dsonar.organization=$SONAR_ORG_ID"
72-
[ "$SKIP_SONAR_SCAN" = "true" ] && CMD_ARGS="--skip-sonar-scan $CMD_ARGS"
7377
74-
# Run the scanner (AccuKnox env variables now used instead of CLI args)
75-
echo "./accuknox-aspm-scanner scan $SOFT_FAIL_ARG sq-sast --command \"$CMD_ARGS\" --repo-url \"$GITHUB_REPOSITORY\" --branch \"${GITHUB_REF#refs/heads/}\" --commit-sha \"$GITHUB_SHA\" --pipeline-url \"$GITHUB_SERVER_URL/$GITHUB_REPOSITORY/actions/runs/$GITHUB_RUN_ID\" --container-mode"
76-
./accuknox-aspm-scanner scan $SOFT_FAIL_ARG sq-sast --command "$CMD_ARGS" \
78+
# Add optional --skip-sonar-scan flag OUTSIDE the command string
79+
SKIP_FLAG=""
80+
if [ "$SKIP_SONAR_SCAN" = "true" ]; then
81+
SKIP_FLAG="--skip-sonar-scan"
82+
fi
83+
84+
echo "Executing scan with parameters:"
85+
echo "SOFT_FAIL_ARG: $SOFT_FAIL_ARG"
86+
echo "CMD_ARGS: $CMD_ARGS"
87+
88+
./accuknox-aspm-scanner scan $SOFT_FAIL_ARG sq-sast $SKIP_FLAG \
89+
--command "$CMD_ARGS" \
7790
--repo-url "$GITHUB_REPOSITORY" \
7891
--branch "${GITHUB_REF#refs/heads/}" \
7992
--commit-sha "$GITHUB_SHA" \

0 commit comments

Comments
 (0)