I’m currently looking to reduce the amount of duplicate code and the upkeep required for our pipelines. Currently we have about 18 pipelines which all depend on the install of npm and node_modules, I’m trying to find the best solution to be able to cut this duplicated code down and instead have it in one location which can be retrieved from each of the pipelines. Would something like an Instance template repository be best for this? or perhaps another method…
I did try the include: function as described here: https://docs.gitlab.com/ee/ci/yaml/includes.html but when trying I seem to get the following errors from the CI lint- ‘Included file is empty or does not exist!’ or ‘Included file does not have valid YAML syntax!’
the point to includes is a good one. In order to reproduce and understand the error message better, please do share the CI config parts as well as locations of these included files.
please don’t bump topics, this makes the topic unreadable over time. Those watching and reading receive their notifications with just a single reply. I have a long TODO list and your reply was not lost just stuck.
In terms of referencing an existing CI template, just a few recommendations:
You don’t need to the full Git URL in case you are using built-in templates.
If you use a remote URL, use a tagged release or specific git commit. The master changes over time thus resulting in broken builds.
Thanks for providing the above examples and your step by step testing. I’ve tried this myself and can confirm I’m getting the same output. I’m going to go ahead and use the remote option and will create my own template