concourseconcourse-pipeline

Create reusable concourse pipelines


I have a bunch of applications that follow the same basic pattern so I'm trying to create a pipeline that would act as a reusable library. So far it's working pretty good by doing something like:

fly -t TARGET set-pipeline /n /c Pipelines\WindowsApp.yml ^
    /l ..\Secrets\config.yml /p %PRODUCT%-%BRANCH% ^
    --var productname=%PRODUCT% --var branch=%BRANCH%

It's working great so far but one thing I don't see is what if I want to execute a step for one scenario but not another. Is there a way to apply a condition to a step? I am able to pass the variables into my run steps and act upon them in a shell script but that seems to defeat the purpose of using resources and steps if I go down that road.


Solution

  • There is no way to do conditional resources or steps in a pipeline configuration.

    The best practice is to create a text template that generates the final pipeline configuration you'd like to set. For example, some teams have used ERB (Embedded Ruby) to add conditionals and logic.