diff --git a/README.md b/README.md index 044e69d5512acff795f588d5cffbd3b65af006f2..239cc264454ec193d1181733c6b8ce65f6cfe835 100644 --- a/README.md +++ b/README.md @@ -58,7 +58,7 @@ Gitlab CI uses a .gitlab-ci.yml file in the root of your repository tell Gitlab | cache | If this setting exists, it expects a single sub-key called `paths`. `paths` is an array of paths that will be cached for each subsequent job. Defaults to `['vendor/bundle']`| | bundler\_args |Define any arguments you want to pass through to bundler. The default is `--without system_tests --path vendor/bundle --jobs $(nproc)` which avoids installing unnessesary gems while installing them to the `vendor/bundler.| | ruby_versions |Define a list of ruby_versions to test against. Each version can have a series of sub-keys that are options. `checks` is the rake command(s) to run during the job. `puppet_version` sets the PUPPET_GEM_VERSION environment variable. `allow_failure` is an array of `checks` where you want to allow failures. `tags` is an array of Gitlab CI Runner tags. | -| ruby_versions\\{job}\\**except/only**|`except`/`only` is an hash of `checks` with array of references of conditions for the `checks`:<br><br><pre>ruby_versions:<br> 2.4.9:<br> except:<br> unit:<br> - tags<br> - master</pre> | +| ruby_versions\\{job}\\**except/only**|Basic `except`/`only` is an hash of `checks` with array of references of conditions for the `checks`:<br><br><pre>ruby_versions:<br> 2.4.9:<br> except:<br> unit:<br> - tags<br> - master</pre><br><br>Advanced `except`/`only` is an hash of `checks` with hash using 4 keywords `'variables', 'refs', 'changes', 'kubernetes'` each with it's own array of references or conditions for the `checks`:<br><br><pre>ruby_versions:<br> 2.4.9:<br> except:<br> unit:<br> refs:<br> - tags<br> - master<br> variables:<br> - $CI_COMMIT_MESSAGE =~ /\[skip[ _-]tests?\]/i</pre> https://docs.gitlab.com/ce/ci/yaml/README.html#onlyexcept-advanced | | custom_jobs |Define custom Gitlab CI jobs that will be executed. It is recommended that you use this option if you need customized Gitlab CI jobs. Please see the [.gitlab-ci.yml](https://docs.gitlab.com/ce/ci/yaml/README.html) docs for specifics.| | rubygems_mirror | Use a custom rubygems mirror url | | image |Define the Docker image to use, when using the Docker runner. Please see the [Using Docker images](https://docs.gitlab.com/ee/ci/docker/using_docker_images.html) docs for specifics.| diff --git a/moduleroot/.gitlab-ci.yml.erb b/moduleroot/.gitlab-ci.yml.erb index 1547d95a36a30528168866f1d00cbda97500200f..9d18fb7ae7dfeee46f9e10dd9482544002cf2034 100644 --- a/moduleroot/.gitlab-ci.yml.erb +++ b/moduleroot/.gitlab-ci.yml.erb @@ -93,14 +93,32 @@ before_script: <% end -%> <% unless options['except'].nil? || options['except'][check].nil? -%> except: -<% options['except'][check].each do |ref| -%> +<% if ['variables', 'refs', 'changes', 'kubernetes'].any? { |i| options['except'][check].include?(i) } -%> +<% options['except'][check].each do |key, ref| -%> + <%= key %>: +<% ref.each do |r| -%> + - <%= r %> +<% end -%> +<% end -%> +<% else -%> +<% options['except'][check].each do |ref| -%> - <%= ref %> +<% end -%> <% end -%> <% end -%> <% unless options['only'].nil? || options['only'][check].nil? -%> only: -<% options['only'][check].each do |ref| -%> +<% if ['variables', 'refs', 'changes', 'kubernetes'].any? { |i| options['only'][check].include?(i) } -%> +<% options['only'][check].each do |key, ref| -%> + <%= key %>: +<% ref.each do |r| -%> + - <%= r %> +<% end -%> +<% end -%> +<% else -%> +<% options['only'][check].each do |ref| -%> - <%= ref %> +<% end -%> <% end -%> <% end -%> <% if options['tags'] -%>