Skip to content

Commit 3977800

Browse files
committed
trying to make scout work
1 parent 1adc176 commit 3977800

File tree

4 files changed

+82
-4
lines changed

4 files changed

+82
-4
lines changed

.github/workflows/dbc.yml

Lines changed: 24 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,10 +2,17 @@ name: dbc
22

33
on:
44
workflow_run:
5-
workflows: [Java CI with Maven]
5+
workflows: [tests]
66
types:
77
- completed
88

9+
env:
10+
# Use docker.io for Docker Hub if empty
11+
REGISTRY: docker.io
12+
IMAGE_NAME: olegselajev241/todo-demo-application
13+
SHA: ${{ github.event.pull_request.head.sha || github.event.after }}
14+
15+
916
jobs:
1017
docker:
1118
runs-on: ubuntu-latest
@@ -23,11 +30,26 @@ jobs:
2330
version: "lab:latest"
2431
driver: cloud
2532
endpoint: "docker/devrel"
33+
# Extract metadata (tags, labels) for Docker
34+
# https://github.com/docker/metadata-action
35+
- name: Extract Docker metadata
36+
id: meta
37+
uses: docker/[email protected]
38+
with:
39+
images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}
40+
labels: |
41+
org.opencontainers.image.revision=${{ env.SHA }}
42+
tags: |
43+
type=edge,branch=$repo.default_branch
44+
type=semver,pattern=v{{version}}
45+
type=sha,prefix=,suffix=,format=shorts
2646
- name: Build and push
2747
uses: docker/build-push-action@v5
2848
with:
2949
context: .
30-
tags: "olegselajev241/todo-demo-application:latest"
50+
tags: |
51+
"latest"
52+
${{ steps.meta.outputs.tags }}
3153
# For pull requests, export results to the build cache.
3254
# Otherwise, push to a registry.
3355
outputs: ${{ github.event_name == 'pull_request' && 'type=cacheonly' || 'type=registry,push=true' }}

.github/workflows/google-cloudrun-docker.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ name: 'Deploy to Cloud Run'
33

44
on:
55
workflow_run:
6-
workflows: [dbc]
6+
workflows: [scout]
77
types:
88
- completed
99

.github/workflows/maven.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
# separate terms of service, privacy policy, and support
77
# documentation.
88

9-
name: Java CI with Maven
9+
name: tests
1010

1111
on:
1212
push:

.github/workflows/scout.yml

Lines changed: 56 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,56 @@
1+
name: Docker
2+
3+
on:
4+
workflow_run:
5+
workflows: [dbc]
6+
types:
7+
- completed
8+
9+
env:
10+
# Use docker.io for Docker Hub if empty
11+
REGISTRY: docker.io
12+
IMAGE_NAME: olegselajev241/todo-demo-application
13+
SHA: ${{ github.event.pull_request.head.sha || github.event.after }}
14+
# Use `latest` as the tag to compare to if empty, assuming that it's already pushed
15+
COMPARE_TAG: latest
16+
17+
jobs:
18+
scout:
19+
runs-on: ubuntu-latest
20+
21+
steps:
22+
23+
# Login against a Docker registry except on PR
24+
# https://github.com/docker/login-action
25+
- name: Log into registry ${{ env.REGISTRY }}
26+
uses: docker/[email protected]
27+
with:
28+
registry: ${{ env.REGISTRY }}
29+
username: ${{ secrets.DOCKERHUB_USERNAME }}
30+
password: ${{ secrets.DOCKERHUB_PASSWORD }}
31+
32+
# Extract metadata (tags, labels) for Docker
33+
# https://github.com/docker/metadata-action
34+
- name: Extract Docker metadata
35+
id: meta
36+
uses: docker/[email protected]
37+
with:
38+
images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}
39+
labels: |
40+
org.opencontainers.image.revision=${{ env.SHA }}
41+
tags: |
42+
type=edge,branch=$repo.default_branch
43+
type=semver,pattern=v{{version}}
44+
type=sha,prefix=,suffix=,format=shorts
45+
46+
- name: Docker Scout
47+
id: docker-scout
48+
if: ${{ github.event_name == 'pull_request' }}
49+
uses: docker/scout-action@v1
50+
with:
51+
command: compare
52+
image: ${{ steps.meta.outputs.tags }}
53+
to: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}:${{ env.COMPARE_TAG }}
54+
ignore-unchanged: true
55+
only-severities: critical,high
56+
write-comment: false

0 commit comments

Comments
 (0)