Skip to content

Commit 3bb5865

Browse files
authored
improve automations (#120)
Signed-off-by: Alex Goodman <wagoodman@users.noreply.github.com>
1 parent 4730b8d commit 3bb5865

16 files changed

Lines changed: 316 additions & 233 deletions

File tree

.binny.yaml

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
# only pull in version updates that were released more than a week ago (low-pass filter for quickly-retracted releases)
2+
cooldown: 7d
3+
4+
# other binary versions inherited from .binny.yaml file in the anchore/go-make repo (version pinned in .make).
5+
# If you need to override a tool version, please do so by adding an entry here and go-make will
6+
# account for the local definition over the go-make shared definitions.
7+
tools: []

.chronicle.yaml

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
# no matter the change, stay v0 for now
2+
enforce-v0: true
3+
4+
# since github release pages already have titles that are the tag, we don't need to repeat that in the changelog
5+
title: ""

.github/actions/bootstrap/action.yaml

Lines changed: 0 additions & 35 deletions
This file was deleted.

.github/dependabot.yml

Lines changed: 41 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -1,31 +1,56 @@
1+
# Dependabot configuration
2+
#
3+
# Grouping behavior (see inline comments for details):
4+
# - Minor + patch updates: grouped into a single PR per ecosystem
5+
# - Major version bumps: individual PR per dependency
6+
# - Security updates: individual PR per dependency
7+
#
8+
# Note: "patch" refers to semver version bumps (1.2.3 -> 1.2.4), not security fixes.
9+
# Security updates are identified separately via GitHub's Advisory Database and
10+
# can be any version bump (patch, minor, or major) that fixes a known CVE.
11+
112
version: 2
13+
214
updates:
15+
316
- package-ecosystem: gomod
4-
directory: "/"
5-
schedule:
6-
interval: "daily"
7-
open-pull-requests-limit: 10
8-
labels:
9-
- "dependencies"
17+
directories:
18+
- "/"
19+
- "/.make"
1020
cooldown:
1121
default-days: 7
12-
13-
- package-ecosystem: "github-actions"
14-
directory: "/"
1522
schedule:
16-
interval: "daily"
23+
interval: "weekly"
24+
day: "friday"
1725
open-pull-requests-limit: 10
1826
labels:
1927
- "dependencies"
20-
cooldown:
21-
default-days: 7
28+
groups:
29+
go-minor-patch:
30+
applies-to: version-updates # security updates get individual PRs
31+
patterns:
32+
- "*"
33+
update-types: # major omitted, gets individual PRs
34+
- "minor"
35+
- "patch"
2236

2337
- package-ecosystem: "github-actions"
24-
directory: "/.github/actions/bootstrap"
38+
directories:
39+
- "/"
40+
- "/.github/actions/*"
41+
cooldown:
42+
default-days: 7
2543
schedule:
26-
interval: "daily"
44+
interval: "weekly"
45+
day: "friday"
2746
open-pull-requests-limit: 10
2847
labels:
2948
- "dependencies"
30-
cooldown:
31-
default-days: 7
49+
groups:
50+
actions-minor-patch:
51+
applies-to: version-updates # security updates get individual PRs
52+
patterns:
53+
- "*"
54+
update-types: # major omitted, gets individual PRs
55+
- "minor"
56+
- "patch"

.github/workflows/codeql.yaml

Lines changed: 82 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,82 @@
1+
# CodeQL scans for security vulnerabilities and coding errors across all
2+
# languages in this repo. Results appear in the "Security" tab under
3+
# "Code scanning alerts" and are enforced by branch protection rules.
4+
name: "CodeQL"
5+
6+
on:
7+
push:
8+
branches: [ "main" ]
9+
pull_request:
10+
branches: [ "main" ]
11+
# Weekly scheduled scan catches newly disclosed vulnerabilities in
12+
# existing code, not just changes introduced by PRs.
13+
schedule:
14+
- cron: '38 11 * * 3'
15+
16+
jobs:
17+
analyze:
18+
name: Analyze (${{ matrix.language }})
19+
runs-on: ubuntu-latest
20+
permissions:
21+
# Required to upload SARIF results to the "Security" tab.
22+
security-events: write
23+
# Required to fetch internal or private CodeQL packs.
24+
packages: read
25+
# Only required for workflows in private repositories.
26+
actions: read
27+
contents: read
28+
29+
strategy:
30+
fail-fast: false
31+
matrix:
32+
include:
33+
# GitHub Actions workflow linting — no build needed.
34+
- language: actions
35+
build-mode: none
36+
37+
# Go uses "manual" build mode so we control exactly what gets
38+
# compiled. The default "autobuild" finds the Makefile and runs
39+
# the full CI pipeline (lint, test, snapshot release, etc.),
40+
# which is far more work than CodeQL needs. All it requires is
41+
# compiled Go source so it can build a type-resolved code graph
42+
# for analysis.
43+
- language: go
44+
build-mode: manual
45+
46+
steps:
47+
- name: Checkout repository
48+
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
49+
50+
with:
51+
persist-credentials: false
52+
53+
# Pin the Go toolchain to whatever go.mod declares so CodeQL
54+
# analyzes with the same version the project actually uses.
55+
# Only runs for the Go matrix entry.
56+
- name: Setup Go
57+
if: matrix.language == 'go'
58+
uses: actions/setup-go@4a3601121dd01d1626a1e23e37211e3254c1c06c # v6.4.0
59+
with:
60+
go-version-file: go.mod
61+
62+
- name: Initialize CodeQL
63+
uses: github/codeql-action/init@c10b8064de6f491fea524254123dbe5e09572f13 # v4.35.1
64+
with:
65+
languages: ${{ matrix.language }}
66+
build-mode: ${{ matrix.build-mode }}
67+
68+
# Minimal build for Go.
69+
# This replaces autobuild, which would have run the entire Makefile
70+
# (installing tools, linting, testing, goreleaser snapshot, etc.).
71+
- name: Build (Go)
72+
if: matrix.build-mode == 'manual'
73+
shell: bash
74+
run: go build ./...
75+
76+
- name: Perform CodeQL Analysis
77+
uses: github/codeql-action/analyze@c10b8064de6f491fea524254123dbe5e09572f13 # v4.35.1
78+
with:
79+
# The category tag lets GitHub associate SARIF results with the
80+
# correct language when branch protection checks for required
81+
# code scanning results.
82+
category: "/language:${{matrix.language}}"

.github/workflows/release.yaml

Lines changed: 55 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,55 @@
1+
name: "Release"
2+
3+
permissions:
4+
contents: read
5+
6+
# there should never be two releases in progress at the same time
7+
concurrency:
8+
group: release
9+
cancel-in-progress: false
10+
11+
on:
12+
workflow_dispatch:
13+
inputs:
14+
version:
15+
description: tag the latest commit on main with the given version (prefixed with v)
16+
required: true
17+
18+
jobs:
19+
20+
version-available:
21+
uses: anchore/workflows/.github/workflows/check-version-available.yaml@4f25313f96311410cad4173f74617654a3e46d48 # v0.3.0
22+
with:
23+
version: ${{ github.event.inputs.version }}
24+
25+
check-gate:
26+
permissions:
27+
checks: read # required for getting the status of specific check names
28+
uses: anchore/workflows/.github/workflows/check-gate.yaml@4f25313f96311410cad4173f74617654a3e46d48 # v0.3.0
29+
with:
30+
# these are checks that should be run on pull-request and merges to main.
31+
# we do NOT want to kick off a release if these have not been verified on main.
32+
# Please see the validations.yaml workflow for the names that should be used here.
33+
checks: '["Static analysis", "Unit tests"]'
34+
35+
release:
36+
needs: [check-gate, version-available]
37+
environment: release # contains secrets needed for release
38+
runs-on: ubuntu-24.04
39+
permissions:
40+
contents: write # needed for creating github release objects
41+
steps:
42+
- uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd #v6.0.2
43+
with:
44+
fetch-depth: 0 # we need the full history to reason about changelogs and tags
45+
persist-credentials: true # needed for pushing a tag
46+
47+
# setup checkout, go, go-make, binny, and cache go modules
48+
- uses: anchore/go-make/.github/actions/setup@383ef7852b8ae43a30f424896b52479186d2ea4d # v0.1.0
49+
50+
- name: Create release
51+
env:
52+
GITHUB_TOKEN: ${{ github.token }}
53+
DEPLOY_KEY: ${{ secrets.DEPLOY_KEY }}
54+
RELEASE_VERSION: ${{ github.event.inputs.version }}
55+
run: make ci-release

.github/workflows/validations.yaml

Lines changed: 7 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -1,46 +1,34 @@
11
name: "Validations"
2-
32
on:
43
workflow_dispatch:
5-
pull_request:
64
push:
75
branches:
86
- main
7+
pull_request:
98

109
permissions:
1110
contents: read
1211

1312
jobs:
1413

1514
Static-Analysis:
15+
# Note: changing this job name requires making the same update in the .github/workflows/release.yaml pipeline
1616
name: "Static analysis"
1717
runs-on: ubuntu-24.04
18-
permissions:
19-
contents: read
2018
steps:
21-
- uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
22-
with:
23-
persist-credentials: false
24-
25-
- name: Bootstrap environment
26-
uses: ./.github/actions/bootstrap
19+
# setup checkout, go, go-make, binny, and cache go modules
20+
- uses: anchore/go-make/.github/actions/setup@383ef7852b8ae43a30f424896b52479186d2ea4d # v0.1.0
2721

2822
- name: Run static analysis
2923
run: make static-analysis
3024

31-
3225
Unit-Test:
26+
# Note: changing this job name requires making the same update in the .github/workflows/release.yaml pipeline
3327
name: "Unit tests"
3428
runs-on: ubuntu-24.04
35-
permissions:
36-
contents: read
3729
steps:
38-
- uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
39-
with:
40-
persist-credentials: false
41-
42-
- name: Bootstrap environment
43-
uses: ./.github/actions/bootstrap
30+
# setup checkout, go, go-make, binny, and cache go modules
31+
- uses: anchore/go-make/.github/actions/setup@383ef7852b8ae43a30f424896b52479186d2ea4d # v0.1.0
4432

4533
- name: Run unit tests
4634
run: make unit

.github/zizmor.yml

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
rules:
22
unpinned-uses:
3-
config:
4-
policies:
5-
# anchore/workflows is an internal repository; using @main is acceptable
6-
anchore/*: any
3+
ignore:
4+
# Allow unpinned uses of trusted internal anchore/workflows actions
5+
- oss-project-board-add.yaml
6+
- remove-awaiting-response-label.yaml

.gitignore

Lines changed: 18 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,28 @@
1+
# local development
12
go.work
23
go.work.sum
4+
mise.toml
5+
/specs/
36

4-
CHANGELOG.md
5-
VERSION
7+
# IDEs
8+
.idea/
9+
.vscode/
10+
.history/
11+
12+
# tools and aux data
13+
.tool
14+
.tmp
15+
.task
16+
17+
# release info
18+
/CHANGELOG.md
19+
/VERSION
20+
21+
# archives and fixtures
622
/test/results
723
/dist
824
/snapshot
925
.server/
10-
.vscode/
11-
.history/
1226
*.fingerprint
1327
*.tar
1428
*.jar
@@ -17,7 +31,6 @@ VERSION
1731
*.jpi
1832
*.hpi
1933
*.zip
20-
.idea/
2134
*.log
2235
.images
2336
.tmp/
@@ -41,4 +54,3 @@ bin/
4154
.DS_STORE
4255

4356
*.profile
44-

0 commit comments

Comments
 (0)