Skip to content

Commit 77db7f5

Browse files
authored
Merge pull request #19805 from almaceleste/main
fix GitHub Actions YAML file block
2 parents 6d965b2 + cdb1ca3 commit 77db7f5

File tree

1 file changed

+65
-65
lines changed
  • content/scout/integrations/ci

1 file changed

+65
-65
lines changed

content/scout/integrations/ci/gha.md

Lines changed: 65 additions & 65 deletions
Original file line numberDiff line numberDiff line change
@@ -54,51 +54,51 @@ jobs:
5454
permissions:
5555
pull-requests: write
5656

57-
steps:
58-
- name: Checkout repository
59-
uses: actions/checkout@v4
60-
with:
61-
ref: ${{ env.SHA }}
62-
63-
- name: Setup Docker buildx
64-
uses: docker/setup-buildx-action@v3
65-
66-
# Authenticate to the container registry
67-
- name: Authenticate to registry ${{ env.REGISTRY }}
68-
uses: docker/login-action@v3
69-
with:
70-
registry: ${{ env.REGISTRY }}
71-
username: ${{ secrets.REGISTRY_USER }}
72-
password: ${{ secrets.REGISTRY_TOKEN }}
73-
74-
# Extract metadata (tags, labels) for Docker
75-
- name: Extract Docker metadata
76-
id: meta
77-
uses: docker/metadata-action@v5
78-
with:
79-
images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}
80-
labels: |
81-
org.opencontainers.image.revision=${{ env.SHA }}
82-
tags: |
83-
type=edge,branch=$repo.default_branch
84-
type=semver,pattern=v{{version}}
85-
type=sha,prefix=,suffix=,format=short
86-
87-
# Build and push Docker image with Buildx
88-
# (don't push on PR, load instead)
89-
- name: Build and push Docker image
90-
id: build-and-push
91-
uses: docker/build-push-action@v5
92-
with:
93-
context: .
94-
sbom: ${{ github.event_name != 'pull_request' }}
95-
provenance: ${{ github.event_name != 'pull_request' }}
96-
push: ${{ github.event_name != 'pull_request' }}
97-
load: ${{ github.event_name == 'pull_request' }}
98-
tags: ${{ steps.meta.outputs.tags }}
99-
labels: ${{ steps.meta.outputs.labels }}
100-
cache-from: type=gha
101-
cache-to: type=gha,mode=max
57+
steps:
58+
- name: Checkout repository
59+
uses: actions/checkout@v4
60+
with:
61+
ref: ${{ env.SHA }}
62+
63+
- name: Setup Docker buildx
64+
uses: docker/setup-buildx-action@v3
65+
66+
# Authenticate to the container registry
67+
- name: Authenticate to registry ${{ env.REGISTRY }}
68+
uses: docker/login-action@v3
69+
with:
70+
registry: ${{ env.REGISTRY }}
71+
username: ${{ secrets.REGISTRY_USER }}
72+
password: ${{ secrets.REGISTRY_TOKEN }}
73+
74+
# Extract metadata (tags, labels) for Docker
75+
- name: Extract Docker metadata
76+
id: meta
77+
uses: docker/metadata-action@v5
78+
with:
79+
images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}
80+
labels: |
81+
org.opencontainers.image.revision=${{ env.SHA }}
82+
tags: |
83+
type=edge,branch=$repo.default_branch
84+
type=semver,pattern=v{{version}}
85+
type=sha,prefix=,suffix=,format=short
86+
87+
# Build and push Docker image with Buildx
88+
# (don't push on PR, load instead)
89+
- name: Build and push Docker image
90+
id: build-and-push
91+
uses: docker/build-push-action@v5
92+
with:
93+
context: .
94+
sbom: ${{ github.event_name != 'pull_request' }}
95+
provenance: ${{ github.event_name != 'pull_request' }}
96+
push: ${{ github.event_name != 'pull_request' }}
97+
load: ${{ github.event_name == 'pull_request' }}
98+
tags: ${{ steps.meta.outputs.tags }}
99+
labels: ${{ steps.meta.outputs.labels }}
100+
cache-from: type=gha
101+
cache-to: type=gha,mode=max
102102
```
103103
104104
This creates workflow steps to:
@@ -124,26 +124,26 @@ With this setup out of the way, you can add the following steps to run the
124124
image comparison:
125125
126126
```yaml
127-
# You can skip this step if Docker Hub is your registry
128-
# and you already authenticated before
129-
- name: Authenticate to Docker
130-
uses: docker/login-action@v3
131-
with:
132-
username: ${{ secrets.DOCKER_USER }}
133-
password: ${{ secrets.DOCKER_PAT }}
134-
135-
# Compare the image built in the pull request with the one in production
136-
- name: Docker Scout
137-
id: docker-scout
138-
if: ${{ github.event_name == 'pull_request' }}
139-
uses: docker/scout-action@v1
140-
with:
141-
command: compare
142-
image: ${{ steps.meta.outputs.tags }}
143-
to-env: production
144-
ignore-unchanged: true
145-
only-severities: critical,high
146-
github-token: ${{ secrets.GITHUB_TOKEN }}
127+
# You can skip this step if Docker Hub is your registry
128+
# and you already authenticated before
129+
- name: Authenticate to Docker
130+
uses: docker/login-action@v3
131+
with:
132+
username: ${{ secrets.DOCKER_USER }}
133+
password: ${{ secrets.DOCKER_PAT }}
134+
135+
# Compare the image built in the pull request with the one in production
136+
- name: Docker Scout
137+
id: docker-scout
138+
if: ${{ github.event_name == 'pull_request' }}
139+
uses: docker/scout-action@v1
140+
with:
141+
command: compare
142+
image: ${{ steps.meta.outputs.tags }}
143+
to-env: production
144+
ignore-unchanged: true
145+
only-severities: critical,high
146+
github-token: ${{ secrets.GITHUB_TOKEN }}
147147
```
148148
149149
The compare command analyzes the image and evaluates policy compliance, and

0 commit comments

Comments
 (0)