#496  What CLI text templating tool do you recommend?
Closed
Stephen S opened 2 years ago

Here is my use case: I would like to generate docker-compose.yml files from a template, then push them each to the current OneDev Git repo. So, I need a templating tool that would seamlessly fit into OneDev's own templating system.

How do I see the process:

  1. I create a Job in a project that I will use as a template for other projects (basically, all my images are derived from a single "mother" and therefore share similar docker-compose.yml files)
  2. I define the relevant proprieties (ie the 3-letters code I will use within each docker-compose.yml file)
  3. I create a step where I define a text template as code.
  4. Then, I create a project that imports the previous one as a template
  5. I instantiate the value of the propriety that supersedes the template's one
  6. Executing the imported job will fill in the "blanks" then push the resulting docker-compose.yml file into the repo
Stephen S changed title 2 years ago
Previous Value Current Value
What text templating tool do you recommend?
What CLI text templating tool do you recommend?
Robin Shen commented 2 years ago

Any template system can be used to compose your docker-compose.yml as long as any literal occurrences of @ should be written as @@

Stephen S commented 2 years ago

Which one do you use?

Stephen S commented 2 years ago

Also I want it to be compatible with the editor in the Steps of OneDev so that I can rely on its logic (@property:xxx). Ideally, I would like to write something like:

the_template_manager 'the_template_from_repo' --property '@property:cod@'
Robin Shen commented 2 years ago

OneDev uses a home-grown system to prompt/substitute variables. You can pass properties this way to your chosen template engine as variables. I guess all template engine has that ability.

Stephen S commented 2 years ago

OK will try and will let you know, might help other users

Robin Shen changed state to 'Closed' 2 years ago
Previous Value Current Value
Open
Closed
issue 1 of 1
Type
Question
Priority
Normal
Assignee
Issue Votes (0)
Watchers (3)
Reference
onedev/server#496
Please wait...
Page is in error, reload to recover