How to save artifacts in Bitbucket-Pipelines

Patrick Spiegel picture Patrick Spiegel · Oct 11, 2017 · Viewed 12k times · Source

I am new to bamboo. What I try to do is collecting all .dacpac files that are created during the build process.

image: microsoft/dotnet:latest
pipelines:
 default: 
 - step: 
 script: # Modify the commands below to build your repository. 
 - cd BackgroundCode 
 - dotnet restore 
 - dotnet run 
 artifacts: 
 - '../**/*.dacpac'

The directory structure would be

'agent/build/Projects/[Projectname]/[Projectname].dacpac'.

The output of the pipeline says

Successfully generated zip archive /opt/atlassian/pipelines/agent/build/Projects/[ProjectName]/[ProjectName].dacpac

which means there are really files generated during the build process. Have I done something wrong? If no, where would I find those artifacts.

Answer

Georg Moser picture Georg Moser · Mar 18, 2018

Unfortunately according to the documentation all artifacts are deleted after the pipeline run:

https://confluence.atlassian.com/bitbucket/using-artifacts-in-steps-935389074.html

"Once a pipeline completes, whether it succeeds or fails, the artifacts are deleted."

However you can deploy artifacts to the Bitbucket downloads section, or anywhere else:

https://confluence.atlassian.com/bitbucket/deploy-build-artifacts-to-bitbucket-downloads-872124574.html

- step:
    name: Archive
    script:
      - curl -X POST --user "${BB_AUTH_STRING}" "https://api.bitbucket.org/2.0/repositories/${BITBUCKET_REPO_OWNER}/${BITBUCKET_REPO_SLUG}/downloads" --form files=@"something/**"