Skip to content

Commit

Permalink
Version info should be passed to the boot up log message
Browse files Browse the repository at this point in the history
  • Loading branch information
rpothier committed Mar 9, 2023
1 parent 4f56cfb commit ea73c3a
Show file tree
Hide file tree
Showing 7 changed files with 20 additions and 7 deletions.
2 changes: 2 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
8 changes: 7 additions & 1 deletion Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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.
Expand Down
7 changes: 6 additions & 1 deletion bin/build
Original file line number Diff line number Diff line change
Expand Up @@ -14,26 +14,31 @@ 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
[ -f VERSION ] && VERSION=$(<VERSION)
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" \
.

Expand Down
2 changes: 1 addition & 1 deletion bin/build_utils
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -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
4 changes: 2 additions & 2 deletions pkg/authenticator/version.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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)
2 changes: 1 addition & 1 deletion pkg/log/log_messages.go
Original file line number Diff line number Diff line change
Expand Up @@ -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..."
Expand Down

0 comments on commit ea73c3a

Please sign in to comment.