AutoDevops' Deploy.gitlab-ci.yml relies on a global before_script for entire pipeline - should be stage-based
Summary
When using GitLab Auto Devops, the deploy
stage uses a yml variable to execute a bunch of bash - defining a bunch of bash functions like check_kube_domain
and so on.
If a user follows the Auto Devops instructions and decides to include:template
the Auto-DevOps.gitlab-ci.yml
template, and uses the top-level before_script
declaration, the deploy
stage will just unexpectedly fail with cryptic errors like check_kube_domain: not found
.
Improvements
A better way to do this could be to refactor the Deploy.gitlab-ci.yml file to selectively call before_script
on each of the stages. Here's a snippet that shows how that file could be amended (would be happy to convert that to an MR): https://gitlab.com/snippets/1879153
Risks
Not sure that there are any risks - maybe just that the Deploy.gitlab-ci.yml becomes less legible.