yahoojapan / athenz-client-sidecar

Moved to https://github.com/AthenZ/athenz-client-sidecar
https://github.com/AthenZ/athenz-client-sidecar
Apache License 2.0
15 stars 5 forks source link

[patch] add go binary version during build time #25

Closed WindzCUHK closed 4 years ago

WindzCUHK commented 4 years ago

issue

go binary only print the config file format version currently

format

${APP_VERSION} at ${BUILD_TIME} by ${GO_VERSION} e.g. 1.2.33333 at 20200128-025155 by go1.13.6 linux/amd64

TODO

codecov-io commented 4 years ago

Codecov Report

Merging #25 into master will decrease coverage by 6.04%. The diff coverage is 41.66%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master      #25      +/-   ##
==========================================
- Coverage    95.7%   89.66%   -6.05%     
==========================================
  Files          10       11       +1     
  Lines         582      648      +66     
==========================================
+ Hits          557      581      +24     
- Misses         14       56      +42     
  Partials       11       11
Impacted Files Coverage Δ
usecase/tenantd.go 95.23% <100%> (ø) :arrow_up:
main.go 36.36% <36.36%> (ø)

Continue to review full report at Codecov.

Legend - Click here to learn more Δ = absolute <relative> (impact), ø = not affected, ? = missing data Powered by Codecov. Last update b7b4084...18f1f95. Read the comment docs.

WindzCUHK commented 4 years ago

Still got the error

# github.com/yahoojapan/athenz-client-sidecar
loadinternal: cannot find runtime/cgo

Tried but not works:

  1. apk add musl-dev

P.S. Set CGO_ENABLED=0 can build without having the error, but the binary size will get bigger

WindzCUHK commented 4 years ago

docker output

export TAG=1.2.33333

with version

# docker build --build-arg APP_VERSION=${TAG} -t yahoojapan/athenz-client-sidecar:latest .
2020-01-28 02:53:30 [INFO]: athenz clientd version -> 1.2.33333 at 20200128-025155 by go1.13.6 linux/amd64
2020-01-28 02:53:30 [INFO]: athenz clientd config version -> v1.0.0

without version

# docker build -t yahoojapan/athenz-client-sidecar:latest .
2020-01-28 02:55:34 [INFO]: athenz clientd version -> development version at 20200128-025408 by go1.13.6 linux/amd64
2020-01-28 02:55:34 [INFO]: athenz clientd config version -> v1.0.0
# run docker
docker run --rm yahoojapan/athenz-client-sidecar:latest -version
# run go
docker run -it --rm golang:1.13-alpine sh
WindzCUHK commented 4 years ago

pipeline result