Reputation: 7232
I would like to make a pipeline that as first step checks its own configuration and updates itself if needed.
What tool / API should I use for this? Is there a docker image that has this installed for the correct concourse version? What is the advised way to authenticate in concourse from such task?
Upvotes: 4
Views: 2074
Reputation: 142
Regarding the previous answer suggesting the Fly binary, see the Fly resource.
However, having a similar request, I am going to try with the Pipeline resource. It seems more specific and has var injection solved directly through parameters.
I still have to try it out, but it seems to me that it would be more efficient to have a single pipeline which updates all pipelines, and not having to insert this job in all of your pipelines.
Also, a specific pipeline should not be concerned with itself, just the source code it builds (or whatever it does). If you want to start a pipeline if its config file changed, this could be done by modifying a triggering resource, e.g. pushing an empty "pipeline changed" commit
Upvotes: 3
Reputation: 1410
naively, it'd be a task which gets the repo the pipeline is committed to, and does a fly set-pipeline
to update the configuration. However there are a few gotchas here:
fly
executable to be available to your container which runs this task, and it should be same version of fly
as the concourse that's being targeted. Probably that means you should download it directly via curl
from the host.fly
to use -- probably via parameters.--load-vars-from
rather than just --var
. My group uses Lastpass notes with a bunch of variables saved in them and download via the lpass
tool, but that gets hard if you use 2FA or similar.Upvotes: 3