Scan #324
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Copyright 2024 Tetrate | |
# | |
# Licensed under the Apache License, Version 2.0 (the "License"); | |
# you may not use this file except in compliance with the License. | |
# You may obtain a copy of the License at | |
# | |
# http://www.apache.org/licenses/LICENSE-2.0 | |
# | |
# Unless required by applicable law or agreed to in writing, software | |
# distributed under the License is distributed on an "AS IS" BASIS, | |
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | |
# See the License for the specific language governing permissions and | |
# limitations under the License. | |
name: Scan | |
on: | |
# Run scans on all commits and PRs to verify new codes does not introduce new vulnerabilities. | |
push: | |
branches: | |
- main | |
- release-** | |
tags: [ 'v[0-9]+.[0-9]+.[0-9]+**' ] # Ex. v0.2.0, v0.2.1-rc2 | |
pull_request: | |
branches: | |
- main | |
- release-** | |
# Run nightly scans to upload any new CVEs to the security advisories | |
schedule: | |
- cron: "0 0 * * *" | |
workflow_dispatch: {} | |
env: | |
GOPROXY: https://proxy.golang.org | |
jobs: | |
scan: | |
runs-on: ubuntu-latest | |
env: | |
DOCKER_TAG: scan | |
DOCKER_HUB: local | |
DOCKER_TARGETS: linux-amd64 | |
steps: | |
- uses: docker/setup-qemu-action@v3 | |
with: | |
platforms: amd64 | |
- uses: docker/setup-buildx-action@v3 | |
- uses: actions/checkout@v4 | |
- run: make docker | |
- uses: anchore/scan-action@v3 | |
id: scan | |
with: | |
image: local/authservice:scan-amd64 | |
# Only fail the build on PRs. Do not fail the build on the scheduled run, to let the workflow | |
# continue and have the report uploaded. | |
fail-build: ${{ github.event_name != 'schedule' }} | |
- run: cat ${{ steps.scan.outputs.sarif }} | |
if: always() # Always print the report to the stdout. | |
# Do not upload the security advisories on every commit or pull request. | |
# Upload the security advisories only for the nightly scans. | |
- uses: github/codeql-action/upload-sarif@v3 | |
if: ${{ github.event_name == 'schedule' }} | |
with: | |
sarif_file: ${{ steps.scan.outputs.sarif }} |