Skip to content
Snippets Groups Projects
Unverified Commit 9eed4aa1 authored by Jesse Scott's avatar Jesse Scott Committed by GitHub
Browse files

Merge pull request #314 from cdenneen/gitlab_advanced_except_only

Updated for GitLab Advanced except/only ability
parents b7ac5e88 93816fcc
No related branches found
No related tags found
No related merge requests found
......@@ -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>&nbsp;&nbsp;2.4.9:<br>&nbsp;&nbsp;&nbsp;&nbsp;except:<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;unit:<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;- tags<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;- 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>&nbsp;&nbsp;2.4.9:<br>&nbsp;&nbsp;&nbsp;&nbsp;except:<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;unit:<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;- tags<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;- 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>&nbsp;&nbsp;2.4.9:<br>&nbsp;&nbsp;&nbsp;&nbsp;except:<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;unit:<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;refs:<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;- tags<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;- master<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;variables:<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;- $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.|
......
......@@ -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'] -%>
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment