Skip to content

Commit 7a69a7b

Browse files
committed
fix: add credentials for pulling private dependency with govulncheck
It seems difficult to stop govulncheck attempting to pull and analyse private dependencies. We still want to run it, so the simplest thing to do is diverge from upstream makefile-modules and maintain the govulncheck workflow by hand in this repo. This requires changes to the govulncheck workflow itself, and means we have to disable the upstream govulncheck targets and copy them locally. Signed-off-by: Ashley Davis <[email protected]>
1 parent 9d25e21 commit 7a69a7b

File tree

6 files changed

+56
-19
lines changed

6 files changed

+56
-19
lines changed

.github/workflows/govulncheck.yaml

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,9 @@
1-
# THIS FILE IS AUTOMATICALLY GENERATED. DO NOT EDIT.
2-
# Edit https://github.com/cert-manager/makefile-modules/blob/main/modules/go/base/.github/workflows/govulncheck.yaml instead.
1+
# This file is MANUALLY maintained, but was originally based on the makefile-modules govulncheck workflow. See the original:
2+
# https://github.com/cert-manager/makefile-modules/blob/main/modules/go/base/.github/workflows/govulncheck.yaml
3+
4+
# This file is separated from the upstream file so we can add additional auth for pulling
5+
# private dependencies. Govulncheck doesn't seem to be able to support skipping private
6+
# dependencies.
37

48
# Run govulncheck at midnight every night on the main branch,
59
# to alert us to recent vulnerabilities which affect the Go code in this
@@ -26,6 +30,12 @@ jobs:
2630
# see https://github.com/actions/checkout/issues/701 for extra info about this option
2731
with: { fetch-depth: 0 }
2832

33+
# NOTE: This step is the change from the upstream workflow.
34+
# We need credentials to pull the private dependency.
35+
- uses: ./.github/actions/repo_access
36+
with:
37+
DEPLOY_KEY_READ_VENAFI_CONNECTION_LIB: ${{ secrets.DEPLOY_KEY_READ_VENAFI_CONNECTION_LIB }}
38+
2939
- id: go-version
3040
run: |
3141
make print-go-version >> "$GITHUB_OUTPUT"

klone.yaml

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -10,55 +10,55 @@ targets:
1010
- folder_name: generate-verify
1111
repo_url: https://github.com/cert-manager/makefile-modules.git
1212
repo_ref: main
13-
repo_hash: 684d99b0a6378fb3625c188bc5a0081ae9d2bbdc
13+
repo_hash: 563ddf86f3e68085fbf926eb2cc7a4ec0c6d58cd
1414
repo_path: modules/generate-verify
1515
- folder_name: go
1616
repo_url: https://github.com/cert-manager/makefile-modules.git
1717
repo_ref: main
18-
repo_hash: 684d99b0a6378fb3625c188bc5a0081ae9d2bbdc
18+
repo_hash: 563ddf86f3e68085fbf926eb2cc7a4ec0c6d58cd
1919
repo_path: modules/go
2020
- folder_name: helm
2121
repo_url: https://github.com/cert-manager/makefile-modules.git
2222
repo_ref: main
23-
repo_hash: 684d99b0a6378fb3625c188bc5a0081ae9d2bbdc
23+
repo_hash: 563ddf86f3e68085fbf926eb2cc7a4ec0c6d58cd
2424
repo_path: modules/helm
2525
- folder_name: help
2626
repo_url: https://github.com/cert-manager/makefile-modules.git
2727
repo_ref: main
28-
repo_hash: 684d99b0a6378fb3625c188bc5a0081ae9d2bbdc
28+
repo_hash: 563ddf86f3e68085fbf926eb2cc7a4ec0c6d58cd
2929
repo_path: modules/help
3030
- folder_name: kind
3131
repo_url: https://github.com/cert-manager/makefile-modules.git
3232
repo_ref: main
33-
repo_hash: 684d99b0a6378fb3625c188bc5a0081ae9d2bbdc
33+
repo_hash: 563ddf86f3e68085fbf926eb2cc7a4ec0c6d58cd
3434
repo_path: modules/kind
3535
- folder_name: klone
3636
repo_url: https://github.com/cert-manager/makefile-modules.git
3737
repo_ref: main
38-
repo_hash: 684d99b0a6378fb3625c188bc5a0081ae9d2bbdc
38+
repo_hash: 563ddf86f3e68085fbf926eb2cc7a4ec0c6d58cd
3939
repo_path: modules/klone
4040
- folder_name: licenses
4141
repo_url: https://github.com/cert-manager/makefile-modules.git
4242
repo_ref: main
43-
repo_hash: 684d99b0a6378fb3625c188bc5a0081ae9d2bbdc
43+
repo_hash: 563ddf86f3e68085fbf926eb2cc7a4ec0c6d58cd
4444
repo_path: modules/licenses
4545
- folder_name: oci-build
4646
repo_url: https://github.com/cert-manager/makefile-modules.git
4747
repo_ref: main
48-
repo_hash: 684d99b0a6378fb3625c188bc5a0081ae9d2bbdc
48+
repo_hash: 563ddf86f3e68085fbf926eb2cc7a4ec0c6d58cd
4949
repo_path: modules/oci-build
5050
- folder_name: oci-publish
5151
repo_url: https://github.com/cert-manager/makefile-modules.git
5252
repo_ref: main
53-
repo_hash: 684d99b0a6378fb3625c188bc5a0081ae9d2bbdc
53+
repo_hash: 563ddf86f3e68085fbf926eb2cc7a4ec0c6d58cd
5454
repo_path: modules/oci-publish
5555
- folder_name: repository-base
5656
repo_url: https://github.com/cert-manager/makefile-modules.git
5757
repo_ref: main
58-
repo_hash: 684d99b0a6378fb3625c188bc5a0081ae9d2bbdc
58+
repo_hash: 563ddf86f3e68085fbf926eb2cc7a4ec0c6d58cd
5959
repo_path: modules/repository-base
6060
- folder_name: tools
6161
repo_url: https://github.com/cert-manager/makefile-modules.git
6262
repo_ref: main
63-
repo_hash: 684d99b0a6378fb3625c188bc5a0081ae9d2bbdc
63+
repo_hash: 563ddf86f3e68085fbf926eb2cc7a4ec0c6d58cd
6464
repo_path: modules/tools

make/00_mod.mk

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,9 @@ helm_chart_image_name := quay.io/jetstack/charts/venafi-kubernetes-agent
4242
helm_chart_version := $(VERSION)
4343
helm_labels_template_name := preflight.labels
4444

45-
govulncheck_generate_org := jetstack
45+
# We skip using the upstream govulncheck targets because we need to customise the workflow YAML
46+
# locally. We provide the targets in this repo instead, and manually maintain the workflow.
47+
govulncheck_skip := true
4648

4749
# Allows us to replace the Helm values.yaml's image.repository and image.tag
4850
# with the right values.

make/02_mod.mk

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -64,3 +64,24 @@ test-helm: | $(NEEDS_HELM-UNITTEST)
6464
## @category Testing
6565
test-helm-snapshot: | $(NEEDS_HELM-UNITTEST)
6666
$(HELM-UNITTEST) ./deploy/charts/venafi-kubernetes-agent/ -u
67+
68+
69+
.PHONY: verify-govulncheck
70+
## Verify all Go modules for vulnerabilities using govulncheck Copied from makefile-modules
71+
## @category [shared] Generate/ Verify
72+
#
73+
# Runs `govulncheck` on all Go modules related to the project.
74+
# Ignores Go modules among the temporary build artifacts in _bin, to avoid
75+
# scanning the code of the vendored Go, after running make vendor-go.
76+
# Ignores Go modules in make/_shared, because those will be checked in centrally
77+
# in the makefile_modules repository.
78+
verify-govulncheck: | $(NEEDS_GOVULNCHECK)
79+
@find . -name go.mod -not \( -path "./$(bin_dir)/*" -or -path "./make/_shared/*" \) \
80+
| while read d; do \
81+
target=$$(dirname $${d}); \
82+
echo "Running 'GOTOOLCHAIN=go$(VENDORED_GO_VERSION) $(bin_dir)/tools/govulncheck ./...' in directory '$${target}'"; \
83+
pushd "$${target}" >/dev/null; \
84+
GOTOOLCHAIN=go$(VENDORED_GO_VERSION) $(GOVULNCHECK) ./... || exit; \
85+
popd >/dev/null; \
86+
echo ""; \
87+
done

make/_shared/go/01_mod.mk

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -57,6 +57,8 @@ generate-go-mod-tidy: | $(NEEDS_GO)
5757

5858
shared_generate_targets += generate-go-mod-tidy
5959

60+
ifndef govulncheck_skip
61+
6062
default_govulncheck_generate_base_dir := $(dir $(lastword $(MAKEFILE_LIST)))/base/
6163
# The base directory used to copy the govulncheck GH action from. This can be
6264
# overwritten with an action with extra authentication or with a totally different
@@ -101,6 +103,8 @@ verify-govulncheck: | $(NEEDS_GOVULNCHECK)
101103
echo ""; \
102104
done
103105

106+
endif # govulncheck_skip
107+
104108
ifdef golangci_lint_config
105109

106110
.PHONY: generate-golangci-lint-config

make/_shared/tools/00_mod.mk

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -172,7 +172,7 @@ ADDITIONAL_TOOLS ?=
172172
tools += $(ADDITIONAL_TOOLS)
173173

174174
# https://go.dev/dl/
175-
VENDORED_GO_VERSION := 1.24.5
175+
VENDORED_GO_VERSION := 1.24.6
176176

177177
# Print the go version which can be used in GH actions
178178
.PHONY: print-go-version
@@ -394,10 +394,10 @@ $(call for_each_kv,go_dependency,$(go_dependencies))
394394
# File downloads #
395395
##################
396396

397-
go_linux_amd64_SHA256SUM=10ad9e86233e74c0f6590fe5426895de6bf388964210eac34a6d83f38918ecdc
398-
go_linux_arm64_SHA256SUM=0df02e6aeb3d3c06c95ff201d575907c736d6c62cfa4b6934c11203f1d600ffa
399-
go_darwin_amd64_SHA256SUM=2fe5f3866b8fbcd20625d531f81019e574376b8a840b0a096d8a2180308b1672
400-
go_darwin_arm64_SHA256SUM=92d30a678f306c327c544758f2d2fa5515aa60abe9dba4ca35fbf9b8bfc53212
397+
go_linux_amd64_SHA256SUM=bbca37cc395c974ffa4893ee35819ad23ebb27426df87af92e93a9ec66ef8712
398+
go_linux_arm64_SHA256SUM=124ea6033a8bf98aa9fbab53e58d134905262d45a022af3a90b73320f3c3afd5
399+
go_darwin_amd64_SHA256SUM=4a8d7a32052f223e71faab424a69430455b27b3fff5f4e651f9d97c3e51a8746
400+
go_darwin_arm64_SHA256SUM=4e29202c49573b953be7cc3500e1f8d9e66ddd12faa8cf0939a4951411e09a2a
401401

402402
.PRECIOUS: $(DOWNLOAD_DIR)/tools/go@$(VENDORED_GO_VERSION)_$(HOST_OS)_$(HOST_ARCH).tar.gz
403403
$(DOWNLOAD_DIR)/tools/go@$(VENDORED_GO_VERSION)_$(HOST_OS)_$(HOST_ARCH).tar.gz: | $(DOWNLOAD_DIR)/tools

0 commit comments

Comments
 (0)