chore(deps): bump docker/scout-action in the ci group (#334) #1
This file contains hidden or 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
| name: ci | |
| on: | |
| pull_request: | |
| types: | |
| - opened | |
| - synchronize | |
| - reopened | |
| - ready_for_review | |
| push: | |
| branches: | |
| - main | |
| permissions: | |
| contents: read | |
| jobs: | |
| test-code: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Harden Runner | |
| uses: step-security/harden-runner@9af89fc71515a100421586dfdb3dc9c984fbf411 # v2.19.4 | |
| with: | |
| egress-policy: audit | |
| - name: Checkout | |
| uses: actions/checkout@9c091bb21b7c1c1d1991bb908d89e4e9dddfe3e0 # v7.0.0 | |
| with: | |
| fetch-depth: 0 | |
| - name: Fetch all tags | |
| run: git fetch --force --tags | |
| - name: Set up Go | |
| uses: actions/setup-go@924ae3a1cded613372ab5595356fb5720e22ba16 # v6.5.0 | |
| with: | |
| go-version-file: 'go.mod' | |
| - name: Run Go Vet | |
| run: go vet ./... | |
| - name: Run Go Tests | |
| run: go test ./... -cover -race | |
| - name: Build binary | |
| uses: goreleaser/goreleaser-action@f06c13b6b1a9625abc9e6e439d9c05a8f2190e94 # v7.2.3 | |
| with: | |
| distribution: goreleaser | |
| version: '~> v2' | |
| args: build --snapshot | |
| - name: Install license check tool | |
| run: go install github.com/google/addlicense@dc31ac9ffcca99c9457226366135701794b128c0 | |
| - name: Check licenses | |
| run: addlicense -l apache -check -v -ignore '**/*.yaml' -c 'The Score Authors' ./cmd ./internal/ | |
| test-multi-arch-build: | |
| uses: docker/github-builder/.github/workflows/build.yml@5f637c833aa76bc99372a1dc9a6f8bcd8056fb85 # v1.12.0 | |
| if: ${{ !github.event.pull_request.head.repo.fork }} | |
| with: | |
| output: image | |
| push: false | |
| platforms: linux/amd64,linux/arm64 | |
| sbom: true | |
| cache: true | |
| context: . | |
| set-meta-labels: true | |
| set-meta-annotations: true | |
| meta-images: | | |
| score-k8s | |
| meta-tags: | | |
| type=ref,event=pr | |
| secrets: | |
| registry-auths: | | |
| - username: ${{ secrets.DOCKER_HUB_USERNAME }} | |
| password: ${{ secrets.DOCKER_HUB_TOKEN }} | |
| test-container: | |
| runs-on: ubuntu-latest | |
| if: ${{ !github.event.pull_request.head.repo.fork }} | |
| permissions: | |
| pull-requests: write | |
| steps: | |
| - name: Harden Runner | |
| uses: step-security/harden-runner@9af89fc71515a100421586dfdb3dc9c984fbf411 # v2.19.4 | |
| with: | |
| egress-policy: audit | |
| - name: Checkout | |
| uses: actions/checkout@9c091bb21b7c1c1d1991bb908d89e4e9dddfe3e0 # v7.0.0 | |
| with: | |
| fetch-depth: 0 | |
| - name: Set up Docker | |
| uses: docker/setup-docker-action@6d7cfa65f60a9dda7b46e5513fa982536f3c9877 # v5.3.0 | |
| with: | |
| daemon-config: | | |
| { | |
| "debug": true, | |
| "features": { | |
| "containerd-snapshotter": true | |
| } | |
| } | |
| - name: Set up Docker Buildx | |
| uses: docker/setup-buildx-action@bb05f3f5519dd87d3ba754cc423b652a5edd6d2c # v4.2.0 | |
| with: | |
| version: latest | |
| - name: docker login docker.io | |
| uses: docker/login-action@af1e73f918a031802d376d3c8bbc3fe56130a9b0 # v4.4.0 | |
| with: | |
| username: ${{ secrets.DOCKER_HUB_USERNAME }} | |
| password: ${{ secrets.DOCKER_HUB_TOKEN }} | |
| - name: docker login dhi.io | |
| uses: docker/login-action@af1e73f918a031802d376d3c8bbc3fe56130a9b0 # v4.4.0 | |
| with: | |
| registry: dhi.io | |
| username: ${{ secrets.DOCKER_HUB_USERNAME }} | |
| password: ${{ secrets.DOCKER_HUB_TOKEN }} | |
| - name: Build container image from PR branch | |
| uses: docker/build-push-action@53b7df96c91f9c12dcc8a07bcb9ccacbed38856a # v7.3.0 | |
| with: | |
| context: . | |
| push: false | |
| load: true | |
| cache-from: type=gha | |
| cache-to: type=gha,mode=max | |
| provenance: mode=max | |
| sbom: true | |
| tags: score-k8s:pr-${{ github.event.number }} | |
| - name: docker images | |
| run: | | |
| docker images | |
| - name: checkout code in main branch | |
| uses: actions/checkout@9c091bb21b7c1c1d1991bb908d89e4e9dddfe3e0 # v7.0.0 | |
| with: | |
| ref: main | |
| - name: Build container image from main branch | |
| uses: docker/build-push-action@53b7df96c91f9c12dcc8a07bcb9ccacbed38856a # v7.3.0 | |
| with: | |
| context: . | |
| push: false | |
| load: true | |
| cache-from: type=gha | |
| cache-to: type=gha,mode=max | |
| provenance: mode=max | |
| sbom: true | |
| tags: score-k8s:main | |
| - name: docker images | |
| run: | | |
| docker images | |
| - name: Docker Scout Comparison between main branch and current PR branch | |
| uses: docker/scout-action@2688993af7bafd6ba8c6a74ec652442be91dd82b # v1.23.1 | |
| with: | |
| command: compare | |
| image: local://score-k8s:pr-${{ github.event.number }} | |
| to: local://score-k8s:main | |
| write-comment: true | |
| github-token: ${{ secrets.GITHUB_TOKEN }} | |
| organization: ${{ secrets.DOCKER_HUB_ORG }} | |
| - name: Test docker image built in PR branch | |
| run: | | |
| mkdir test | |
| sudo chown -R 65532:65532 test/ | |
| cd test | |
| docker run --rm score-k8s:pr-${{ github.event.number }} --version | |
| docker run -v .:/score-k8s --rm score-k8s:pr-${{ github.event.number }} init | |
| cat score.yaml |