‹ BackHN Continuity

Thread

Scaling Golang CI by Replacing actions/setup-go

77 points · 26 comments · peterldowns

  1. JyB · · focus · HN ↗
    Have you considered submitting an upstream patch to the widely used actions/setup-go as well?
    1. peterldowns · · focus · HN ↗
      Good question — we'd be happy to submit a PR, but it's not clear to me that they'd be interested. Some background:

      - Our approach writes new cache entries all the time. This can get expensive, and is a pretty big change in behavior from how actions/setup-go works today.

      - actions/setup-go can basically be considered incredibly critical infrastructure for the public golang ecosystem. Any change in behavior is probably very risky and slow to happen. At this point I'd bet that we see no change, ever, in behavior.

      Additionally there are a few relevant issues/prs that have been ignored for years so I'm not optimistic about contributing upstream. Frankly what we've done is write a very small bit of glue code that is likely most effective as a reference for teams writing their own custom caching actions that fit their exact needs:

      - <a href="https:&#x2F;&#x2F;github.com&#x2F;actions&#x2F;setup-go&#x2F;pull&#x2F;426" rel="nofollow">https:&#x2F;&#x2F;github.com&#x2F;actions&#x2F;setup-go&#x2F;pull&#x2F;426

      - <a href="https:&#x2F;&#x2F;github.com&#x2F;actions&#x2F;setup-go&#x2F;issues&#x2F;630" rel="nofollow">https:&#x2F;&#x2F;github.com&#x2F;actions&#x2F;setup-go&#x2F;issues&#x2F;630

      - <a href="https:&#x2F;&#x2F;github.com&#x2F;actions&#x2F;setup-go&#x2F;issues&#x2F;395" rel="nofollow">https:&#x2F;&#x2F;github.com&#x2F;actions&#x2F;setup-go&#x2F;issues&#x2F;395

      - <a href="https:&#x2F;&#x2F;github.com&#x2F;actions&#x2F;setup-go&#x2F;issues&#x2F;596" rel="nofollow">https:&#x2F;&#x2F;github.com&#x2F;actions&#x2F;setup-go&#x2F;issues&#x2F;596

      That said we&#x27;d be happy if someone used our code and found it valuable! Lukas put a ton of effort into cleaning up my initial version, added the cache trimming, etc. We depend on this for all of our jobs and use it every day and think it&#x27;s quite good.

      1. qmuntal · · focus · HN ↗
        actions&#x2F;setup-go maintainer here! Great post, I like the ideas in there. We are always open to improvements, but it&#x27;s true that low-risk ones are preferred. Feel free to submit your ideas to the GitHub issue tracker. I&#x27;ll do some due diligence myself.
        1. peterldowns · · focus · HN ↗
          Thanks for reading :) Broken down by key idea:

          - Allowing actions&#x2F;setup-go users to specify a cache key prefix so that they can have more than one golang CI job, each with its own cache: this is 100% worth upstreaming. I believe there are existing requests and PRs about this. Up to you guys to implement however you see fit.

          - Allowing &quot;always update the cache&quot;: also a good idea to enable as an option, very important for non-open-source teams that are trying to maximize cache hit rate.

          - Allowing &quot;trim the cache&quot;: if you&#x27;re going to allow always updating the cache, probably a good idea.

          But the &quot;always update&quot; and &quot;trim&quot; cache changes combine to have a lot of risks regarding cache poisoning that might be bad for open source projects. Lukas may have a different opinion or more to say on this front.

Open on Hacker News to reply ↗

Unofficial Hacker News client; not affiliated with Y Combinator.