Search code examples
ibm-clouddevops-services

In a multi-repo deploy, how can I can I keep the pipelines co-located with their source code


I have a Deploy to IBM Cloud button that deploys 3 git repos and works great except I have a maintenance problem. If I make an edit in one of the repos which impacts how it is built, I have to change the pipeline.yml which exists in another repo, namely in the same repo as my .bluemix\toolchain.yml. I would prefer to have my pipeline.yml files self-contained in the repo they actually pertain to. My toolchain.yml has 3 entries like:

services: dashboard-build: service_id: pipeline parameters: services: - dashboard-repo name: 'dashboard-{{toolchain.name}}' configuration: content: $ref: dashboard.pipeline.yml $refType: text

I tried an absolute path like: ref: https://raw.githubusercontent.com/org/repo/master/.bluemix/dashboard.pipeline.yml but it errored out with

repository contains an invalid template. File not found

Can I change the pipeline's location to be in its own repository or does it have to be co-located with the toolchain.yml?


Solution

  • Yes, as you've guessed any files referenced with $ref or $text must be co-located in either the same repo or zip file. We might offer support for referencing and extending another template in the future but there is nothing concrete there yet.

    --

    Also... $text should be used in preference to $ref and $refType here.

    The pipeline's "content" element expects raw text and historically that is why we added $refType: text. However, $ref as specified in JSON Reference explicitly ignores siblings so although we have support for $refType currently it would be better to just use $text going forward.

    content: $text: dashboard.pipeline.yml