Skip to content

Conversation

dereknola
Copy link
Member

Proposed Changes

  • Add later CI actions of package and airgap to the Dockerfile.local, moving closer to achieving parity with the Dapper Dockerfile
  • Breakup version.sh script into git_version.sh and version.sh. This improves caching around build layers, as .git no longer needs to be added to build targets, all git versioning information is calculated beforehand.
Overhaul of build_k3s.yaml GHA workflow:
  • Rework workflow inputs: arch and cache. Initial support for emulated builds.
  • Introduce layer caching using GHCR. This save about 1min to the build times and uses GHCR (with unlimited storage) vs the dedicated GHA cache (which we only have 10GB of)
  • Use faster Dockerfile.local targets where possible, using native GHA calls to docker

Types of Changes

CI/Build

Verification

  • CI Still green
  • use new make targets make local-image or make local-binary

Performance

Setup is as follows:

  • 1 is initial build with no cache (this is the most variable and dependent on download time)
  • 2 is build with a single line change in pkg/cli (i.e. code change)
  • 3 is build with no line changes (just to see maximum caching usage)
Target Stage Dapper Old Local New Local
Binary 1 3m 22s 3m 22s 3m 36s
2 1m 58s 45s 40s
3 1m 21s 2s 2s
Image 1 3m 18s N/A 3m 33s
2 1m 36s N/A 1m
3 1m 34s N/A 3s

Testing

N/A

Linked Issues

#12136

User-Facing Change


Further Comments

Future work is required to achieve nice build emulation times, with an eye on building arm32bit and potential riscv64. Need to look at QEMU emulation cost or implement xx usage, possibly with a separate builds stage.

@dereknola dereknola requested a review from a team as a code owner April 22, 2025 22:22
Seperate git and other version tags, improves caching on binary builds

Signed-off-by: Derek Nola <derek.nola@suse.com>
Signed-off-by: Derek Nola <derek.nola@suse.com>
- Build binary using GHA native commands
- Use internal setup-go action for e2e.yaml

Signed-off-by: Derek Nola <derek.nola@suse.com>
- Be consistent in k3s artifact names
- Fix sha256sum CI naming

Signed-off-by: Derek Nola <derek.nola@suse.com>
Signed-off-by: Derek Nola <derek.nola@suse.com>
@dereknola dereknola force-pushed the build_k3s_overhaul branch from 9dbedeb to 6bb2ca5 Compare April 23, 2025 03:36
Copy link

codecov bot commented Apr 23, 2025

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 19.81%. Comparing base (9604f27) to head (1bded1c).
Report is 3 commits behind head on master.

❗ There is a different number of reports uploaded between BASE (9604f27) and HEAD (1bded1c). Click for more details.

HEAD has 18 uploads less than BASE
Flag BASE (9604f27) HEAD (1bded1c)
inttests 12 0
e2etests 6 0
Additional details and impacted files
@@             Coverage Diff             @@
##           master   #12200       +/-   ##
===========================================
- Coverage   45.13%   19.81%   -25.32%     
===========================================
  Files         188      184        -4     
  Lines       19219    19144       -75     
===========================================
- Hits         8675     3794     -4881     
- Misses       9310    14920     +5610     
+ Partials     1234      430      -804     
Flag Coverage Δ
e2etests ?
inttests ?
unittests 19.81% <ø> (+<0.01%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

vitorsavian
vitorsavian previously approved these changes Apr 23, 2025
VestigeJ
VestigeJ previously approved these changes Apr 23, 2025
Signed-off-by: Derek Nola <derek.nola@suse.com>
@dereknola dereknola dismissed stale reviews from VestigeJ and vitorsavian via 7debdfc April 23, 2025 17:00
vitorsavian
vitorsavian previously approved these changes Apr 23, 2025
VestigeJ
VestigeJ previously approved these changes Apr 23, 2025
@echo "INFO: Building K3s airgap tarball..."
./scripts/package-airgap

.PHONY: local-ci
Copy link
Member

Choose a reason for hiding this comment

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

so the new recommended dev workflow is make local-ci instead of make ci? Or does the old target still work, at least for now?

Copy link
Member Author

Choose a reason for hiding this comment

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

The old targets still work, I have not removed Dapper or touched the old build process. But yes, for better performance, I would recommend make local-ci or whatever subtarget you need for the dev process.

Dapper removal will be a future PR, likely only once we have successfully published a release with these new processes.

brandond
brandond previously approved these changes Apr 23, 2025
Signed-off-by: Derek Nola <derek.nola@suse.com>
@dereknola dereknola dismissed stale reviews from brandond, VestigeJ, and vitorsavian via 73ecd6e April 24, 2025 16:17
Signed-off-by: Derek Nola <derek.nola@suse.com>
@dereknola dereknola force-pushed the build_k3s_overhaul branch from a4a9be6 to 1bded1c Compare April 24, 2025 19:14
@dereknola dereknola merged commit 3ce4a63 into k3s-io:master Apr 25, 2025
61 checks passed
@dereknola dereknola deleted the build_k3s_overhaul branch April 28, 2025 15:51
@GreyXor
Copy link

GreyXor commented Apr 30, 2025

Thanks, would that make sense to also add GOAMD64=v4 build for whom have x86_64-v4 cpu ?

dereknola added a commit to dereknola/k3s that referenced this pull request Jun 2, 2025
* Add full ci support without Dapper
* Seperate git and other version tags, improves caching on binary builds
* Use new local targets for build-k3s.yaml workflow
* Allow optional ghcr build caching
* Build binary using GHA native commands
* Use internal setup-go action for e2e.yaml
* Add emulation builds to k3s-build.yaml (for arm32 and future riscv64)
* Be consistent in k3s artifact names
* Fix package/dockerfile warnings
* Fix install script for PR installs

Signed-off-by: Derek Nola <derek.nola@suse.com>
dereknola added a commit to dereknola/k3s that referenced this pull request Jun 2, 2025
* Add full ci support without Dapper
* Seperate git and other version tags, improves caching on binary builds
* Use new local targets for build-k3s.yaml workflow
* Allow optional ghcr build caching
* Build binary using GHA native commands
* Use internal setup-go action for e2e.yaml
* Add emulation builds to k3s-build.yaml (for arm32 and future riscv64)
* Be consistent in k3s artifact names
* Fix package/dockerfile warnings
* Fix install script for PR installs

Signed-off-by: Derek Nola <derek.nola@suse.com>
dereknola added a commit to dereknola/k3s that referenced this pull request Jun 9, 2025
* Add full ci support without Dapper
* Seperate git and other version tags, improves caching on binary builds
* Use new local targets for build-k3s.yaml workflow
* Allow optional ghcr build caching
* Build binary using GHA native commands
* Use internal setup-go action for e2e.yaml
* Add emulation builds to k3s-build.yaml (for arm32 and future riscv64)
* Be consistent in k3s artifact names
* Fix package/dockerfile warnings
* Fix install script for PR installs

Signed-off-by: Derek Nola <derek.nola@suse.com>
dereknola added a commit that referenced this pull request Jun 10, 2025
* Add full ci support without Dapper
* Seperate git and other version tags, improves caching on binary builds
* Use new local targets for build-k3s.yaml workflow
* Allow optional ghcr build caching
* Build binary using GHA native commands
* Use internal setup-go action for e2e.yaml
* Add emulation builds to k3s-build.yaml (for arm32 and future riscv64)
* Be consistent in k3s artifact names
* Fix package/dockerfile warnings
* Fix install script for PR installs

Signed-off-by: Derek Nola <derek.nola@suse.com>
dereknola added a commit that referenced this pull request Jun 10, 2025
* Add full ci support without Dapper
* Seperate git and other version tags, improves caching on binary builds
* Use new local targets for build-k3s.yaml workflow
* Allow optional ghcr build caching
* Build binary using GHA native commands
* Use internal setup-go action for e2e.yaml
* Add emulation builds to k3s-build.yaml (for arm32 and future riscv64)
* Be consistent in k3s artifact names
* Fix package/dockerfile warnings
* Fix install script for PR installs

Signed-off-by: Derek Nola <derek.nola@suse.com>
dereknola added a commit to dereknola/k3s that referenced this pull request Jul 3, 2025
* Add full ci support without Dapper
* Seperate git and other version tags, improves caching on binary builds
* Use new local targets for build-k3s.yaml workflow
* Allow optional ghcr build caching
* Build binary using GHA native commands
* Use internal setup-go action for e2e.yaml
* Add emulation builds to k3s-build.yaml (for arm32 and future riscv64)
* Be consistent in k3s artifact names
* Fix package/dockerfile warnings
* Fix install script for PR installs

Signed-off-by: Derek Nola <derek.nola@suse.com>
dereknola added a commit that referenced this pull request Jul 7, 2025
* Add full ci support without Dapper
* Seperate git and other version tags, improves caching on binary builds
* Use new local targets for build-k3s.yaml workflow
* Allow optional ghcr build caching
* Build binary using GHA native commands
* Use internal setup-go action for e2e.yaml
* Add emulation builds to k3s-build.yaml (for arm32 and future riscv64)
* Be consistent in k3s artifact names
* Fix package/dockerfile warnings
* Fix install script for PR installs

Signed-off-by: Derek Nola <derek.nola@suse.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants