Skip to content

CI: Implement better caching#4

Merged
Nino-K merged 2 commits intorancher-sandbox:mainfrom
mook-as:ci/build-caching
Nov 4, 2025
Merged

CI: Implement better caching#4
Nino-K merged 2 commits intorancher-sandbox:mainfrom
mook-as:ci/build-caching

Conversation

@mook-as
Copy link
Contributor

@mook-as mook-as commented Nov 3, 2025

  • Use RUNNER_TEMP to determine the cache directory
  • Key the cache based on the target architecture and type, to provider better matching for the packages
  • Tell docker buildx to use "local" caching, as the GHA one does not appear to work correctly
  • Add GOCACHE / GOMODCACHE to the docker cache layer information
  • Use arm64 native runners where appropriate
  • Drop the use of actions/setup-go because we never run the go toolchain outside of docker

Note that the arm64 build might fail to cache because the cache is too large and the runner runs out of disk :D Unfortunately we can't do anything about that at the moment.

Sample run: https://github.com/mook-as/rancher-desktop-opensuse/actions/runs/19050938327

- Use `RUNNER_TEMP` to determine the cache directory
- Key the cache based on the target architecture and type, to provider
  better matching for the packages
- Tell docker buildx to use "local" caching, as the GHA one does not appear
  to work correctly
- Add `GOCACHE` / `GOMODCACHE` to the docker cache layer information
- Use arm64 native runners where appropriate
- Drop the use of `actions/setup-go` because we never run the go toolchain
  outside of docker

Signed-off-by: Mark Yen <mark.yen@suse.com>
@mook-as mook-as requested a review from Nino-K November 3, 2025 22:24
runs-on: ${{ matrix.runs-on }}
strategy:
fail-fast: false
matrix:
Copy link
Member

Choose a reason for hiding this comment

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

Would it be clearer if we rewrote the matrix as follows?

      matrix:
        include:
          - type: tar.xz
            arch: amd64
            runs-on: ubuntu-latest
          - type: qcow2
            arch: amd64
            runs-on: ubuntu-latest
          - type: qcow2
            arch: arm64
            runs-on: ubuntu-24.04-arm

We can also remove the exclude.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Hmm, that makes it less clear that the runs-on is directly tied to arch, but it avoids the need to understand the confusing include syntax.

- type: tar.xz
arch: arm64
env:
GO: /bin/false
Copy link
Member

@Nino-K Nino-K Nov 4, 2025

Choose a reason for hiding this comment

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

I noticed that Set up go was removed which suggests that the build runs inside Docker/buildx and doesn't need Go on the runner. But I'm curious why to explicitly fail go invocation? is it still necessary? if so, maybe a comment would be helpful.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

It's just there because the Makefile wants it to be set to something to auto-detect GOOS and GOARCH (which we also provide).

Signed-off-by: Mark Yen <mark.yen@suse.com>
Copy link
Contributor Author

@mook-as mook-as left a comment

Choose a reason for hiding this comment

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

Pushed 8c09d5a

runs-on: ${{ matrix.runs-on }}
strategy:
fail-fast: false
matrix:
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Hmm, that makes it less clear that the runs-on is directly tied to arch, but it avoids the need to understand the confusing include syntax.

- type: tar.xz
arch: arm64
env:
GO: /bin/false
Copy link
Contributor Author

Choose a reason for hiding this comment

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

It's just there because the Makefile wants it to be set to something to auto-detect GOOS and GOARCH (which we also provide).

@Nino-K Nino-K merged commit dd2d050 into rancher-sandbox:main Nov 4, 2025
4 checks passed
@mook-as mook-as deleted the ci/build-caching branch November 12, 2025 23:11
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.

2 participants