Pipeline with rollback option

Hi All,

I have a pretty simple pipeline that promotes an application from build to production. The simplified job flow is as follows:

  1. build
  2. deploy to dev
  3. deploy to prod

We are using the semver resource and a maven resource for uploading / downloading the artifact.

What I am trying to do is keep a separate version that represents the previous deployed version and create a job that will ‘roll back’ to that version if triggered.

Since we are using semver - versions are stored in files after a get step. What I am having problems with is accessing a version file during a get step of the maven resource. I see that resources allow a specific version to be passed in, but not via a file.

Does anyone have an example similar to what I am trying to do, or am I going down an anti-pattern path?

Hello, welcome to Concourse.

Mhh, I like your idea, but… what is not clear to me is the semver part. If I understand correctly you are using only one semver resource and bumping it when, just before the deploy to prod?

The problem I see is that, no matter when you bump, in your rollback job you would have to refer to semver - 1 ? Or is the rollback semver something more static ?

We will actually have 3 versions we will track (each a different semver in our pipeline)

  1. latest build (app/version-latest)
  2. currently in production (app/version-current)
  3. prev known good version (app/version-previous)

We will then manipulate those versions as our artifact moves through the pipeline. We do not plan to support rolling back multiple versions - which simplifies things a little bit. We will also have a few other tasks that update versions (like create release, promote, rollback, etc)

You could also think of the problem like this.

Suppose I want to write a job that deploys a certain version of an application into an environment. The version I want to deploy is stored in a git repo and served through the semver resource. Is it possible to send that file into a resource’s get step? Or is it possible to get it from a file into something I can include in the resources version parameter.

https://concourse-ci.org/get-step.html#get-step-version

I could write a task that does this - but the maven resource already has all the logic and support needed to download and authenticate against a maven repository.

Ah, you mean that the semver resource uses git as backing store? Or are you somehow manipulating the file that stores that information, out-of-band of the semver resource ?

Correct - the semver resource is backed by a git repo.

When we want to update the deployed-version we will use a put step to push the file that was pulled from the latest-build-version into deployed-version

- name: version
  type: semver
  source:
    initial_version: 0.0.0
    driver: git
    uri: ...
    branch: master
    file: ((application.name))/version