How to use latest concourse provided resource in older concourse pipeline


#1

I would like to use latest version of concourse/git-resource that was merged in PR https://github.com/concourse/git-resource/pull/225. Is this possible without upgrading to new concourse version? I am currently running concourse 3.9.2


#2

It is possible. The trick is to understand the difference between resources and resource_types.

Each Concourse resource that is not built-in has to be introduced with resource_types. Each Concourse resource that is built-in (example: git, S3, time, …) has an implicit resource_types.

If on the other hand you use resource_types for a built-in resource AND use the same type name, then you override the built-in.

Example:

This will use the built-in git resource:

resources:
- name: booklit
  type: git
  source:
    uri: https://github.com/vito/booklit
    branch: master

If in the same pipeline we add also

resource_types:
- name: git                     <== note the name
  type: docker-image
  source:
    repository: concourse/git-resource
    tag: latest

then we will use the Docker image git resource specified by the tag (in this case, latest).

A safer way would be not to specify latest but a specific Docker tag from https://hub.docker.com/r/concourse/git-resource/tags

Reference: https://concourse-ci.org/resource-types.html