Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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)

like image 999
Vladimir Avdeev Avatar asked Feb 15 '13 12:02

Vladimir Avdeev


People also ask

Where are bamboo artifacts stored?

Bamboo stores artifacts, build working and project directories in the home directory. There are some instances where users will be interested in having this stored outside of Bamboo or even in a network to preserve space on the build machine.

What is an artifact in bamboo?

An artifact is defined in Bamboo by the use of an Ant Copy Pattern and a location relative to the top of the build directory. Many approaches can be used to select files to be included as an artifact so there are bound to be many ways to do this.


2 Answers

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

like image 99
Qw3ry Avatar answered Sep 28 '22 03:09

Qw3ry


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.

like image 23
jfajunior Avatar answered Sep 28 '22 04:09

jfajunior