Skip to content

Commit 1245d3a

Browse files
committed
Add boilerplate
1 parent 18c4039 commit 1245d3a

File tree

3 files changed

+92
-0
lines changed

3 files changed

+92
-0
lines changed

actions/scan-image/CHANGELOG.md

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
# Changelog
2+
3+
## 0.1.0 (2025-10-03)
4+
5+
### 🎉 Features
6+
7+
* **scan-image:** add `snyk` and `trivy` vulnerability scanners with a fail condition configuration
8+
* **scan-image:** add [Dockerhub](https://hub.docker.com/) and [Google Artifact Registry](https://cloud.google.com/artifact-registry/docs) as available private sources

actions/scan-image/README.md

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
# scan-image
2+
3+
This is a composite GitHub Action used to scan your images in search of vulnerabilities.
4+
5+
The goal is to provide developers a way to check if their PR changes, without having to
6+
wait for periodic scans (Faster feedback loop). This can also be used as part of deployment
7+
CI/CD jobs as a way to verify things before shipping to production environments.
8+
9+
<!-- x-release-please-start-version -->
10+
11+
```yaml
12+
name: Scan image for vulnerabilities
13+
jobs:
14+
scan-image:
15+
name: Scan image for vulnerabilities
16+
steps:
17+
- name: Scan image for vulnerabilities
18+
id: scan-image
19+
uses: grafana/shared-workflows/actions/scan-image@scan-image/v0.1.0
20+
with:
21+
image_name: docker.io/hello-world
22+
fail_on: critical
23+
fail_on_threshold: 1
24+
```
25+
26+
<!-- x-release-please-end-version -->

actions/scan-image/action.yaml

Lines changed: 58 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,58 @@
1+
name: Scan Image
2+
description: Composite action to check an image for vulnerabilities
3+
4+
inputs:
5+
image_name:
6+
description: "The name of the image to scan, including the registry e.g. docker.io/hello-world"
7+
required: true
8+
image_source:
9+
description: "The source of the image to scan"
10+
type: choice
11+
options:
12+
- public
13+
- private_dockerhub
14+
- private_gar
15+
default: public
16+
fail_on:
17+
description: "Whether to fail the workflow if vulnerabilities are found"
18+
type: choice
19+
options:
20+
- critical
21+
- high
22+
- medium
23+
- low
24+
default: critical
25+
fail_on_threshold:
26+
description: "The threshold of vulnerabilities to fail the workflow on"
27+
type: integer
28+
default: 1
29+
30+
outputs: {}
31+
32+
runs:
33+
using: composite
34+
steps:
35+
36+
- name: Login to DockerHub
37+
if: inputs.image_source == 'private_dockerhub'
38+
uses: grafana/shared-workflows/actions/[email protected]
39+
40+
- name: Extract GAR registry
41+
if: inputs.image_source == 'private_gar'
42+
id: extract-registry
43+
shell: bash
44+
run: |
45+
IMAGE_NAME="${{ inputs.image_name }}"
46+
REGISTRY="${IMAGE_NAME%%/*}"
47+
echo "registry=${REGISTRY}" >> $GITHUB_OUTPUT
48+
49+
- name: Login to GAR
50+
if: inputs.image_source == 'private_gar'
51+
uses: grafana/shared-workflows/actions/login-to-gar@login-to-gar/v1.0.0
52+
with:
53+
registry: ${{ steps.extract-registry.outputs.registry }}
54+
55+
- name: Debug (DELETE ME)
56+
shell: bash
57+
run: |
58+
echo "Scanning ${{ inputs.image_name }}"

0 commit comments

Comments
 (0)