Skip to content

Commit e0ff60b

Browse files
committed
Check Run Update for pipeline scan action
1 parent ba3c3ac commit e0ff60b

8 files changed

+68
-47
lines changed

.github/workflows/binary-ready-veracode-sast-pipeline-scan.yml

Lines changed: 30 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ jobs:
3030
steps:
3131
- name: Verify Veracode API credentials
3232
id: verify_api_creds
33-
uses: veracode/[email protected].7
33+
uses: veracode/[email protected].8
3434
with:
3535
action: validateVeracodeApiCreds
3636
token: ${{ github.event.client_payload.token }}
@@ -43,7 +43,7 @@ jobs:
4343
- name: Verify Policy name
4444
id: verify_policy_name
4545
if: success()
46-
uses: veracode/[email protected].7
46+
uses: veracode/[email protected].8
4747
with:
4848
action: validatePolicyName
4949
token: ${{ github.event.client_payload.token }}
@@ -119,7 +119,7 @@ jobs:
119119
- name: Veracode Pipeline-Scan
120120
if: always()
121121
id: pipeline-scan
122-
uses: veracode/[email protected].18
122+
uses: veracode/[email protected].19
123123
with:
124124
vid: ${{ secrets.VERACODE_API_ID }}
125125
vkey: ${{ secrets.VERACODE_API_KEY }}
@@ -133,11 +133,12 @@ jobs:
133133
filtered_json_output_file: ${{ strategy.job-index }}-filtered_results.json
134134
artifact_name: ${{ matrix.file }}
135135
debug: 1
136+
workflow_app: true
136137

137138
- name: Veracode Pipeline Results
138139
if: always()
139140
id: prepare-results
140-
uses: veracode/[email protected].7
141+
uses: veracode/[email protected].8
141142
with:
142143
action: 'preparePipelineResults'
143144
token: ${{ github.event.client_payload.token }}
@@ -178,23 +179,33 @@ jobs:
178179
needs: pipeline_scan
179180
if: always()
180181
steps:
181-
- name: Update cxheck
182-
id: update_check_status
183-
shell: bash
184-
run: |
185-
# Convert JSON string to a proper format for jq processing
186-
echo '${{ toJSON(needs) }}' | jq -c 'to_entries[]' | while read -r job; do
187-
status=$(echo "$job" | jq -r '.value.result')
188-
if [ "$status" = "success" ]; then
189-
echo "Job scuccess no need to update"
190-
success_count=$((success_count + 1))
191-
elif [ "$status" = "failure" ]; then
192-
echo "Jobs failed - need checks update"
193-
echo '{"status": "completed", "conclusion": "failure"}' > payload.txt
182+
- name: Update check
183+
id: update_check_status
184+
shell: bash
185+
env:
186+
BREAK_BUILD_ON_ERROR: ${{ github.event.client_payload.user_config.break_build_on_error }}
187+
BREAK_BUILD_ON_POLICY: ${{ github.event.client_payload.user_config.break_build_policy_findings }}
188+
run: |
189+
success_count=0
190+
conclusion="failure"
191+
# Convert JSON string to a proper format for jq processing
192+
echo '${{ toJSON(needs) }}' | jq -c 'to_entries[]' | while read -r job; do
193+
status=$(echo "$job" | jq -r '.value.result')
194+
echo "$status"
195+
if [ "$status" = "success" ]; then
196+
success_count=$((success_count + 1))
197+
echo '{"status": "completed", "conclusion": "success"}' > payload.txt
198+
elif [ "$status" = "failure" ]; then
199+
if [ "$BREAK_BUILD_ON_ERROR" = "false" && "$BREAK_BUILD_ON_POLICY" = "false" ]; then
200+
echo '{"status": "completed", "conclusion": "success"}' > payload.txt
201+
else
202+
echo '{"status": "completed", "conclusion": "failure"}' > payload.txt
203+
fi
204+
fi
194205
curl -X PATCH \
195206
-H "Authorization: Bearer ${{ github.event.client_payload.token }}" \
196207
-H "Accept: application/vnd.github+json" \
197208
https://api.github.com/repos/${{ github.event.client_payload.repository.owner }}/${{ github.event.client_payload.repository.name }}/check-runs/${{ needs.register.outputs.run_id }} \
198209
-d @"payload.txt"
199-
fi
200-
done
210+
done
211+

.github/workflows/binary-ready-veracode-sast-policy-scan.yml

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ jobs:
3030
steps:
3131
- name: Verify Veracode API credentials
3232
id: verify_api_creds
33-
uses: veracode/[email protected].7
33+
uses: veracode/[email protected].8
3434
with:
3535
action: validateVeracodeApiCreds
3636
token: ${{ github.event.client_payload.token }}
@@ -43,7 +43,7 @@ jobs:
4343
- name: Verify Policy name
4444
id: verify_policy_name
4545
if: success()
46-
uses: veracode/[email protected].7
46+
uses: veracode/[email protected].8
4747
with:
4848
action: validatePolicyName
4949
token: ${{ github.event.client_payload.token }}
@@ -90,7 +90,7 @@ jobs:
9090
- name: Veracode Policy Results
9191
id: prepare-results
9292
if: always()
93-
uses: veracode/[email protected].7
93+
uses: veracode/[email protected].8
9494
with:
9595
action: 'preparePolicyResults'
9696
token: ${{ github.event.client_payload.token }}
@@ -109,7 +109,7 @@ jobs:
109109
if: ${{ github.event.client_payload.user_config.sandbox_scan.execute_remove_sandbox_action && always() }}
110110
name: Remove Sandbox
111111
steps:
112-
- uses: veracode/[email protected].7
112+
- uses: veracode/[email protected].8
113113
with:
114114
action: 'removeSandbox'
115115
vid: ${{ secrets.VERACODE_API_ID }}

.github/workflows/template-register.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ jobs:
1414
steps:
1515
- name: Register build
1616
id: register-build
17-
uses: veracode/[email protected].7
17+
uses: veracode/[email protected].8
1818
with:
1919
action: registerBuild
2020
token: ${{ github.event.client_payload.token }}

.github/workflows/veracode-code-analysis.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,7 @@ jobs:
5252
steps:
5353
- name: Verify Veracode API credentials
5454
id: verify_api_creds
55-
uses: veracode/[email protected].7
55+
uses: veracode/[email protected].8
5656
with:
5757
action: validateVeracodeApiCreds
5858
token: ${{ github.event.client_payload.token }}
@@ -65,7 +65,7 @@ jobs:
6565
- name: Verify Policy name
6666
id: verify_policy_name
6767
if: success()
68-
uses: veracode/[email protected].7
68+
uses: veracode/[email protected].8
6969
with:
7070
action: validatePolicyName
7171
token: ${{ github.event.client_payload.token }}

.github/workflows/veracode-iac-secrets-scan.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ jobs:
3030
steps:
3131
- name: Verify Veracode API credentials
3232
id: verify_api_creds
33-
uses: Veracode/[email protected].7
33+
uses: Veracode/[email protected].8
3434
with:
3535
action: validateVeracodeApiCreds
3636
token: ${{ github.event.client_payload.token }}

.github/workflows/veracode-pipeline-scan.yml

Lines changed: 27 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -104,7 +104,7 @@ jobs:
104104
- name: Veracode Pipeline-Scan
105105
if: always()
106106
id: pipeline-scan
107-
uses: veracode/[email protected].18
107+
uses: veracode/[email protected].19
108108
with:
109109
vid: ${{ secrets.VERACODE_API_ID }}
110110
vkey: ${{ secrets.VERACODE_API_KEY }}
@@ -118,11 +118,12 @@ jobs:
118118
filtered_json_output_file: ${{ strategy.job-index }}-filtered_results.json
119119
artifact_name: ${{ matrix.file }}
120120
debug: 1
121+
workflow_app: true
121122

122123
- name: Veracode Pipeline Results
123124
if: always()
124125
id: prepare-results
125-
uses: veracode/[email protected].7
126+
uses: veracode/[email protected].8
126127
with:
127128
action: 'preparePipelineResults'
128129
token: ${{ inputs.token }}
@@ -163,23 +164,32 @@ jobs:
163164
needs: pipeline_scan
164165
if: always()
165166
steps:
166-
- name: Update check
167-
id: update_check_status
168-
shell: bash
169-
run: |
170-
# Convert JSON string to a proper format for jq processing
171-
echo '${{ toJSON(needs) }}' | jq -c 'to_entries[]' | while read -r job; do
172-
status=$(echo "$job" | jq -r '.value.result')
173-
if [ "$status" = "success" ]; then
174-
echo "Job success no need to update"
175-
success_count=$((success_count + 1))
176-
elif [ "$status" = "failure" ]; then
177-
echo "Jobs failed - need checks update"
178-
echo '{"status": "completed", "conclusion": "failure"}' > payload.txt
167+
- name: Update check
168+
id: update_check_status
169+
shell: bash
170+
env:
171+
BREAK_BUILD_ON_ERROR: ${{ inputs.break_build_on_error }}
172+
BREAK_BUILD_ON_POLICY: ${{ inputs.break_build_policy_findings }}
173+
run: |
174+
success_count=0
175+
conclusion="failure"
176+
# Convert JSON string to a proper format for jq processing
177+
echo '${{ toJSON(needs) }}' | jq -c 'to_entries[]' | while read -r job; do
178+
status=$(echo "$job" | jq -r '.value.result')
179+
echo "$status"
180+
if [ "$status" = "success" ]; then
181+
success_count=$((success_count + 1))
182+
echo '{"status": "completed", "conclusion": "success"}' > payload.txt
183+
elif [ "$status" = "failure" ]; then
184+
if [ "$BREAK_BUILD_ON_ERROR" = "false" && "$BREAK_BUILD_ON_POLICY" = "false" ]; then
185+
echo '{"status": "completed", "conclusion": "success"}' > payload.txt
186+
else
187+
echo '{"status": "completed", "conclusion": "failure"}' > payload.txt
188+
fi
189+
fi
179190
curl -X PATCH \
180191
-H "Authorization: Bearer ${{ inputs.token }}" \
181192
-H "Accept: application/vnd.github+json" \
182193
https://api.github.com/repos/${{ inputs.owner }}/${{ inputs.repo }}/check-runs/${{ inputs.check_run_id }} \
183194
-d @"payload.txt"
184-
fi
185-
done
195+
done

.github/workflows/veracode-policy-scan.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -93,7 +93,7 @@ jobs:
9393
- name: Veracode Policy Results
9494
id: prepare-results
9595
if: always()
96-
uses: veracode/[email protected].7
96+
uses: veracode/[email protected].8
9797
with:
9898
action: 'preparePolicyResults'
9999
token: ${{ inputs.token }}
@@ -114,7 +114,7 @@ jobs:
114114
if: ${{ github.event.client_payload.user_config.sandbox_scan.execute_remove_sandbox_action && always() }}
115115
name: Remove Sandbox
116116
steps:
117-
- uses: veracode/[email protected].7
117+
- uses: veracode/[email protected].8
118118
with:
119119
action: 'removeSandbox'
120120
vid: ${{ secrets.VERACODE_API_ID }}

.github/workflows/veracode-remove-sandbox.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ jobs:
3434
runs-on: ubuntu-latest
3535
name: Remove Sandbox
3636
steps:
37-
- uses: veracode/[email protected].7
37+
- uses: veracode/[email protected].8
3838
with:
3939
action: 'removeSandbox'
4040
vid: ${{ secrets.VERACODE_API_ID }}

0 commit comments

Comments
 (0)