Is it possible to have one of my service pipelines inject a step into the middle of the base pipeline while still being DRY? The base pipeline is large enough that it would be impractical to create an anchor for each step. Can sequences of steps be anchored and referenced as single steps in my service pipeline?
Hope you’re well - and welcome to the Buildkite Forum!
In the case of DRY - you’re certainly able to chain together uploads - pending that the pipeline that is to be further inserted within your base.yml is stored within said repository also (or this might be another generator script that creates the YAML that is to be further uploaded. Of course, if this further uploaded pipeline uploads even more pipelines dynamically in a ternary relationship, it’ll still be actioned through that very first step that uploaded the first pipeline.
Given that you said you only want this to be run by a specific service pipeline, you’d likely use build variables within a conditional: and likely pipeline.slug to only upload the pipeline chain based on builds coming from a specific pipeline (this could also be a script to run that will produce the YAML to be uploaded, and service-pipeline.yml can have even more uploads in it):
Of course, more generic ways can be had with this - including potentially feeding the uploads in hooks. Depending on the use case, you could have an agent level hook that’ll upload a specific pipeline, though a conditional like the above will be needed in that hook’s script just so it runs on specific builds (and avoiding an upload loop).
Theres even more of a wider approach with pipeline templates, but this is a Enterprise plan (would standardise the pipeline YAML for one/many pipelines)