Repository navigation
Expand file tree
/
Copy pathTaskfile.yml
More file actions
85 lines (73 loc) · 2.51 KB
/
Copy pathTaskfile.yml
File metadata and controls
85 lines (73 loc) · 2.51 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
# SPDX-FileCopyrightText: 2026 OpenSerbia
# SPDX-License-Identifier: MIT
# https://taskfile.dev
version: '3'
vars:
IMAGE: ghcr.io/openserbia/github-runner
# Image ref that scan/sbom/smoke operate on. Defaults to the locally-built
# :latest; CI overrides it per arch leg, e.g.
# `task scan sbom smoke REF=$IMAGE:latest-arm64`.
REF: '{{.IMAGE}}:latest'
tasks:
secrets:
desc: Scan the working tree and git history for committed credentials
# Two passes, because they answer different questions: `dir` catches a
# secret on its way into a commit, `git` catches one that is already in
# history and was later deleted: removing the line does not remove the
# blob.
#
# No sources/generates: the history pass depends on commits, which change
# without any tracked file changing, so a cached "up to date" would lie.
#
# .gitleaks.toml allowlists .env, vendor/ and the build/cache trees;
# everything else, untracked files included, is scanned.
cmds:
- gitleaks dir . --redact --no-banner --verbose
- gitleaks git --redact --no-banner --verbose
build:
desc: Build the image (:latest)
cmds:
- docker build -t {{.IMAGE}}:latest .
scan:
desc: Trivy — fail on FIXABLE CRITICAL, report HIGH+CRITICAL
cmds:
# --ignore-unfixed: gate only on CRITICALs that HAVE a fix, the
# actionable ones. Unfixable findings (e.g. in the runner's bundled .NET,
# which only a new runner release fixes) would keep the build red forever.
- trivy image --exit-code 1 --severity CRITICAL --ignore-unfixed --ignorefile .trivyignore {{.REF}}
# Visibility report (non-gating) — fixable HIGH+CRITICAL.
- trivy image --severity HIGH,CRITICAL --ignore-unfixed --ignorefile .trivyignore {{.REF}}
sbom:
desc: Generate CycloneDX SBOM
cmds:
- syft {{.REF}} -o cyclonedx-json=sbom.cdx.json
smoke:
desc: Smoke-test the built image (runner binary + toolchain present & sane)
cmds:
- ./test/smoke.sh {{.REF}}
test:go:
desc: Run the Go entrypoint unit tests
cmds:
- go test ./...
lint:go:
desc: Run golangci-lint (the strict shared openserbia config)
cmds:
- golangci-lint run
fmt:go:
desc: Apply gci + gofumpt formatting
cmds:
- golangci-lint fmt
tidy:
desc: Tidy Go modules
cmds:
- go mod tidy
ci:
desc: build -> scan -> sbom -> smoke (no push)
cmds:
- task: build
- task: scan
- task: sbom
- task: smoke
default:
cmds:
- task -l