diff --git a/CHANGELOG.md b/CHANGELOG.md index 86ca4c5b..ce9dfa6d 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -15,6 +15,8 @@ and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0. ### Changed - Add a wait for the master before provisioning the follower in the CI tests. [cyberark/conjur-authn-k8s-client#499](https://github.com/cyberark/conjur-authn-k8s-client/pull/499) +- The version from the automated release should be used in the start up logs + [cyberark/conjur-authn-k8s-client#503](https://github.com/cyberark/conjur-authn-k8s-client/pull/503) ## [0.24.0] - 2022-11-23 ### Changed diff --git a/Dockerfile b/Dockerfile index 5be64493..ffe2424e 100644 --- a/Dockerfile +++ b/Dockerfile @@ -8,6 +8,7 @@ ENV GOOS=linux \ # this value changes in ./bin/build ARG TAG_SUFFIX="-dev" +ARG VERSION="unreleased" # On CyberArk dev laptops, golang module dependencies are downloaded with a # corporate proxy in the middle. For these connections to succeed we need to @@ -32,7 +33,12 @@ RUN go mod download RUN go get -u github.com/jstemmer/go-junit-report RUN go build -a -installsuffix cgo \ - -ldflags="-X 'github.com/cyberark/conjur-authn-k8s-client/pkg/authenticator.TagSuffix=$TAG_SUFFIX'" \ + -ldflags="-X 'github.com/cyberark/conjur-authn-k8s-client/pkg/authenticator.TagSuffix=$TAG_SUFFIX' \ + -X 'github.com/cyberark/conjur-authn-k8s-client/pkg/authenticator.Version=$VERSION'" \ + -o authenticator ./cmd/authenticator + +RUN go build -a -installsuffix cgo \ + -ldflags="-X 'github.com/cyberark/conjur-authn-k8s-client/pkg/authenticator.TagSuffix=$TAG_SUFFIX' -X 'github.com/cyberark/conjur-authn-k8s-client/pkg/authenticator.Version=$VERSION'" \ -o authenticator ./cmd/authenticator # Verify the binary is using BoringCrypto. diff --git a/bin/build b/bin/build index 18f2e6d5..d8cfda85 100755 --- a/bin/build +++ b/bin/build @@ -14,6 +14,7 @@ function build_docker_images { # dev build (env GOOS=darwin GOARCH=amd64 go build) of project binaries IMAGE_NAME=conjur-authn-k8s-client TAG=dev + TAG_SUFFIX="$(git_tag_suffix)" VERSION=unreleased # Version derived from CHANGELOG and automated release library @@ -21,19 +22,23 @@ function build_docker_images { readonly VERSION="${VERSION//"v"}" echo "---" - echo "Building ${IMAGE_NAME} with tag ${TAG} <<" + echo "Building ${IMAGE_NAME} version ${VERSION} suffix ${TAG_SUFFIX} with tag ${TAG} <<" docker build --tag "${IMAGE_NAME}:${TAG}" \ + --build-arg VERSION="${VERSION}" \ + --build-arg TAG_SUFFIX="${TAG_SUFFIX}" \ --target "authenticator-client" \ . docker build --tag "${IMAGE_NAME}-redhat:${TAG}" \ --build-arg VERSION="$VERSION" \ + --build-arg TAG_SUFFIX="${TAG_SUFFIX}" \ --target "authenticator-client-redhat" \ . docker build --tag conjur-k8s-cluster-test:${TAG} \ --build-arg VERSION="$VERSION" \ + --build-arg TAG_SUFFIX="${TAG_SUFFIX}" \ --target "k8s-cluster-test" \ . diff --git a/bin/build_utils b/bin/build_utils index 4cd27087..72f6b74c 100755 --- a/bin/build_utils +++ b/bin/build_utils @@ -27,7 +27,7 @@ function gen_versions() { # The TAG_NAME variable is set automatically on tag-triggered builds for fixed versions. function git_tag_suffix() { if [[ -z "${TAG_NAME:-}" ]]; then - echo "-$(git_commit_short)" + echo "$(git_commit_short)" else echo "" fi diff --git a/go.mod b/go.mod index f7851b71..3733bf05 100644 --- a/go.mod +++ b/go.mod @@ -30,4 +30,4 @@ require ( replace gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c => gopkg.in/yaml.v3 v3.0.1 // DO NOT EDIT: CHANGES TO THE BELOW LINE WILL BREAK AUTOMATED RELEASES -replace github.com/cyberark/conjur-opentelemetry-tracer => github.com/cyberark/conjur-opentelemetry-tracer latest +replace github.com/cyberark/conjur-opentelemetry-tracer => github.com/cyberark/conjur-opentelemetry-tracer v0.0.1-710 diff --git a/pkg/authenticator/version.go b/pkg/authenticator/version.go index fb1ec47d..b683828a 100644 --- a/pkg/authenticator/version.go +++ b/pkg/authenticator/version.go @@ -4,7 +4,7 @@ import "fmt" // Version field is a SemVer that should indicate the baked-in version // of the authn-k8s-client -var Version = "0.23.1" +var Version = "unset" // TagSuffix field denotes the specific build type for the client. It may // be replaced by compile-time variables if needed to provide the git @@ -14,4 +14,4 @@ var TagSuffix = "-dev" // FullVersionName is the user-visible aggregation of version and tag // of this codebase -var FullVersionName = fmt.Sprintf("%s%s", Version, TagSuffix) +var FullVersionName = fmt.Sprintf("v%s%s", Version, TagSuffix) diff --git a/pkg/log/log_messages.go b/pkg/log/log_messages.go index 3ff2c525..dbba144c 100644 --- a/pkg/log/log_messages.go +++ b/pkg/log/log_messages.go @@ -60,7 +60,7 @@ const CAKC044 string = "CAKC044 Buffer time: %v" const CAKC045 string = "CAKC045 Login request to: %s" const CAKC046 string = "CAKC046 Authn request to: %s" const CAKC047 string = "CAKC047 Waiting for %s to re-authenticate" -const CAKC048 string = "CAKC048 Kubernetes Authenticator Client v%s starting up..." +const CAKC048 string = "CAKC048 Kubernetes Authenticator Client %s starting up..." const CAKC049 string = "CAKC049 Loaded client certificate successfully from %s" const CAKC050 string = "CAKC050 Deleted client certificate from memory" const CAKC051 string = "CAKC051 Waiting for file %s to become available..."