Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Version info should be passed to the boot up log message #503

Merged
merged 1 commit into from
Mar 20, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 4 additions & 2 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,17 +6,19 @@ and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.

## [Unreleased]

## [0.25.0] - 2023-03-15
## [0.25.0] - 2023-03-17

### Removed
- Removed support for Conjur v4 and the `CONJUR_VERSION` env variable
[cyberark/conjur-authn-k8s-client#505](https://github.com/cyberark/conjur-authn-k8s-client/pull/505)

### Changed
- Upgrade base image in Dockerfiles to 1.19 and necessary dependencies
[cyberark/conjur-authn-k8s-client#502ß](https://github.com/cyberark/conjur-authn-k8s-client/pull/502)
[cyberark/conjur-authn-k8s-client#502](https://github.com/cyberark/conjur-authn-k8s-client/pull/502)
- 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
6 changes: 4 additions & 2 deletions 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,8 @@ 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

# Verify the binary is using BoringCrypto.
Expand Down Expand Up @@ -125,7 +127,7 @@ LABEL description="The authentication client required to expose secrets from a C

# =================== CONTAINER FOR HELM TEST ===================

FROM golang:alpine as k8s-cluster-test
FROM golang:1.20-alpine as k8s-cluster-test
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why is this necessary? I don't think we're targeting Go 1.20 in any of the other images

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Also what's the simplest way to test this PR?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Currently golang:alpine and golang:1.20-alpine are the same image, so there is currently no change to the image.
#502 updated golang in the Dockerfiles to 1.19, a fixed version, and golang:alpine will change over time.
We could use 1.19 however that version is older and that won't help the security issues.
This change is not needed for the version info.


# Install packages for testing
RUN apk add --no-cache bash bind-tools coreutils curl git ncurses openssl openssl-dev
Expand Down
2 changes: 1 addition & 1 deletion Jenkinsfile
Original file line number Diff line number Diff line change
Expand Up @@ -122,7 +122,7 @@ pipeline {
sh 'cp ./test/c.out ./c.out'

junit 'test/junit.xml'
cobertura autoUpdateHealth: true, autoUpdateStability: true, coberturaReportFile: 'test/coverage.xml', conditionalCoverageTargets: '70, 0, 70', failUnhealthy: true, failUnstable: true, maxNumberOfBuilds: 0, lineCoverageTargets: '70, 70, 70', methodCoverageTargets: '70, 0, 70', onlyStable: false, sourceEncoding: 'ASCII', zoomCoverageChart: false
cobertura autoUpdateHealth: false, autoUpdateStability: false, coberturaReportFile: 'test/coverage.xml', conditionalCoverageTargets: '70, 0, 70', failUnhealthy: true, failUnstable: true, maxNumberOfBuilds: 0, lineCoverageTargets: '70, 70, 70', methodCoverageTargets: '70, 0, 70', onlyStable: false, sourceEncoding: 'ASCII', zoomCoverageChart: false
ccCoverage("gocov", "--prefix github.com/cyberark/conjur-authn-k8s-client")
}
}
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
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