Go Continuous Delivery, also called GoCd or Go for short, is a great tool to structure your build and deployment pipelines.
Here are some questions that I and others had while building my pipelines, and their answers. I hope you find them useful. Please send feedback to email@example.com.
How do I reference an artifact when the file name is dynamic?
Sometimes you do things like build packages whose file names contain the version number, which changes on every build. If you capture them as artifacts directly (for example through a wildcard), there doesn't seem to be a good way to retrieve those artifacts in a later stage.
Solution: capture the file(s) and place them into a fixed directory in the artifact store, for example:
<artifact src="yourpackage*.deb" dest="build/" />
In a later stage or pipeline you can then retrieve the whole directory:
<fetchartifact pipeline="" stage="build" job="build-deb" srcdir="build"> <runif status="passed" /> </fetchartifact>
How can I have a material that does not trigger a pipeline, but still use the latest version of it on each pipeline run?
Sometimes you want to have a repository with some build tools, and generally use the newest version, but at the same time you don't want to trigger all the pipelines that use it when there's a new commit. Disabling polling for this material generally isn't a good solution, because it means you don't always get the newest version, and also once you manually specify a new version, it still triggers all other pipelines that use it.
Solution: You can have a material that does normal polling, but blacklists every single file in the repository.
Blacklists are meant to avoid costly rebuilds when only documentation changes, but you can use it avoid automatic triggers altogether while still enable polling.
To exclude all files you need a
* pattern for
all top-level files, and
**/* for files in
<git url="https://github.com/moritz/deployment-utils.git" dest="deployment-utils"> <filter> <ignore pattern="*" /> <ignore pattern="**/*" /> </filter> </git>