Skip to content

Commit d4bbf5c

Browse files
authored
Merge pull request #733 from jetstack/fix-agent-version
[VC-45997] Fix agent version by adding gomodule_name to handle go module / repo mismatch
2 parents 89599fc + 294fcba commit d4bbf5c

File tree

3 files changed

+19
-15
lines changed

3 files changed

+19
-15
lines changed

go.mod

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
// TODO(wallrj): Rename the Go module to match the repository name
12
module github.com/jetstack/preflight
23

34
go 1.24.4

make/00_mod.mk

Lines changed: 15 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,13 @@
11
repo_name := github.com/jetstack/jetstack-secure
2-
# TODO(wallrj): This is a hack to allow use the old preflight repo name in the
3-
# gci section of the golangci-lint config until we can rename the go module.
4-
# Without this hack, golangci-lint will complain that the
5-
# github.com/jetstack/preflight imports should be grouped with all the other
6-
# third-party modules.
7-
generate-golangci-lint-config: repo_name := github.com/jetstack/preflight
2+
# This is a work around for the mismatch between the repo name and the go module
3+
# name. It allows golangci-lint to group the github.com/jetstack/preflight
4+
# imports correctly. And it allows the version information to be injected into
5+
# the version package via Go ldflags.
6+
#
7+
# TODO(wallrj): Rename the Go module to match the repository name.
8+
gomodule_name := github.com/jetstack/preflight
9+
10+
generate-golangci-lint-config: repo_name := $(gomodule_name)
811

912
license_ignore := gitlab.com/venafi,github.com/jetstack
1013

@@ -16,12 +19,12 @@ build_names := preflight
1619
go_preflight_main_dir := .
1720
go_preflight_mod_dir := .
1821
go_preflight_ldflags := \
19-
-X $(repo_name)/pkg/version.PreflightVersion=$(VERSION) \
20-
-X $(repo_name)/pkg/version.Commit=$(GITCOMMIT) \
21-
-X $(repo_name)/pkg/version.BuildDate=$(shell date "+%F-%T-%Z") \
22-
-X $(repo_name)/pkg/client.ClientID=k3TrDbfLhCgnpAbOiiT2kIE1AbovKzjo \
23-
-X $(repo_name)/pkg/client.ClientSecret=f39w_3KT9Vp0VhzcPzvh-uVbudzqCFmHER3Huj0dvHgJwVrjxsoOQPIw_1SDiCfa \
24-
-X $(repo_name)/pkg/client.AuthServerDomain=auth.jetstack.io
22+
-X $(gomodule_name)/pkg/version.PreflightVersion=$(VERSION) \
23+
-X $(gomodule_name)/pkg/version.Commit=$(GITCOMMIT) \
24+
-X $(gomodule_name)/pkg/version.BuildDate=$(shell date "+%F-%T-%Z") \
25+
-X $(gomodule_name)/pkg/client.ClientID=k3TrDbfLhCgnpAbOiiT2kIE1AbovKzjo \
26+
-X $(gomodule_name)/pkg/client.ClientSecret=f39w_3KT9Vp0VhzcPzvh-uVbudzqCFmHER3Huj0dvHgJwVrjxsoOQPIw_1SDiCfa \
27+
-X $(gomodule_name)/pkg/client.AuthServerDomain=auth.jetstack.io
2528

2629
oci_preflight_base_image_flavor := static
2730
oci_preflight_image_name := quay.io/jetstack/venafi-agent

make/ark/00_mod.mk

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,9 @@ build_names += ark
22
go_ark_main_dir := ./cmd/ark
33
go_ark_mod_dir := .
44
go_ark_ldflags := \
5-
-X $(repo_name)/pkg/version.PreflightVersion=$(VERSION) \
6-
-X $(repo_name)/pkg/version.Commit=$(GITCOMMIT) \
7-
-X $(repo_name)/pkg/version.BuildDate=$(shell date "+%F-%T-%Z") \
5+
-X $(gomodule_name)/pkg/version.PreflightVersion=$(VERSION) \
6+
-X $(gomodule_name)/pkg/version.Commit=$(GITCOMMIT) \
7+
-X $(gomodule_name)/pkg/version.BuildDate=$(shell date "+%F-%T-%Z")
88

99
oci_ark_base_image_flavor := static
1010
oci_ark_image_name := quay.io/jetstack/disco-agent

0 commit comments

Comments
 (0)