Skip to content

Using Resource Inputs in Job Tasks

Note, the topic of running unit tests in your pipeline will be covered in more detail in future sections.

Consider a simple application that has unit tests. In order to run those tests inside a pipeline we need:

  • a task image that contains any dependencies
  • an input resource containing the task script that knows how to run the tests
  • an input resource containing the application source code

For the example Go application simple-go-web-app, the task image needs to include the Go programming language. We will use the golang:1.9-alpine image from (see for size of layers)

The task file task_run_tests.yml includes:

  type: docker-image
  source: {repository: golang, tag: 1.9-alpine}

- name: resource-tutorial
- name: resource-app
  path: gopath/src/

The resource-app resource will place the inbound files for the input into an alternate path. By default we have seen that inputs store their contents in a folder of the same name. The reason for using an alternate path in this example is specific to building & testing Go language applications and is outside the scope of the section.

To run this task within a pipeline:

cd ../job-inputs
fly -t tutorial set-pipeline -p simple-app -c pipeline.yml
fly -t tutorial unpause-pipeline -p simple-app

View the pipeline UI and notice that the job automatically starts.


The job will pause on the first run at web-app-tests task because it is downloading the golang:1.9-alpine image for the first time.

The web-app-tests output below corresponds to the Go language test output (in case you've not seen it before):

ok 0.003s