Skip to content
This repository was archived by the owner on Sep 24, 2025. It is now read-only.

Commit 3f29945

Browse files
committed
feat: ✨ Initial commit
1 parent 8d60105 commit 3f29945

12 files changed

Lines changed: 3475 additions & 2 deletions

File tree

.github/workflows/ci.yaml

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
name: CI
2+
3+
on:
4+
push:
5+
pull_request:
6+
branches: [ "main" ]
7+
8+
jobs:
9+
10+
build:
11+
runs-on: ubuntu-latest
12+
steps:
13+
- uses: actions/checkout@v3
14+
15+
- name: Set up Go
16+
uses: actions/setup-go@v4
17+
with:
18+
go-version: '1.21'
19+
20+
- name: Build
21+
run: |
22+
go mod download
23+
go build -v ./...

.github/workflows/release.yaml

Lines changed: 81 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,81 @@
1+
name: Release
2+
3+
on:
4+
workflow_dispatch:
5+
release:
6+
types: [created]
7+
8+
permissions: read-all
9+
10+
env:
11+
IMAGE_REGISTRY: ghcr.io
12+
IMAGE_NAME: ${{ github.repository }}
13+
14+
jobs:
15+
build:
16+
permissions:
17+
contents: read
18+
packages: write
19+
outputs:
20+
image: ${{ steps.image.outputs.image }}
21+
digest: ${{ steps.build.outputs.digest }}
22+
runs-on: ubuntu-latest
23+
steps:
24+
- name: Checkout the repository
25+
uses: actions/checkout@2541b1294d2704b0964813337f33b291d3f8596b # v2.3.4
26+
27+
- name: Set up Docker Buildx
28+
uses: docker/setup-buildx-action@dc7b9719a96d48369863986a06765841d7ea23f6 # v2.0.0
29+
30+
- name: Authenticate Docker
31+
uses: docker/login-action@49ed152c8eca782a232dede0303416e8f356c37b # v2.0.0
32+
with:
33+
registry: ${{ env.IMAGE_REGISTRY }}
34+
username: ${{ github.actor }}
35+
password: ${{ secrets.GITHUB_TOKEN }}
36+
37+
- name: Extract metadata (tags, labels) for Docker
38+
id: meta
39+
uses: docker/metadata-action@69f6fc9d46f2f8bf0d5491e4aabe0bb8c6a4678a # v4.0.1
40+
with:
41+
images: ${{ env.IMAGE_REGISTRY }}/${{ env.IMAGE_NAME }}
42+
43+
- name: Build and push Docker image
44+
uses: docker/build-push-action@e551b19e49efd4e98792db7592c17c09b89db8d8 # v3.0.0
45+
id: build
46+
with:
47+
push: true
48+
tags: ${{ steps.meta.outputs.tags }}
49+
labels: ${{ steps.meta.outputs.labels }}
50+
51+
- name: Output image
52+
id: image
53+
run: |
54+
# NOTE: Set the image as an output because the `env` context is not
55+
# available to the inputs of a reusable workflow call.
56+
image_name="${IMAGE_REGISTRY}/${IMAGE_NAME}"
57+
echo "image=$image_name" >> "$GITHUB_OUTPUT"
58+
59+
image-provenance:
60+
needs: [build]
61+
permissions:
62+
actions: read
63+
id-token: write
64+
packages: write
65+
if: startsWith(github.ref, 'refs/tags/')
66+
uses: slsa-framework/slsa-github-generator/.github/workflows/generator_container_slsa3.yml@v1.9.0
67+
with:
68+
image: ${{ needs.build.outputs.image }}
69+
digest: ${{ needs.build.outputs.digest }}
70+
registry-username: ${{ github.actor }}
71+
secrets:
72+
registry-password: ${{ secrets.GITHUB_TOKEN }}
73+
74+
binary-provenance:
75+
permissions:
76+
id-token: write
77+
contents: write
78+
actions: read
79+
uses: slsa-framework/slsa-github-generator/.github/workflows/builder_go_slsa3.yml@v1.9.0
80+
with:
81+
go-version: 1.21

Dockerfile

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
FROM golang:1.21 as build
2+
3+
WORKDIR /go/src/app
4+
COPY . .
5+
6+
RUN go mod download && \
7+
CGO_ENABLED=0 go build -o /go/bin/app ./cmd/controller
8+
9+
FROM gcr.io/distroless/static
10+
EXPOSE 8080 9090
11+
USER nonroot:nonroot
12+
COPY --from=build --chown=nonroot:nonroot /go/bin/app /
13+
ENTRYPOINT ["/app"]

README.md

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,6 @@
1-
# scanning-controller
2-
Controller based on Trivy controller to scan container images in Kubernetes cluster
1+
# Scanning Controller
2+
3+
The project implements a controller based on the Trivy Operator to handle
4+
local scanning and sbom creation sending result in to the dependencies
5+
service centrally.
6+

cmd/controller/main.go

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
package main
2+
3+
import "github.com/neticdk/scanning-controller/pkg/cmd"
4+
5+
func main() {
6+
cmd.Execute()
7+
}

0 commit comments

Comments
 (0)