buildkite-plugins / docker-buildkite-plugin

🐳📦 Run any build step in a Docker container
MIT License
113 stars 106 forks source link

Allow setting config globally, instead of per step #204

Closed MarkAmeryCurative closed 2 years ago

MarkAmeryCurative commented 2 years ago

My motivating use case: I'd like to make all our steps that use the docker plugin print each individual shell command they execute in Docker, so that when a step using the docker plugin fails or hangs, it's easy to tell which command it failed on.

I can easily do this per-step by either adding set -x at the start of every command or by overriding shell to be ["/bin/sh", "-e", "-c", "-x"]. The trouble is, to do this across my company's entire repo, as far as I can tell I'd need to edit every step that uses docker, across all the Buildkite pipelines in our repository, and remember to do the same thing when adding more docker steps in future.

It'd be great if, instead, there were some mechanism by which we could globally change the defaults. (I'm not sure whether other Buildkite plugins offer this kind of global configuration feature or what the patterns for it are, though, so I'm not sure what to recommend as far as implementation details go!)

toote commented 2 years ago

This is indeed an interesting use case, but - in addition to what you mentioned - you also have to take into account that some conatiner images define entrypoints that would cause this to be even more complicated to implement here.

That said, I don't think that is possible from this plugin's perspective... or any plugin for that matter. If you (or anyone) can think of a way to do this, re-open this or even create a PR with your suggestion!