#persist gomodcache between CI runs

21 messages · Page 1 of 1 (latest)

undone swallow
#

I am using woodpecker-ci, anyone knows how I can cache the module downloads between runs? takes forever.
there is a volume mount option, but I have no idea where the folders for the cache live.

hearty cypress
#

it'll depend on which image you're using

undone swallow
#

Let me get the yml file real quick

#
when:
    - event: push
      branch: "**"

steps:
    - name: lint
      image: golangci/golangci-lint:v2.0.2
      commands:
          - golangci-lint run -v
hearty cypress
#

looks like it's /go/pkg

#

mount a folder to that path and you should be good

undone swallow
hearty cypress
#

if you're using the golang image to compile as well, you should be able to use the same path there too

rose geyser
#

you can compare with the github actions, I think the directories are configurable (like for go itself people change the gopath so it gets cached)

undone swallow
#

my slow brain eventually figured out I could copy busybox over and use that to get a shell

undone swallow
#

@hearty cypress @rose geyser after much work I managed to make this monster of a CI pipeline work

#

well, it's a pretty standard pipeline but the code generation and caching the tooling was an annoyance

rose geyser
#

grats. what’s ur cache key?

undone swallow
#

may just do a checksum based on go.mod and go.sum and invalidate everything based on if it changes

rose geyser
#

can you have more than 1 build in flight? (is the cache some s3 bucket or shared somehow or just local to runner)

undone swallow
#

sorry, I lied. it's not local to the runner

#

but we only have 1 runner