How can I store Concourse resource_types definitions in external files and import them into the pipelines?

626 Views Asked by At

I am having several Concourse pipelines that require the same resource_types definitions. In order to eliminate duplication, is there a way to have these resource_types being imported form other files? (e.g. linked resources)

I would expect something like this (which is similar to tasks defined in external .yml files):

---
resource_types:
- name: rss
  file: concourse-resources/resource-types/rss.yml

resources:
- name: concourse-resources
  type: git
  source:
    uri: https://fqdn/concourse-resources.git
    username: ((git_username))
    password: ((git_password))    
- name: booklit-releases
  type: rss
  source:
    url: http://www.qwantz.com/rssfeed.php

jobs:
- name: announce
  plan:
  - get: booklit-releases

where the concourse-resources/resource-types/rss.yml would cotain something like this:

---
name: rss
type: docker-image
source:
  repository: suhlig/concourse-rss-resource
  tag: latest

(adapted example from https://concourse-ci.org/resource-types.html)

If the above is currently not possible in Concourse, how can I achieve this? (e.g. generating pipelines, or maybe other more elegant solutions)

2

There are 2 best solutions below

0
On

There is an open issue for this in concourse git repo.

https://github.com/concourse/concourse/issues/1994

As it is an open issue since Jan 2018 and people are still commenting on it as latest as 12 days ago, so not sure when this will be implemented, but this will certainly give you some insight.

Hope this helps in some way.

1
On

if anyone is still interested. You can define your resources even repeating task in a separate ya ml file. Use the place holders like you do for other params in your main pipeline yaml. bosh interpolate the mail yaml file passing the resource definition yaml file as parameter file ( -l arg)