I have multiple Gitlab repositories in the organization that use CI/CD jobs. Those jobs are defined in the script
section as multi-line bash scripts and are referenced using include
from the central repository.
As job definition started to grow, it’s getting harder to maintain it (fe. cannot lint with shellcheck
).
I would like to move scripts to a single bash file so it’s more maintainable and testable.
I’m wondering if there is a way to execute a bash script from a remote central repository or is there a best practice on how to maintain a large portion of scripts that are referenced from multiple repositories.
ps. As a workaround, I’ve configured on the target repository a job template that pulls config file locally from a central repository (job script installs git, clones the central repository, chmod
, and executes it).
Is that a good/safe/reliable approach?