Another new feature: build artifacts!
Quite a few of our users have added custom steps to the end of their builds to upload things like log files, coverage reports or deployment tarballs off the VMs for later consumption. This works okay, but it has some drawbacks – in particular, the need to insert upload credentials into the build, and that the uploaded artifacts aren’t linked from each build.
So we’ve made a feature of it! Now we can very easily save and link to any files created as part of your build. Here’s how it works: as part of your build, just write files into the
$CIRCLE_ARTIFACTS directory. We’ll take it from there.
Here’s a simple demo build script:
echo "<p>Hello, <img width=80 src='img/world.svg'></p>" \ > $CIRCLE_ARTIFACTS/hello.html mkdir $CIRCLE_ARTIFACTS/img curl "http://wikimedia.org/wikipedia/commons/e/e2/Ambox_globe.svg" \ > $CIRCLE_ARTIFACTS/img/world.svg
At the end of each build, there’s a collection step:
When this step completes, links to uploaded artifacts appear at the top of the build page:
Clicking each link shows the uploaded file. Here’s our ‘hello.html’:
If you prefer, you can also interact with artifacts programmatically via the API.
We’ll probably add bells and whistles to this feature over time, but for now, that’s about it!
In early testing, we had users using the feature to:
Create linked karma-coverage code reports of a node.js project.
Create surefire test reports of a maven project.
Record and upload screenshots of headless browser test failures, to ease debugging.
Record and upload videos of all their headless browser tests in action, to be able to visualize the test behavior.
Save nohup.out to diagnose a failing background job.
Upload compiled .jar files.
We’d love to hear if you find other cool uses for them, or have ideas to refine or improve the way it works!
The full documentation is here.