X

The Wercker blog covers continuous delivery to the cloud

Did you know you can access reports, logs, screenshots, etc., from your build?

Mark Nelson
Architect

Often we create various data during a build that we might want access to after the build is finished.  Examples include logs, test results, maybe even screenshots.  This kind of information is often especially important if the build failed. 

Wercker has a feature that allows you to make this kind of data easily available from the web UI.  If you place data into the special directory $WERCKER_REPORT_ARTIFACTS_DIR during your build, Wercker will save that data for you and make it available to download (in a tarball) by pressing the "Download artifact" button which you can find under the step that created the data, as you can see in the image below.

In the past, this feature worked when a step passed, but if the step failed, we did not collect the data.  In response to user requests, we have just updated this feature so that it will also capture this data when a step fails.  So now you can write data into the reports directory during your step, and if the step fails you can easily get access to that data, which is very useful for troubleshooting issues in the step. 

To use this feature, you can just place data into that directory in your wercker.yml.  Here is an example:

build:
  steps:
    # Run the test and save the output
    - script: 
      name: Run my test
      code: |
        run_test.sh > $WERCKER_REPORT_ARTIFACTS_DIR/some-output.txt
    # Take a screenshot of the application's home page
    - screenshot:
      url: https://www.myapp.com
      filename: myapp.png

After the step has completed, you can download the artifacts from the web UI.  You will get a tarball with any data that was written into that directory.  In the example above, this would contain the file some-output.txt and the screenshot myapp.png.

 

Be the first to comment

Comments ( 0 )
Please enter your name.Please provide a valid email address.Please enter a comment.CAPTCHA challenge response provided was incorrect. Please try again.