Skip to content

Commit 0352963

Browse files
committed
Move commands to separate modules
Make each helper command its own module to avoid maintaining every tool's dependencies in a single go.mod. Also remove update-deps.sh and update-codegen.sh which weren't used anywhere. Signed-off-by: Colleen Murphy <[email protected]>
1 parent 30cdb2b commit 0352963

File tree

84 files changed

+5364
-533
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

84 files changed

+5364
-533
lines changed

.github/dependabot.yml

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,10 @@ updates:
2222
- "cloud-sql-proxy"
2323

2424
- package-ecosystem: gomod
25-
directory: "/"
25+
directories:
26+
- "/"
27+
- "/tools/*"
28+
- "/hack/"
2629
schedule:
2730
interval: weekly
2831
open-pull-requests-limit: 10

.github/workflows/add-remove-new-fulcio.yaml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -203,7 +203,7 @@ jobs:
203203

204204
- name: Verify both Fulcio certs are there
205205
run: |
206-
go run ./cmd/ctlog/verifyfulcio/main.go \
206+
go run ./tools/ctlog/cmd/ctlog/verifyfulcio/main.go \
207207
--ctlog-url ${CTLOG_URL} \
208208
--log-prefix sigstorescaffolding \
209209
--fulcio ${FULCIO_URL} \
@@ -232,7 +232,7 @@ jobs:
232232

233233
- name: Verify that only new Fulcio cert is there
234234
run: |
235-
go run ./cmd/ctlog/verifyfulcio/main.go \
235+
go run ./tools/ctlog/cmd/ctlog/verifyfulcio/main.go \
236236
--ctlog-url ${CTLOG_URL} \
237237
--log-prefix sigstorescaffolding \
238238
--fulcio ${NEW_FULCIO_URL}

.github/workflows/codeql-analysis.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -39,11 +39,11 @@ jobs:
3939
filters: |
4040
gocode:
4141
- 'pkg/**'
42-
- 'cmd/**'
42+
- 'tools/**'
4343
4444
- uses: actions/setup-go@44694675825211faa026b3c33043df3e48a5fa00 # v6.0.0
4545
with:
46-
go-version-file: 'go.mod'
46+
go-version: stable
4747

4848
# Initializes the CodeQL tools for scanning.
4949
- name: Initialize CodeQL

.github/workflows/create-tink-keyset-test.yml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ on:
55
branches:
66
- main
77
paths:
8-
- 'cmd/create-tink-keyset/**'
8+
- 'tools/create-tink-keyset/cmd/create-tink-keyset/**'
99

1010
permissions:
1111
contents: read
@@ -23,9 +23,9 @@ jobs:
2323
- name: Set up Go
2424
uses: actions/setup-go@44694675825211faa026b3c33043df3e48a5fa00 # v6.0.0
2525
with:
26-
go-version-file: 'go.mod'
26+
go-version-file: './tools/create-tink-keyset/go.mod'
2727
check-latest: true
2828

2929
- name: Create Tink Keyset build
3030
id: create-tink-keyset-test
31-
run: go build ./cmd/create-tink-keyset
31+
run: go build ./tools/create-tink-keyset/cmd/create-tink-keyset

.github/workflows/prober-test.yml

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -6,12 +6,12 @@ on:
66
branches:
77
- main
88
paths:
9-
- 'cmd/prober/**'
9+
- 'tools/prober/cmd/prober/**'
1010
pull_request:
1111
branches:
1212
- main
1313
paths:
14-
- 'cmd/prober/**'
14+
- 'tools/prober/cmd/prober/**'
1515

1616
permissions:
1717
contents: read
@@ -40,11 +40,11 @@ jobs:
4040
- name: Set up Go
4141
uses: actions/setup-go@44694675825211faa026b3c33043df3e48a5fa00 # v6.0.0
4242
with:
43-
go-version-file: 'go.mod'
43+
go-version-file: './tools/prober/go.mod'
4444
check-latest: true
4545

4646
- name: Build prober test
47-
run: go build ./cmd/prober
47+
run: go build ./tools/prober/cmd/prober
4848

4949
- name: Get test OIDC token
5050
uses: sigstore-conformance/extremely-dangerous-public-oidc-beacon@main

.github/workflows/release.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ jobs:
3030

3131
- uses: actions/setup-go@44694675825211faa026b3c33043df3e48a5fa00 # v6.0.0
3232
with:
33-
go-version-file: ./src/github.com/${{ github.repository }}/go.mod
33+
go-version: stable
3434
check-latest: true
3535

3636
- name: Install ko

.github/workflows/verify.yml

Lines changed: 19 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ jobs:
1919

2020
- uses: actions/setup-go@44694675825211faa026b3c33043df3e48a5fa00 # v6.0.0
2121
with:
22-
go-version-file: 'go.mod'
22+
go-version: stable
2323
check-latest: true
2424
cache: true
2525

@@ -42,20 +42,37 @@ jobs:
4242
- name: Run ShellCheck
4343
uses: ludeeus/action-shellcheck@00cae500b08a931fb5698e11e79bfbd38e612a38 # v2.0.0
4444

45+
detect-modules:
46+
runs-on: ubuntu-latest
47+
outputs:
48+
modules: ${{ steps.set-modules.outputs.modules }}
49+
steps:
50+
- uses: actions/checkout@v5
51+
- uses: actions/setup-go@v6
52+
with:
53+
go-version: stable
54+
- id: set-modules
55+
run: echo "modules=$(go list -m -json | jq -s 'del(.[] | select(.Path == "github.com/sigstore/scaffolding/hack"))' | jq -c '[.[].Dir]')" >> $GITHUB_OUTPUT
56+
4557
golangci:
4658
name: lint
59+
needs: detect-modules
4760
runs-on: ubuntu-latest
61+
strategy:
62+
matrix:
63+
modules: ${{ fromJSON(needs.detect-modules.outputs.modules) }}
4864
steps:
4965
- uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5.0.0
5066
with:
5167
persist-credentials: false
5268

5369
- uses: actions/setup-go@44694675825211faa026b3c33043df3e48a5fa00 # v6.0.0
5470
with:
55-
go-version-file: 'go.mod'
71+
go-version: stable
5672
check-latest: true
5773

5874
- name: golangci-lint
5975
uses: golangci/golangci-lint-action@0a35821d5c230e903fcfe077583637dea1b27b47 # v9.0.0
6076
with:
6177
version: v2.4
78+
working-directory: ${{ matrix.modules }}

.gitignore

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,6 @@ release-*.yaml
55
testrelease.yaml
66
kind.yaml
77
.vscode/*
8-
prober
98
/cloudsqlproxy
109
/createcertchain
1110
/createcerts

.ko.yaml

Lines changed: 14 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
11
---
22
defaultBaseImage: gcr.io/distroless/static-debian12:nonroot
33
baseImageOverrides:
4-
github.com/sigstore/scaffolding/cmd/cloudsqlproxy: gcr.io/cloud-sql-connectors/cloud-sql-proxy:2.19.0-alpine
4+
github.com/sigstore/scaffolding/tools/cloudsqlproxy/cmd/cloudsqlproxy: gcr.io/cloud-sql-connectors/cloud-sql-proxy:2.19.0-alpine
55

66
builds:
77
- id: ctlog-createctconfig
8-
dir: .
8+
dir: ./tools/ctlog/
99
main: ./cmd/ctlog/createctconfig
1010
env:
1111
- CGO_ENABLED=0
@@ -20,7 +20,7 @@ builds:
2020
- "{{ .Env.LDFLAGS }}"
2121

2222
- id: ctlog-managectroots
23-
dir: .
23+
dir: ./tools/ctlog/
2424
main: ./cmd/ctlog/managectroots
2525
env:
2626
- CGO_ENABLED=0
@@ -35,7 +35,7 @@ builds:
3535
- "{{ .Env.LDFLAGS }}"
3636

3737
- id: ctlog-verifyfulcio
38-
dir: .
38+
dir: ./tools/ctlog/
3939
main: ./cmd/ctlog/verifyfulcio
4040
env:
4141
- CGO_ENABLED=0
@@ -50,7 +50,7 @@ builds:
5050
- "{{ .Env.LDFLAGS }}"
5151

5252
- id: fulcio-createcerts
53-
dir: .
53+
dir: ./tools/fulcio/
5454
main: ./cmd/fulcio/createcerts
5555
env:
5656
- CGO_ENABLED=0
@@ -65,7 +65,7 @@ builds:
6565
- "{{ .Env.LDFLAGS }}"
6666

6767
- id: tuf-createsecret
68-
dir: .
68+
dir: ./tools/tuf/
6969
main: ./cmd/tuf/createsecret
7070
env:
7171
- CGO_ENABLED=0
@@ -80,7 +80,7 @@ builds:
8080
- "{{ .Env.LDFLAGS }}"
8181

8282
- id: tuf-server
83-
dir: .
83+
dir: ./tools/tuf/
8484
main: ./cmd/tuf/server
8585
env:
8686
- CGO_ENABLED=0
@@ -95,7 +95,7 @@ builds:
9595
- "{{ .Env.LDFLAGS }}"
9696

9797
- id: trillian-createtree
98-
dir: .
98+
dir: ./tools/trillian/
9999
main: ./cmd/trillian/createtree
100100
env:
101101
- CGO_ENABLED=0
@@ -110,7 +110,7 @@ builds:
110110
- "{{ .Env.LDFLAGS }}"
111111

112112
- id: trillian-createdb
113-
dir: .
113+
dir: ./tools/trillian/
114114
main: ./cmd/trillian/createdb
115115
env:
116116
- CGO_ENABLED=0
@@ -125,7 +125,7 @@ builds:
125125
- "{{ .Env.LDFLAGS }}"
126126

127127
- id: trillian-updatetree
128-
dir: .
128+
dir: ./tools/trillian/
129129
main: ./cmd/trillian/updatetree
130130
env:
131131
- CGO_ENABLED=0
@@ -140,7 +140,7 @@ builds:
140140
- "{{ .Env.LDFLAGS }}"
141141

142142
- id: cloudsqlproxy
143-
dir: .
143+
dir: ./tools/cloudsqlproxy/
144144
main: ./cmd/cloudsqlproxy
145145
env:
146146
- CGO_ENABLED=0
@@ -155,7 +155,7 @@ builds:
155155
- "{{ .Env.LDFLAGS }}"
156156

157157
- id: getoidctoken
158-
dir: .
158+
dir: ./tools/getoidctoken/
159159
main: ./cmd/getoidctoken
160160
env:
161161
- CGO_ENABLED=0
@@ -170,7 +170,7 @@ builds:
170170
- "{{ .Env.LDFLAGS }}"
171171

172172
- id: prober
173-
dir: .
173+
dir: ./tools/prober/
174174
main: ./cmd/prober
175175
env:
176176
- CGO_ENABLED=0
@@ -185,7 +185,7 @@ builds:
185185
- "{{ .Env.LDFLAGS }}"
186186

187187
- id: rekor-createsecret
188-
dir: .
188+
dir: ./tools/rekor/
189189
main: ./cmd/rekor/rekor-createsecret
190190
env:
191191
- CGO_ENABLED=0

Makefile

Lines changed: 21 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -5,11 +5,14 @@ LDFLAGS=-buildid= -X sigs.k8s.io/release-utils/version.gitVersion=$(GIT_TAG) -X
55

66
KO_DOCKER_REPO ?= ghcr.io/sigstore/scaffolding
77

8-
TRILLIAN_VERSION=$(shell go list -m -f '{{ .Version }}' github.com/google/trillian)
8+
TRILLIAN_VERSION=$(shell cd hack && go list -m -f '{{ .Version }}' github.com/google/trillian)
99

10-
OMNIWITNESS_VERSION=$(shell go list -m -f '{{ .Version }}' github.com/transparency-dev/witness)
10+
OMNIWITNESS_VERSION=$(shell cd hack && go list -m -f '{{ .Version }}' github.com/transparency-dev/witness)
1111

12-
TESSERACT_VERSION=$(shell go list -m -f '{{ .Version }}' github.com/transparency-dev/tesseract)
12+
TESSERACT_VERSION=$(shell cd hack && go list -m -f '{{ .Version }}' github.com/transparency-dev/tesseract)
13+
14+
lint:
15+
go list -f '{{.Dir}}/...' -m | xargs golangci-lint run
1316

1417
# These are the subdirs under config that we'll turn into separate artifacts.
1518
artifacts := trillian ctlog fulcio rekor tsa tuf prober
@@ -23,7 +26,7 @@ ko-resolve:
2326
--image-refs imagerefs-$(artifact) > release-$(artifact).yaml )) \
2427
# "Building cloudsqlproxy wrapper"
2528
LDFLAGS="$(LDFLAGS)" KO_DOCKER_REPO=$(KO_DOCKER_REPO) \
26-
ko build --base-import-paths --platform=all --tags $(GIT_TAG),latest --image-refs imagerefs-cloudsqlproxy ./cmd/cloudsqlproxy
29+
ko build --base-import-paths --platform=all --tags $(GIT_TAG),latest --image-refs imagerefs-cloudsqlproxy ./tools/cloudsqlproxy/cmd/cloudsqlproxy
2730
# "Building trillian_log_server"
2831
LDFLAGS="$(LDFLAGS)" KO_DOCKER_REPO=$(KO_DOCKER_REPO) \
2932
ko build --base-import-paths --platform=all --tags $(TRILLIAN_VERSION),$(GIT_TAG),latest --image-refs imagerefs-trillian_log_server github.com/google/trillian/cmd/trillian_log_server
@@ -66,7 +69,7 @@ release-images: ko-resolve ko-resolve-testdata
6669

6770
.PHONY: prober
6871
prober:
69-
go build -trimpath -ldflags "$(LDFLAGS)" -o $@ ./cmd/prober
72+
go build -trimpath -ldflags "$(LDFLAGS)" -o $@ ./tools/prober/cmd/prober
7073

7174
### Testing
7275

@@ -130,52 +133,52 @@ build: build-tuf-server build-cloudsqlproxy build-ctlog-createctconfig build-ctl
130133

131134
.PHONY: build-cloudsqlproxy
132135
build-cloudsqlproxy:
133-
go build -trimpath ./cmd/cloudsqlproxy
136+
go build -trimpath ./tools/cloudsqlproxy/cmd/cloudsqlproxy
134137

135138
.PHONY: build-ctlog-createctconfig
136139
build-ctlog-createctconfig:
137-
go build -trimpath ./cmd/ctlog/createctconfig
140+
go build -trimpath ./tools/ctlog/cmd/ctlog/createctconfig
138141

139142
.PHONY: build-ctlog-managectroots
140143
build-ctlog-managectroots:
141-
go build -trimpath ./cmd/ctlog/managectroots
144+
go build -trimpath ./tools/ctlog/cmd/ctlog/managectroots
142145

143146
.PHONY: build-ctlog-verifyfulcio
144147
build-ctlog-verifyfulcio:
145-
go build -trimpath ./cmd/ctlog/verifyfulcio
148+
go build -trimpath ./tools/ctlog/cmd/ctlog/verifyfulcio
146149

147150
.PHONY: build-fulcio-createcerts
148151
build-fulcio-createcerts:
149-
go build -trimpath ./cmd/fulcio/createcerts
152+
go build -trimpath ./tools/fulcio/cmd/fulcio/createcerts
150153

151154
.PHONY: build-getoidctoken
152155
build-getoidctoken:
153-
go build -trimpath ./cmd/getoidctoken
156+
go build -trimpath ./tools/getoidctoken/cmd/getoidctoken
154157

155158
.PHONY: build-rekor-createsecret
156159
build-rekor-createsecret:
157-
go build -trimpath ./cmd/rekor/rekor-createsecret
160+
go build -trimpath ./tools/rekor/cmd/rekor/rekor-createsecret
158161

159162
.PHONY: build-trillian-createdb
160163
build-trillian-createdb:
161-
go build -trimpath ./cmd/trillian/createdb
164+
go build -trimpath ./tools/trillian/cmd/trillian/createdb
162165

163166
.PHONY: build-trillian-createtree
164167
build-trillian-createtree:
165-
go build -trimpath ./cmd/trillian/createtree
168+
go build -trimpath ./tools/trillian/cmd/trillian/createtree
166169

167170
.PHONY: build-trillian-updatetree
168171
build-trillian-updatetree:
169-
go build -trimpath ./cmd/trillian/updatetree
172+
go build -trimpath ./tools/trillian/cmd/trillian/updatetree
170173

171174
.PHONY: build-tsa-createcertchain
172175
build-tsa-createcertchain:
173-
go build -trimpath ./cmd/tsa/createcertchain
176+
go build -trimpath ./tools/tsa/cmd/tsa/createcertchain
174177

175178
.PHONY: build-tuf-createsecret
176179
build-tuf-createsecret:
177-
go build -trimpath ./cmd/tuf/createsecret
180+
go build -trimpath ./tools/tuf/cmd/tuf/createsecret
178181

179182
.PHONY: build-tuf-server
180183
build-tuf-server:
181-
go build -trimpath ./cmd/tuf/server
184+
go build -trimpath ./tools/tuf/cmd/tuf/server

0 commit comments

Comments
 (0)