Engineering Blog

Concourse Metadata Resource

By Paul on March 01, 2017

tl;dr

A useful little resource

We love Concourse. In the past I've worked a lot with TeamCity, and although it's a fantastic piece of kit, it doesn't fit our CI/CD needs as well as Concourse does. Continuous integration and deployment is a series of steps - a pipeline if you will, and that's something that Concourse offers in spades.

However one thing TeamCity offers over and above what I can get out of Concourse is the ability to display arbitary tabs with things like nicely formated test results from our build. We have some test results from nunit that we format nicely with ReportUnit, but unfortunately, concourse offers us no way to display this in the UI.

So what's the solution? I thought of 2 possible solutions:

  1. add the ability to display arbitary html output in Concourse
  2. host the html elsewhere and link to it from concourse

Since we aren't going to be looking at these all the time, we can probably get away with the second. To make it really useful however, it would be handy to be able to directly click a link in the Concourse build output - a feature that needs to be added to Concourse. - See this issue.

We operate in AWS, and can easily store our output in S3. So that's what we've done. It's secured via an nginx/oauth2_proxy setup - food for another post.

To enable this immediately, we've created the Concourse Metadata Resource. It doesn't do much. Just spits back out the metadata you give it. But in this case, we can store our generated html in S3 using another resource put, serve it up behind nginx and create a link using the metadata resource pointing at that specific version of the output.

A put for the test output might look something like this:

- put: test-metadata
    params:
      ref: $BUILD_PIPELINE_NAME/$BUILD_JOB_NAME/$BUILD_NAME
      metadata:
      - test-output-location: https://example.com/$BUILD_PIPELINE_NAME/$BUILD_JOB_NAME/$BUILD_NAME/Test-Results.html
      - another-thing: "Hello - Successful build"

The metadata is returned as is - substituting the environment variables.

This gives us a link to our pretty html formated test results.

So..... Let us know what you think.