Skip to content

RSpec: add helper for ERB and gomplate

Jason Plum requested to merge ci-render-runtime-templates into master

What does this MR do?

RSpec: add helper for ERB and gomplate

Add `RuntimeTemplate` helper class

This has the ability to render ERB and gomplate in templates in a
reusable fashion.

Included support:
- ENV supplied to `gomplate` calls
- Replacement of `ENV[""]` entries in ERB
- Mock of files and their content
  - via use of `mktmpdir`, and string substitution

Also:

RSpec: move Gitaly to the use of RuntimeTemplate helper

Move the brhaviors of the Gitaly spec to call though RuntimeTemplate
helper, instead of isolated `render_toml`.

Also convert all YAML parsing of `gitlab.yml.erb` to pass through
RuntimeTemplate.erb.

Gitaly provided a nice example of both, and proves a clean testing ground.

Related issues

Related to #4123 (closed)

Related to #3366 (closed)

Related to #4543 (closed)

Checklist

See Definition of done.

For anything in this list which will not be completed, please provide a reason in the MR discussion.

Required

  • Merge Request Title and Description are up to date, accurate, and descriptive
  • MR targeting the appropriate branch
  • MR has a green pipeline on GitLab.com
  • When ready for review, MR is labeled "~workflow::ready for review" per the Distribution MR workflow

Expected (please provide an explanation if not completing)

  • Test plan indicating conditions for success has been posted and passes
  • Documentation created/updated -> #4898
  • Tests added
  • Integration tests added to GitLab QA
  • Equivalent MR/issue for omnibus-gitlab opened
  • Validate potential values for new configuration settings. Formats such as integer 10, duration 10s, URI scheme://user:passwd@host:port may require quotation or other special handling when rendered in a template and written to a configuration file.
Edited by Mitchell Nielsen

Merge request reports