Missed Team ’24? Catch up on announcements here.

×
Create
cancel
Showing results for 
Search instead for 
Did you mean: 
Sign up Log in

Bitbucket pipieline is not passing the artifact to next step

kodersky September 18, 2019

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.

1 answer

1 accepted

0 votes
Answer accepted
kodersky September 18, 2019

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

Suggest an answer

Log in or Sign up to answer
TAGS
AUG Leaders

Atlassian Community Events