Vladimir Avdeev
Vladimir Avdeev

Reputation: 306

How to have Bamboo artifacts collect a whole folders?

I have one simple plan with one simple job.

Tasks:

  1. Source code checkout
  2. MSBuild
  3. Run tests
  4. Generate test report

In four steps, my utility generates a test report with screenshots. The report contain absolute links to images. (for example: onclick="window.open('./Screenshots/66ef3a03-8b82-4b40-b49d-b0155e273738.png');return false;").

If I open the report on my local machine, the report works fine, but on Bamboo I receive the error "Page Not Found", because Bamboo has not collected "Screenshots" folder.

How can I set up the Artifact Definition to collect folder with files?

P.S. I tried to set the \*.* copy pattern, but Bamboo collected only files (without folders and subfolders)

Upvotes: 14

Views: 22579

Answers (3)

jfajunior
jfajunior

Reputation: 1251

You just have to give the folder Location, like "build/", for instance, and then, in the Copy Pattern you can put **/*.* That should copy all the files you want.

Please note that:

  • The location is relative to the build directory. Do not use the absolute path to refer to the location.
  • Asterisks are not supported for Location. For this field, provide the folder name where the file would be located.

Plus, you can define as many Artifact Definitions as you want.

Upvotes: 13

Qw3ry
Qw3ry

Reputation: 1429

Bamboo uses the "Ant file copy pattern".

  • Matching recursively against all files: **/*
    • This does include almost everything
    • Unfortunately this does not include dot-files, at least in my test on a linux build agent. I could not find a workaround apart from a second artifact (pattern **/.*) or the creation of an archive.
  • Matching against all files in any subfolder: */*
    • This does not include foo/bar/test.xyz
    • This does include both foo/test.xyz and bar/test.xyz

You can do more advanced matching; e.g. you can use build/**/*.jar to copy all jars from a build directory. For further info see the docs

Upvotes: 3

Johan de Klerk
Johan de Klerk

Reputation: 2535

The best way of doing this is to zip all you artifact together. I created a bash script to do this

cd "toArtifactFolder"
zip -r Artifact .

Then in bamboo project settings you have to edit the Artifact and changed the location to where ever the artifact zip file is Then in the Copy Pattern just enter the zip file eg Artifact.zip

Upvotes: 3

Related Questions