|
69 | 69 | VERSION=$SPECIFIED_VERSION |
70 | 70 | fi |
71 | 71 | echo "docker_image=${{ inputs.docker_image }}:$PR_NUMBER-$VERSION$TAG_SUFFIX" >> $GITHUB_OUTPUT |
72 | | - echo "commit_sha=$CLICKHOUSE_VERSION_GITHASH" >> $GITHUB_OUTPUT |
73 | 72 |
|
74 | 73 | - name: Run Grype Scan |
75 | 74 | run: | |
|
85 | 84 | id: upload_results |
86 | 85 | env: |
87 | 86 | S3_BUCKET: "altinity-build-artifacts" |
88 | | - COMMIT_SHA: ${{ steps.set_version.outputs.commit_sha || github.event_name == 'pull_request' && github.event.pull_request.head.sha || github.sha }} |
| 87 | + COMMIT_SHA: ${{ github.event_name == 'pull_request' && github.event.pull_request.head.sha || github.sha }} |
89 | 88 | PR_NUMBER: ${{ env.PR_NUMBER || github.event.pull_request.number || 0 }} |
90 | 89 | DOCKER_IMAGE: ${{ steps.set_version.outputs.docker_image || inputs.docker_image }} |
91 | 90 | run: | |
@@ -132,15 +131,18 @@ jobs: |
132 | 131 | with: |
133 | 132 | github-token: ${{ secrets.GITHUB_TOKEN }} |
134 | 133 | script: | |
| 134 | + const totalHighCritical = '${{ steps.create_summary.outputs.total_high_critical }}'; |
| 135 | + const hasError = totalHighCritical === ''; |
| 136 | + const hasVulnerabilities = parseInt(totalHighCritical) > 0; |
135 | 137 | github.rest.repos.createCommitStatus({ |
136 | 138 | owner: context.repo.owner, |
137 | 139 | repo: context.repo.repo, |
138 | 140 | sha: '${{ github.event_name == 'pull_request' && github.event.pull_request.head.sha || github.sha }}', |
139 | | - state: '${{ steps.create_summary.outputs.total_high_critical > 0 && 'failure' || 'success' }}', |
| 141 | + state: hasError ? 'error' : hasVulnerabilities ? 'failure' : 'success', |
140 | 142 | target_url: '${{ steps.upload_results.outputs.https_s3_path }}/results.html', |
141 | | - description: 'Grype Scan Completed with ${{ steps.create_summary.outputs.total_high_critical }} high/critical vulnerabilities', |
| 143 | + description: hasError ? 'An error occurred' : `Grype Scan Completed with ${totalHighCritical} high/critical vulnerabilities`, |
142 | 144 | context: 'Grype Scan ${{ steps.set_version.outputs.docker_image || inputs.docker_image }}' |
143 | | - }) |
| 145 | + }); |
144 | 146 |
|
145 | 147 | - name: Upload artifacts |
146 | 148 | if: always() |
|
0 commit comments