This is my first step in the pipeline:
- step:
name: build & test
caches:
- gomodules
script:
- PACKAGE_PATH="${GOPATH}/src/bitbucket.org/${BITBUCKET_REPO_OWNER}/${BITBUCKET_REPO_SLUG}"
- mkdir -pv "${PACKAGE_PATH}"
- tar -cO --exclude-vcs --exclude=bitbucket-pipelines.yml . | tar -xv -C "${PACKAGE_PATH}"
- cd "${PACKAGE_PATH}"
- if [ ! -d "vendor" ] || [ -z "$(ls -A vendor)" ]; then go mod vendor; fi
- go test -mod=vendor ./...
artifacts:
- vendor/**
When I do
$ ls vendor
I see the content of the vendor directory. It is not empty.
But when I do `$ ls .` in the next step the `vendor` directory isn't there.
Here are my definitions:
definitions:
caches:
gomodules: vendor
It seems I am doing everything according to specification but artifact is not passed to the next step. Any help with this?
I've already clear the old cache. Btw. The new cache for the gomodule is not created also.
Solved:
The artifact should be in the root path:
Updated code:
script:
- CURRENT_PATH=$(pwd)
- PACKAGE_PATH="${GOPATH}/src/bitbucket.org/${BITBUCKET_REPO_OWNER}/${BITBUCKET_REPO_SLUG}"
- mkdir -pv "${PACKAGE_PATH}"
- tar -cO --exclude-vcs --exclude=bitbucket-pipelines.yml . | tar -xv -C "${PACKAGE_PATH}"
- cd "${PACKAGE_PATH}" - if [ ! -d "vendor" ] || [ -z "$(ls -A vendor)" ]; then go mod vendor; fi
- cp -r vendor $CURRENT_PATH/vendor
- go test -mod=vendor ./...
And for the custom cache:
definitions:
caches:
gomodules: /go/src/bitbucket.org/x/x/vendor
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.