How to have Bamboo artifacts collect a whole folders?
Asked Answered
L

3

14

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)

Leicester answered 15/2, 2013 at 12:51 Comment(0)
B
13

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.

Backhanded answered 7/8, 2013 at 20:33 Comment(1)
@hatesms yes, it will.Nest
K
3

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

Kovacs answered 6/3, 2013 at 6:57 Comment(3)
Please see my question: "How can i setup Artifact Definition for collect folder with files". My main goal: Open html report file with screenshots by web. If i collect all files to archive, first I should download, unpack and only after all open report. This is inconvenient.Leicester
Yes, I am already did this script. In this way my archive have size 50mb. And after each build i should download this archive.. it is no good way.Leicester
I ended up taking the same approach to reuse my node_modules folder as an artifact. I added a "command" task with the executable being "tar" and "-cvzf node_modules.tar.gz ./node_modules/" as the argument. Then after creating an artifact dependency in the consuming job, I create a corresponding "command" task where I need to use the artifact with the only difference being the argument value: "-xvzf node_modules.tar.gz"Bradawl
T
3

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

Trivium answered 21/7, 2017 at 12:21 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.