Skip to content

Add shellcheck job for vendored CI templates scripts

Brian Williams requested to merge bwill/add-templates-shellcheck into master

What does this MR do and why?

Describe in detail what your merge request does and why.

This MR adds a templates_shellcheck CI job which runs ShellCheck linting on the vendored CI templates templates in lib/gitlab/ci/templates/.

It does this through a Ruby script in scripts/lint_templates_bash.rb. This script makes use of existing Rails code in order to retrieve all of the templates and parse their contents. It then assembles the before_script, script, and after_script blocks of each job into a single script file, which is passed to shellcheck via stdin. Since the script uses Rails code, it does require that the Rails environment be setup and is therefore run as part of the test stage rather than the lint stage.

Screenshots or screen recordings

These are strongly recommended to assist reviewers and reduce the time to merge your change.

How to set up and validate locally

Numbered steps to set up and validate the change are strongly suggested.

  1. gdk start
  2. bundle exec ruby scripts/lint_templates_bash.rb

MR acceptance checklist

This checklist encourages us to confirm any changes have been analyzed to reduce risks in quality, performance, reliability, security, and maintainability.

Edited by Brian Williams

Merge request reports