Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

added more fine-grained control of custom_before_steps #436

Merged
merged 1 commit into from
May 17, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,7 @@ Gitlab CI uses a .gitlab-ci.yml file in the root of your repository tell Gitlab
| 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.|
| custom_before_steps |Allows you to pass additional steps to the GitLab CI before_script. Please see the [.gitlab-ci.yml](https://docs.gitlab.com/ce/ci/yaml/#before_script-and-after_script) docs for specifics.|
| custom_before_steps |Allows you to pass additional steps to the GitLab CI before_script. Please see the [.gitlab-ci.yml](https://docs.gitlab.com/ce/ci/yaml/#before_script-and-after_script) docs for specifics. If given as an array, the steps are executed _before_ the default steps of the before_script. If you want to have more control over the execution order of the steps, you can define a hash with a `before` and/or `after` key holding an array of steps to be executed before and after the default_script respectively.|
| default_before_script |If false, removes the default `before_script` section. Useful if you need a customised Bundler install, or to remove Bundler entirely. If the key is unset the default behaviour is to add `before_script`.|
|use_litmus| By default it is disabled. Set to `true` to configure travis to use Litmus testing tool for acceptance testing jobs with default values.|
|litmus|Allows you to update default config values. Its sub keys are `provision_list`, `puppet_collection`, `ruby_version`, `install_wget` which are detailed below.|
Expand Down
12 changes: 11 additions & 1 deletion moduleroot/.gitlab-ci.yml.erb
Original file line number Diff line number Diff line change
Expand Up @@ -50,8 +50,13 @@ default:
<% if !configs.has_key?('default_before_script') || configs['default_before_script'] -%>
before_script: &before_script
<% if configs['custom_before_steps'] -%>
<% configs['custom_before_steps'].each do |step| -%>
<% if configs['custom_before_steps'].is_a? Array -%>
<% configs['custom_before_steps'] = { 'before' => configs['custom_before_steps'] } -%>
<% end -%>
<% if configs['custom_before_steps']['before'] -%>
<% configs['custom_before_steps']['before'].each do |step| -%>
- <%= step %>
<% end -%>
<% end -%>
<% end -%>
- bundle -v
Expand All @@ -68,6 +73,11 @@ default:
- gem --version
- bundle -v
- bundle install <%= configs['bundler_args'] %>
<% if configs['custom_before_steps'] and configs['custom_before_steps']['after'] -%>
<% configs['custom_before_steps']['after'].each do |step| -%>
- <%= step %>
<% end -%>
<% end -%>
<% end -%>

<% if configs['ruby_versions'] -%>
Expand Down