Reputation: 20547
Hello I am trying to add the output binary of my pipeline to the build-in artifactory.
image: golang:1.13
pipelines:
default:
- step:
script:
- PACKAGE_PATH="${GOPATH}/src/bitbucket.org/${BITBUCKET_REPO_FULL_NAME}"
- mkdir -pv "${PACKAGE_PATH}"
- tar -cO --exclude-vcs --exclude=bitbucket-pipelines.yml . | tar -xv -C "${PACKAGE_PATH}"
- cd "${PACKAGE_PATH}"
- go get -v
- env GOOS=windows GOARCH=amd64 go build
- go build -v
- ls
artifacts:
- fx_update.exe
However, the binary does not end up in the artifactory:
So I threw this ls
command in there to see if the .exe is present and Indeed it is:
Does anyone know why it's not doing what I want?
Upvotes: 1
Views: 1340
Reputation: 4557
That's because you cd
to the package directory before creating artifacts. Artifacts definitions are relative to the build directory, not to the current working directory (see this page for more details https://confluence.atlassian.com/bitbucket/using-artifacts-in-steps-935389074.html). You can fix this by copying the fx_update.exe
to the base build directory:
- step:
script:
- PACKAGE_PATH="${GOPATH}/src/bitbucket.org/${BITBUCKET_REPO_FULL_NAME}"
- mkdir -pv "${PACKAGE_PATH}"
- tar -cO --exclude-vcs --exclude=bitbucket-pipelines.yml . | tar -xv -C "${PACKAGE_PATH}"
- cd "${PACKAGE_PATH}"
- go get -v
- env GOOS=windows GOARCH=amd64 go build
- go build -v
- cp fx_update.exe ${BITBUCKET_CLONE_DIR}
artifacts:
- fx_update.exe
Upvotes: 3