Skip to content

Commit 42005f4

Browse files
committed
feat: add support for user provided templates
1 parent a933528 commit 42005f4

File tree

2 files changed

+14
-2
lines changed

2 files changed

+14
-2
lines changed

roles/github/README.md

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,9 @@ If you wish to make more impactful changes such as which workflows are built and
6060

6161
- `arguments`: list of arguments keys used by the automation task the contents will be acquired from `kayobe_arguments` or the defaults.
6262

63-
- `use_bespoke`: Some workflows benefit from a dedicated workflow template as they drift away from the main template. Set to `true` if the workflow requires a *bespoke* template and ensure a template `workflow_name.yml.j2` is present.
63+
- `path_override`: Some workflows benefit from a dedicated workflow template as the `generic.yml.j2` cannot meet the requirements of all workflows. Therefore it might be beneficial to create specific templates within the `{{ playbook_dir }}/templates/` directory and set this variable to that specific path.
64+
65+
- `use_bespoke`: As mentioned in `path_override` some workflows require a more specific template to meet their needs. Setting this to true would create a workflow from a bespoke template if one exists within the roles `templates` directory. Note this is intended for **internal use only**.
6466

6567
The following will override `github_workflows` to ensure only `Build Kayobe Image` and `Run Kolla Config Diff` is generated.
6668

@@ -70,6 +72,16 @@ github_workflows:
7072
- "{{ run_kolla_config_diff }}"
7173
```
7274
75+
In the following example `github_build_kayobe_image` has been changed to use a user provided template stored within their `{{ playbook_dir }}/templates`
76+
77+
```yaml
78+
github_build_kayobe_image:
79+
file_name: build-kayobe-docker-image.yml
80+
path_override: "{{ playbook_dir }}/templates/build-kayobe-docker-image.yml.j2"
81+
```
82+
83+
84+
7385
Template Hooks
7486
--------------
7587

roles/github/tasks/main.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77

88
- name: Ensure workflow file exists
99
ansible.builtin.template:
10-
src: "workflow.yml.j2"
10+
src: "{{ workflow.path_override | default('workflow.yml.j2') }}"
1111
dest: "{{ github_output_directory }}/{{ workflow.file_name }}"
1212
block_start_string: "<%"
1313
block_end_string: "%>"

0 commit comments

Comments
 (0)