Home

Awesome

Concourse Pipeline Resource (DEPRECATED)

This resource is deprecated in favor of the set_pipeline step. No new versions will be released.

If there are limitations to the set_pipeline step that don't let you switch to it right now, please let us know in concourse/rfcs#31

Get and set concourse pipelines from concourse.

Installing

Use this resource by adding the following to the resource_types section of a pipeline config:

---
resource_types:
- name: concourse-pipeline
  type: docker-image
  source:
    repository: concourse/concourse-pipeline-resource

See concourse docs for more details on adding resource_types to a pipeline config.

Source configuration

Check returns the versions of all pipelines. Configure as follows:

---
resources:
- name: my-pipelines
  type: concourse-pipeline
  source:
    target: https://my-concourse.com
    insecure: "false"
    teams:
    - name: team-1
      username: some-user
      password: some-password
    - name: team-2
      username: other-user
      password: other-password

in: Get the configuration of the pipelines

Get the config for each pipeline; write it to the local working directory (e.g. /tmp/build/get) with the filename derived from the pipeline name and team name.

For example, if there are two pipelines foo and bar belonging to team-1 and team-2 respectively, the config for the first will be written to team-1-foo.yml and the second to team-2-bar.yml.

---
resources:
- name: my-pipelines
  type: concourse-pipeline
  source: ...

jobs:
- name: download-my-pipelines
  plan:
  - get: my-pipelines

out: Set the configuration of the pipelines

Set the configuration for each pipeline provided in the params section.

Configuration can be either static or dynamic. Static configuration has the configuration fixed in the pipeline config file, whereas dynamic configuration reads the pipeline configuration from the provided file.

One of either static or dynamic configuration must be provided; using both is not allowed.

static

---
resources:
- name: my-pipelines
  type: concourse-pipeline
  source:
    teams:
    - name: team-1

jobs:
- name: set-my-pipelines
  plan:
  - put: my-pipelines
    params:
      pipelines:
      - name: my-pipeline
        team: team-1
        config_file: path/to/config/file
        vars_files:
        - path/to/optional/vars/file/1
        - path/to/optional/vars/file/2
        vars:
          my_var: "foo"
          my_complex_var: {abc: 123}

dynamic

Resource configuration as above for Check, with the following job configuration:

---
jobs:
- name: set-my-pipelines
  plan:
  - put: my-pipelines
    params:
      pipelines_file: path/to/pipelines/file

Developing

Prerequisites

Dependencies

Dependencies are handled using go modules.

Updating dependencies

go mod download

To add or update a specific dependency version, follow the go modules instructions for Daily Workflow

Running the tests

Using a local environment

The acceptance tests require a running Concourse configured with basic auth to test against.

Run the tests with the following command (optionally also setting INSECURE=true):

FLY_LOCATION=path/to/fly \
TARGET=https://my-concourse.com \
USERNAME=my-basic-auth-user \
PASSWORD=my-basic-auth-password \
./bin/test

Using a Dockerfile

Note: the Dockerfile tests do not run the acceptance tests, but ensure a consistent environment across any docker enabled platform. When the docker image builds, the tests run inside the docker container, and on failure they will stop the build.

The tests need to be ran from one directory up from the directory of the repo. They will also need the fly linux tarball (from https://github.com/concourse/concourse/releases) to be present in the fly/ folder e.g:

$cwd/
├── fly/
│   └── fly-5.0.0-linux-amd64.tgz
└── concourse-pipeline-resource/
    ├── .git/
    │    └── ... 
    ├── dockerfiles/
    │    ├── alpine/
    │    │    └── Dockerfile
    │    └── ubuntu/
    │         └── Dockerfile
    └── ...

Run the tests with the following commands for both alpine and ubuntu images:

docker build -t concourse-pipeline-resource -f concourse-pipeline-resource/dockerfiles/alpine/Dockerfile .
docker build -t concourse-pipeline-resource -f concourse-pipeline-resource/dockerfiles/ubuntu/Dockerfile .

Contributing

Please ensure the tests pass locally.