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

build(docker): Fix version details in docker image #1471

Merged
merged 2 commits into from Oct 27, 2020

Conversation

sayboras
Copy link
Member

@sayboras sayboras commented Oct 26, 2020

Description

As part of #1383, multi-arch docker build was supported. However,
ldflags for version details and CGO_ENABLED=0 were missing.

This commit is to add -ldflags as part of Docker build.

Fixes #1468

Signed-off-by: Tam Mach sayboras@yahoo.com

Testing

Testing was done with my docker hub and tag v1.32.1

Testing with arm64
$ docker run --rm sayboras/golangci-lint:v1.32.1 golangci-lint version
golangci-lint has version v1.32.1 built from 89647eba on 2020-10-26T10:16:00Z

$ docker run --rm sayboras/golangci-lint:v1.32.1 golangci-lint --version 
golangci-lint has version v1.32.1 built from 89647eba on 2020-10-26T10:16:00Z


$ docker run --rm -w /src -v $PWD:/src sayboras/golangci-lint:v1.32.1 golangci-lint run ./...

$ uname -a
Linux ubuntu 5.4.0-1021-raspi #24-Ubuntu SMP PREEMPT Mon Oct 5 09:59:23 UTC 2020 aarch64 aarch64 aarch64 GNU/Linux
Testing with amd64
$ docker run --rm sayboras/golangci-lint:v1.32.1 golangci-lint version
golangci-lint has version v1.32.1 built from 89647eba on 2020-10-26T10:16:00Z

$ docker run --rm sayboras/golangci-lint:v1.32.1 golangci-lint --version 
golangci-lint has version v1.32.1 built from 89647eba on 2020-10-26T10:16:00Z

$ docker run --rm -w /src -v $PWD:/src sayboras/golangci-lint:v1.32.1 golangci-lint run ./... -v
level=info msg="[config_reader] Config search paths: [./ /src / /root]"
level=info msg="[lintersdb] Active 10 linters: [deadcode errcheck gosimple govet ineffassign staticcheck structcheck typecheck unused varcheck]"
level=info msg="[loader] Go packages loading at mode 575 (imports|name|compiled_files|exports_file|files|deps|types_sizes) took 4.834417647s"
level=info msg="[runner/filename_unadjuster] Pre-built 0 adjustments in 9.205305ms"
level=info msg="[linters context/goanalysis] analyzers took 5.778376571s with top 10 stages: buildir: 4.313237995s, fact_purity: 163.142737ms, inspect: 154.257723ms, ctrlflow: 143.652437ms, printf: 138.532273ms, fact_deprecated: 97.744815ms, ineffassign: 85.125717ms, isgenerated: 50.530356ms, deadcode: 41.686738ms, S1038: 22.20593ms"
level=info msg="[linters context/goanalysis] analyzers took 960.62409ms with top 10 stages: buildir: 837.647488ms, U1000: 122.976602ms"
level=info msg="[runner] Issues before processing: 29, after processing: 0"
level=info msg="[runner] Processors filtering stat (out/in): skip_dirs: 29/29, autogenerated_exclude: 29/29, identifier_marker: 29/29, filename_unadjuster: 29/29, skip_files: 29/29, path_prettifier: 29/29, exclude: 0/29, cgo: 29/29"
level=info msg="[runner] processing took 4.160422ms with stages: exclude: 1.744207ms, identifier_marker: 939.523µs, autogenerated_exclude: 596.772µs, path_prettifier: 532.22µs, skip_dirs: 310.208µs, cgo: 19.848µs, filename_unadjuster: 11.893µs, nolint: 1.222µs, max_same_issues: 923ns, severity-rules: 731ns, uniq_by_line: 411ns, diff: 401ns, skip_files: 370ns, source_code: 312ns, exclude-rules: 290ns, max_from_linter: 260ns, path_shortener: 240ns, path_prefixer: 230ns, max_per_file_from_linter: 191ns, sort_results: 170ns"
level=info msg="[runner] linters took 2.031282027s with stages: goanalysis_metalinter: 1.81668173s, unused: 210.319902ms"
level=info msg="File cache stats: 0 entries of total size 0B"
level=info msg="Memory: 70 samples, avg is 127.8MB, max is 409.7MB"
level=info msg="Execution took 6.88345463s"

$ uname -a                      
Linux ubuntu20 5.4.0-52-generic #57-Ubuntu SMP Thu Oct 15 10:57:00 UTC 2020 x86_64 x86_64 x86_64 GNU/Linux

As part of golangci#1383, multi-arch docker build was supported. However,
ldflags for version details was missing.

This commit is to add -ldflags as part of Docker build.

Fixes golangci#1468

Signed-off-by: Tam Mach <sayboras@yahoo.com>
Refactor docker release job for readability

Signed-off-by: Tam Mach <sayboras@yahoo.com>
Copy link
Member

@bombsimon bombsimon left a comment

Choose a reason for hiding this comment

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

🎉

@sayboras
Copy link
Member Author

Thanks for your review. Once this one is merged, I will release v1.32.1 as well.

Waiting for some more time if others have any feedback.

@sayboras
Copy link
Member Author

Seems like there is no other comment, I will merge now :)

@sayboras sayboras merged commit dc2d6b5 into golangci:master Oct 27, 2020
@ldez ldez added this to the v1.32 milestone Mar 6, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Broken version and --version with v1.32.0
3 participants