Skip to content
This repository was archived by the owner on Dec 16, 2025. It is now read-only.

✨ use new builder image approach#133

Merged
chess-knight merged 3 commits into
mainfrom
kr/new-builder-image
Mar 25, 2024
Merged

✨ use new builder image approach#133
chess-knight merged 3 commits into
mainfrom
kr/new-builder-image

Conversation

@kranurag7

@kranurag7 kranurag7 commented Mar 13, 2024

Copy link
Copy Markdown
Contributor

Fixes #128

this commit updates builder images and adds a make target so that we copy the static executables right from the container image. it's fast and we don't have to pull it from the internet again and again if we have the builder image present locally.

  • for testing
$ docker build -t ghcr.io/sovereigncloudstack/cspo-builder:0.1.0 -f images/builder/Dockerfile images/builder/

And then invoke any of the following make targets because these targets depend on the builder image.

make lint-yaml
make lint-yaml-ci
make lint-links
make lint-dockerfile
make lint-golang
make lint-golang-ci
make format-golang
make generate-modules

Here's the output from my machine:

Details

$ make lint-yaml
make lint-yaml-ci                                                                                          make lint-links                                                                                             make lint-dockerfile
make lint-golang
make lint-golang-ci
make format-golang
make generate-modules


docker run  --rm -t -i \
        -v /root/go/pkg:/go/pkg \
        -v /root/cluster-stack-provider-openstack:/src/cluster-stack-provider-openstack \
        ghcr.io/sovereigncloudstack/cspo-builder:0.1.0 lint-yaml;
make: Entering directory '/src/cluster-stack-provider-openstack'
yamllint --version
yamllint 1.35.1
yamllint -c .yamllint.yaml --strict .
make: Leaving directory '/src/cluster-stack-provider-openstack'
docker run  --rm -t -i \
        -v /root/go/pkg:/go/pkg \
        -v /root/cluster-stack-provider-openstack:/src/cluster-stack-provider-openstack \
        ghcr.io/sovereigncloudstack/cspo-builder:0.1.0 lint-yaml-ci;
make: Entering directory '/src/cluster-stack-provider-openstack'
yamllint --version
yamllint 1.35.1
yamllint -c .yamllint.yaml . --format github
make: Leaving directory '/src/cluster-stack-provider-openstack'
docker run --rm -t -i \
        -v /root/cluster-stack-provider-openstack:/src/cluster-stack-provider-openstack \
        ghcr.io/sovereigncloudstack/cspo-builder:0.1.0 lint-links;
make: Entering directory '/src/cluster-stack-provider-openstack'
lychee --config .lychee.toml ./*.md  ./docs/**/*.md
  34/34 ━━━━━━━━━━━━━━━━━━━━ Finished extracting links
make: Leaving directory '/src/cluster-stack-provider-openstack'
docker run  --rm -t -i \
        -v /root/go/pkg:/go/pkg \
        -v /root/cluster-stack-provider-openstack:/src/cluster-stack-provider-openstack \
        ghcr.io/sovereigncloudstack/cspo-builder:0.1.0 lint-dockerfile;
make: Entering directory '/src/cluster-stack-provider-openstack'
hadolint --version
Haskell Dockerfile Linter 2.12.0
hadolint -t error ./images/cache/Dockerfile ./images/builder/Dockerfile ./images/cspo/Dockerfile
[{"code":"DL3007","column":1,"file":"./images/builder/Dockerfile","level":"warning","line":24,"message":"Using latest is prone to errors if the image will ever
docker run  --rm -t -i \
        -v /root/go/pkg:/go/pkg \
        -v /root/cluster-stack-provider-openstack:/src/cluster-stack-provider-openstack \
        ghcr.io/sovereigncloudstack/cspo-builder:0.1.0 lint-golang;
make: Entering directory '/src/cluster-stack-provider-openstack'
go version
go version go1.21.8 linux/amd64
golangci-lint version
golangci-lint has version 1.56.2 built with go1.22.0 from 58a724a0 on 2024-02-15T18:01:51Z
golangci-lint run -v
INFO [config_reader] Config search paths: [./ /src/cluster-stack-provider-openstack /src /]
INFO [config_reader] Used config file .golangci.yml
INFO [lintersdb] Active 47 linters: [asasalint asciicheck bidichk bodyclose containedctx contextcheck durationcheck errchkjson errname errorlint exhaustive expo
INFO [loader] Go packages loading at mode 575 (files|name|deps|exports_file|types_sizes|compiled_files|imports) took 19.166665856s
INFO [runner/filename_unadjuster] Pre-built 0 adjustments in 6.264492ms
INFO [linters_context/goanalysis] analyzers took 0s with no stages
INFO [runner] Issues before processing: 12, after processing: 0
INFO [runner] Processors filtering stat (out/in): skip_files: 12/12, filename_unadjuster: 12/12, path_prettifier: 12/12, skip_dirs: 12/12, nolint: 0/9, cgo: 12/
INFO [runner] processing took 2.596524ms with stages: nolint: 1.386458ms, identifier_marker: 694.72µs, autogenerated_exclude: 225.582µs, path_prettifier: 149.95
INFO [runner] linters took 545.870908ms with stages: goanalysis_metalinter: 543.154823ms
INFO File cache stats: 0 entries of total size 0B
INFO Memory: 199 samples, avg is 28.6MB, max is 100.1MB
INFO Execution took 19.724938345s
make: Leaving directory '/src/cluster-stack-provider-openstack'
docker run  --rm -t -i \
        -v /root/go/pkg:/go/pkg \
        -v /root/cluster-stack-provider-openstack:/src/cluster-stack-provider-openstack \
        ghcr.io/sovereigncloudstack/cspo-builder:0.1.0 lint-golang-ci;
make: Entering directory '/src/cluster-stack-provider-openstack'
go version
go version go1.21.8 linux/amd64
golangci-lint version
golangci-lint has version 1.56.2 built with go1.22.0 from 58a724a0 on 2024-02-15T18:01:51Z
golangci-lint run -v --out-format=github-actions
INFO [config_reader] Config search paths: [./ /src/cluster-stack-provider-openstack /src /]
INFO [config_reader] Used config file .golangci.yml
INFO [lintersdb] Active 47 linters: [asasalint asciicheck bidichk bodyclose containedctx contextcheck durationcheck errchkjson errname errorlint exhaustive expo
INFO [loader] Go packages loading at mode 575 (types_sizes|compiled_files|exports_file|imports|deps|files|name) took 19.280973388s
INFO [runner/filename_unadjuster] Pre-built 0 adjustments in 6.054439ms
INFO [linters_context/goanalysis] analyzers took 0s with no stages
INFO [runner] Issues before processing: 12, after processing: 0
INFO [runner] Processors filtering stat (out/in): path_prettifier: 12/12, skip_dirs: 12/12, nolint: 0/9, identifier_marker: 12/12, cgo: 12/12, filename_unadjust
INFO [runner] processing took 2.499632ms with stages: nolint: 1.464439ms, identifier_marker: 604.978µs, autogenerated_exclude: 188.612µs, path_prettifier: 117.2
INFO [runner] linters took 531.53592ms with stages: goanalysis_metalinter: 528.934117ms
INFO File cache stats: 0 entries of total size 0B
INFO Memory: 200 samples, avg is 28.1MB, max is 96.1MB
INFO Execution took 19.824791139s
make: Leaving directory '/src/cluster-stack-provider-openstack'
docker run  --rm -t -i \
        -v /root/go/pkg:/go/pkg \
        -v /root/cluster-stack-provider-openstack:/src/cluster-stack-provider-openstack \
        ghcr.io/sovereigncloudstack/cspo-builder:0.1.0 format-golang;
make: Entering directory '/src/cluster-stack-provider-openstack'
go version
go version go1.21.8 linux/amd64
golangci-lint version
golangci-lint has version 1.56.2 built with go1.22.0 from 58a724a0 on 2024-02-15T18:01:51Z
golangci-lint run -v --fix
INFO [config_reader] Config search paths: [./ /src/cluster-stack-provider-openstack /src /]
INFO [config_reader] Used config file .golangci.yml
INFO [lintersdb] Active 47 linters: [asasalint asciicheck bidichk bodyclose containedctx contextcheck durationcheck errchkjson errname errorlint exhaustive exportloopref forcetypeassert gci gocritic godot gofmt gofumpt goprintffuncname gosec gosimple govet importas ineffassign loggercheck makezero misspell nakedret nilerr noctx nolintlint nosprintfhostport prealloc predeclared reassign revive rowserrcheck staticcheck stylecheck tagliatelle thelper tparallel unconvert unused usestdlibvars wastedassign wrapcheck]
INFO [loader] Go packages loading at mode 575 (compiled_files|imports|name|types_sizes|deps|exports_file|files) took 19.231407223s
INFO [runner/filename_unadjuster] Pre-built 0 adjustments in 4.857484ms
INFO [linters_context/goanalysis] analyzers took 0s with no stages
INFO [runner] fixer took 0s with no stages
INFO [runner] Issues before processing: 12, after processing: 0
INFO [runner] Processors filtering stat (out/in): identifier_marker: 12/12, filename_unadjuster: 12/12, skip_dirs: 12/12, skip_files: 12/12, autogenerated_exclude: 12/12, exclude: 12/12, nolint: 0/9, cgo: 12/12, path_prettifier: 12/12, exclude-rules: 9/12
INFO [runner] processing took 1.983836ms with stages: nolint: 1.123755ms, identifier_marker: 451.256µs, autogenerated_exclude: 169.042µs, path_prettifier: 100.982µs, skip_dirs: 95.911µs, cgo: 19.37µs, fixer: 13.66µs, exclude-rules: 6.07µs, filename_unadjuster: 1.72µs, max_same_issues: 400ns, sort_results: 270ns, skip_files: 230ns, exclude: 230ns, severity-rules: 200ns, uniq_by_line: 160ns, max_from_linter: 120ns, source_code: 110ns, diff: 90ns, max_per_file_from_linter: 90ns, path_shortener: 90ns, path_prefixer: 80ns
INFO [runner] linters took 575.996901ms with stages: goanalysis_metalinter: 573.925284ms
INFO File cache stats: 0 entries of total size 0B
INFO Memory: 200 samples, avg is 28.8MB, max is 92.1MB
INFO Execution took 19.817485395s
make: Leaving directory '/src/cluster-stack-provider-openstack'
docker run  --rm -t -i \
        -v /root/go/pkg:/go/pkg \
        -v /root/cluster-stack-provider-openstack:/src/cluster-stack-provider-openstack \
        ghcr.io/sovereigncloudstack/cspo-builder:0.1.0 generate-modules;
make: Entering directory '/src/cluster-stack-provider-openstack'
./hack/golang-modules-update.sh
all modules verified
make: Leaving directory '/src/cluster-stack-provider-openstack'
$ echo $status
0

this commit updates builder images and adds a make target so that we
copy the static executables right from the container image.
it's fast and we don't have to pull it from the internet again and again
if we have the builder image present locally.

This commit also updates go to 1.21.8 patch version.

Signed-off-by: kranurag7 <anurag.kumar@syself.com>
Comment thread images/builder/Dockerfile
Comment thread Makefile
Comment thread images/builder/Dockerfile Outdated
Signed-off-by: kranurag7 <anurag.kumar@syself.com>

@michal-gubricky michal-gubricky left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

lgtm

@chess-knight
chess-knight merged commit b442e23 into main Mar 25, 2024
@chess-knight
chess-knight deleted the kr/new-builder-image branch March 25, 2024 15:06
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

udpate cspo builder image

3 participants