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

Unable to cache more than one version of buf #71

Closed
jeffj254 opened this issue Oct 7, 2024 · 3 comments · Fixed by #72
Closed

Unable to cache more than one version of buf #71

jeffj254 opened this issue Oct 7, 2024 · 3 comments · Fixed by #72

Comments

@jeffj254
Copy link

jeffj254 commented Oct 7, 2024

We use self-hosted runners with a hostedtoolcache of various tools and versions that our developers use. We build the cache following GitHub's recommendation here: https://docs.github.com/en/[email protected]/admin/managing-github-actions-for-your-enterprise/managing-access-to-actions-from-githubcom/setting-up-the-tool-cache-on-self-hosted-runners-without-internet-access

The process is pretty simple, you basically just call the setup- actions for whatever tools you need and then tarball up the hostedtoolcache directory. Extract that into your runner image build and off you go.

When I try to do this with buf I get an error while trying to setup the second version that the requested version doesn't match what is in the PATH. Is it possible to add an additional parameter to allow a second version to be cached?

example workflow:

      # Buf
      - name: setup buf 1.35.1
        uses: bufbuild/buf-action@v1
        with:
          version: 1.35.1
          setup_only: true
      - name: setup buf 1.44.0
        uses: bufbuild/buf-action@v1
        with:
          version: 1.44.0
          setup_only: true

Error message with this workflow:

Run bufbuild/buf-action@v1
Using the version of buf from the input: 1.44.0
Using buf (1.35.1) found in $PATH
Error: The version of buf (1.35.1) does not equal the resolved version (1.44.0)
@emcfarlane
Copy link
Collaborator

emcfarlane commented Oct 8, 2024

Hi @jeffj254, the buf-action allows for installing Buf by other means then the GitHub action and then checks that version matches the intended. The second install is using the path provided by the previous, so a workaround would be to alter the path removing the buf toolcache before invoking the second one. If other actions always install into the toolcache I think this behaviour should be revisited for consistency. Could you expand more on why you require multiple versions of buf to be added to the toolcache?

@jeffj254
Copy link
Author

jeffj254 commented Oct 9, 2024

We provide self-hosted runners to many different dev teams who may require different versions of tools. To improve build times and reduce bandwidth usage we will cache commonly used versions on our ephemeral runner image so they do not require a download for every job. For example we cache Node 16, 20, and 22. We would like to do the same with buf and cache a few different versions, but right now the action does not allow you to "setup" more than one version.

emcfarlane added a commit that referenced this issue Oct 9, 2024
This avoids requiring the version of Buf found in the PATH to match the
resolved. Fallback to installing a new explicit version in the
toolcache.

Fixes #71
@emcfarlane
Copy link
Collaborator

@jeffj254 released in v1.0.2!

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 a pull request may close this issue.

2 participants