I have a Concourse CI pattern where multiple pipelines are defined in one repo. I want to test the entire repository, and then only when certain files have changed (i.e. the pipeline-specific YAML) apply those pipelines which have changed. It mostly works - except that it will instantly apply the pipeline when those files have changed without waiting for the whole repo to get tested.
Here's the pertinent parts of my config:
resources:
- name: "repo-self"
type: git
source:
uri: "[email protected]:some-repo.git"
branch: main
- name: "repo-self-pipeline-1" # for triggering setting that pipeline
type: git
source:
uri: "[email protected]:some-repo.git"
branch: main
paths:
- "concourse/pipeline-1/*"
jobs:
- name: testing
plan:
- get: "repo-self"
trigger: true
- in_parallel:
- task: "test-1"
- task: "test-2"
- task: "test-3"
- name: "set-pipeline-1"
plan:
- in_parallel:
- get: "repo-self"
passed:
- testing
- get: "repo-self-pipeline-1"
trigger: true
- set_pipeline: "pipeline-1"
file: "repo-self-pipeline-1/concourse/pipeline-1/main.yaml"
I cannot simply add the same passed
directive to set the pipeline as that git repo resource isn't directly tested. And I don't want to also run it through testing as ideally it's the same git sha - it just happens to have the files changed that I care about.
Is there some way to gate or otherwise lock "repo-self-pipeline-1" to the same sha as "repo-self"?
Add
- get: "repo-self-pipeline-1"
without a trigger to thetesting
job. No need to run tests on that repo. Then addpassed: testing
to the second repo in the second job. That should do the trick.