FAQ | This is a LIVE service | Changelog

Skip to content

re-work .gitlab-ci.yml a little

Dr Rich Wareham requested to merge ci-config-tweaks into master

Add some comments to the .gitlab-ci.yml file explaining how it works.

Re-name the "test" job to "lint" since we may actually have real tests for the Ansible roles in future.

Remove the unneeded docker service.

Merge before_script and script together. before_script should be used when it is likely a derived job will want to override it.

Instead of starting from our shared Python image, start from our Ansible image. This has the advantage of having all of the required dependencies for ansible-lint pre-installed so running the test job is quicker. This reduces the average CI pipeline run from around 2:30 to 20 seconds.

GitLab CI jobs are already passed to the shell so having the 'bash -c "..."' line in the job script is unnecessary.

Instead of searching for all files which match *.y*ml (which includes files such as 'foo.y-not-a-role-ml') and which may catch YAML files which are part of roles, pass ansible-lint the role directory instead. Role directories are assumed to be any directory directly under the 'roles' directory in the repository root.

Rather than hiding the ansible-lint configuration in the command line in the .gitlab-ci.yml file, make use of the .ansible-lint configuration file to be a little more explicit.

Edited by Dr Rich Wareham

Merge request reports