Cannot use cache when running on local
I have the following pipeline to build a go binary:
variables:
DOCKER_VERSION: "24.0.7"
FF_USE_FASTZIP: "true"
GOLANGCI_LINT: "v1.55.2"
GOLANG_VERSION: "1.21.6"
GORELEASER_VERSION: "v1.23.0"
HELM_VERSION: "v3.13.3"
.docker:
image: golang:${GOLANG_VERSION}-alpine
services:
- docker:${DOCKER_VERSION}-dind
variables:
DOCKER_HOST: tcp://docker:2375
DOCKER_TLS_CERTDIR: ""
DOCKER_DRIVER: overlay2
.dagger:
extends: [.docker]
before_script: |
apk add docker-cli curl
cd /usr/local && { curl -L https://dl.dagger.io/dagger/install.sh | sh; cd -; }
image:
name: golang:${GOLANG_VERSION}
stages:
- validate
- build
- test
- install
- release
.go-cache:
variables:
GOPATH: $CI_PROJECT_DIR/.go
before_script: |
mkdir -p "${GOPATH}"
chmod -R 777 "${GOPATH}"
cache:
paths:
- "${GOPATH}/pkg/mod/"
validate-job:
stage: validate
before_script:
- apt-get -qq update && apt-get install -y shellcheck
script: |
shellcheck install-binary.sh
build-job:
stage: build
extends: [.go-cache]
script: |
make build
test-job:
stage: test
extends: [.go-cache]
before_script:
- curl -fsSL https://raw.githubusercontent.com/golangci/golangci-lint/master/install.sh | sh -s -- -b $(go env GOPATH)/bin "${GOLANGCI_LINT}"
script: |
make test
install-job:
stage: install
extends: [.go-cache]
before_script:
- curl -fsSL -o get_helm.sh https://raw.githubusercontent.com/helm/helm/main/scripts/get-helm-3
- chmod 700 get_helm.sh
- ./get_helm.sh --version "${HELM_VERSION}"
script: |
make install
release-job:
stage: release
extends: [.dagger]
variables:
GIT_DEPTH: 0
CI_DEBUG_TRACE: "true"
only:
refs:
- tags
script: |
unset http_proxy
unset https_proxy
unset HTTP_PROXY
unset HTTPS_PROXY
docker run --rm --privileged \
-v $PWD:/go/src/github.com/test/test-helm \
-w /go/src/github.com/test/test-helm \
-v /var/run/docker.sock:/var/run/docker.sock \
-e GITLAB_TOKEN \
goreleaser/goreleaser release --clean --debug
I want to execute on local using the following command :
gitlab-ci-local release-job
gitlab-ci-local --version
4.46.0
docker version
Client:
Cloud integration: v1.0.35+desktop.5
Version: 24.0.7
API version: 1.43
Go version: go1.20.10
Git commit: afdd53b
Built: Thu Oct 26 09:04:20 2023
OS/Arch: darwin/arm64
Context: desktop-linux
Server: Docker Desktop 4.26.1 (131620)
Engine:
Version: master
API version: 1.44 (minimum version 1.12)
Go version: go1.21.3
Git commit: 54fcd40aa4de94cd75aedc5f6ebf38c6d8f92082
Built: Wed Nov 22 07:43:39 2023
OS/Arch: linux/arm64
Experimental: false
containerd:
Version: 1.6.25
GitCommit: d8f198a4ed8892c764191ef7b3b06d8a2eeb5c7f
runc:
Version: 1.1.10
GitCommit: v1.1.10-0-g18a0cb0
docker-init:
Version: 0.19.0
GitCommit: de40ad0
The build start and reach the end until the cache is supposed to be saved using a docker cp
from a container to my local directory ./gitlab-ci-local
Error: Command failed with exit code 1: docker cp c2dec079860a5bfaafb26d8ae0e4232bb04a00efb8d370c0b9ccfac0caa2589b:/cache/. .gitlab-ci-local/cache/.
chmod /Users/xxx/git/xxx/test-for-helm/.gitlab-ci-local/cache/default/.go/pkg/mod/github.com/!burnt!sushi/toml@v1.3.2/.github: operation not permitted
Executing this command by hand work only if adding sudo before.
Thanks in advance