Patterns for versioning software in Concourse


#1

Hi everybody!

I’m trying to use concourse to test and deploy multiple versions of a piece of software. My project consists of several git repos. Each repo has branches for versions (e.g. v1.0, v1.1, v2.0).

If a developer pushes to branch v1.0 of repo A, I need branch v1.0 of repo B and C to be pulled into a job for all the repos to be tested, built, and deployed. So I need multiple versions to be handled by the CI pipeline.

My main question is, what patterns are there for implementing something like this? It looks like the concourse team is developing “spatial resources” which should help. What are the options currently?

If I can clarify my question in any way, please let me know. Thanks!


#2

Hello,

since the branch name is the same over the different repos, I would suggest one pipeline per version.

I think in your case it is possible to stay DRY and use only one pipeline file as template and parametrize on the branch name.

Example snippet (not tested, to give you the gist), assume file name is foo-pipeline.yml:

resources:

- name: repoA.git
  type: git
  source:
    uri: https://.../repoA.git
    branch: ((branch-version))

- name: repoB.git
  type: git
  source:
    uri: https://.../repoB.git
    branch: ((branch-version))

The ((branch-version)) is a Concourse parameter. Then create one parameters file per version, for example version1.yml, version2.yml and so on (see Concourse documentation for the format, it is plain YAML)

Then set the pipeline with something like

# pipeline for version 1
fly -t ci set-pipeline -p foo-v1 -c foo-pipeline.yml --load-vars-from=version1.yml

# pipeline for version 2
fly -t ci set-pipeline -p foo-v2 -c foo-pipeline.yml --load-vars-from=version2.yml

you see ? The same pipeline configuration file (and all the files included by it) is used as template.

At work we do something similar and it works great. If on the other hand you want to support also feature branches, you can follow the same idea, but you need some more scripting machinery.


#3

Thanks! This is extremely useful. We’re going to take a similar approach.


#4

You are welcome! If this solves your problem, please mark it as accepted (in the same spirit of stackoverflow), so that people looking for a similar question will be helped.