This commit is contained in:
@@ -49,6 +49,6 @@ jobs:
|
|||||||
- name: Validate DAGs
|
- name: Validate DAGs
|
||||||
run: |
|
run: |
|
||||||
for dag in $(find ${DAGS_PATH} -type f -name "*.yaml" -a ! -name "*example*"); do
|
for dag in $(find ${DAGS_PATH} -type f -name "*.yaml" -a ! -name "*example*"); do
|
||||||
echo "========Validating ${dag}========"
|
echo "=========Validating ${dag}========="
|
||||||
dagu dry "${dag}"
|
dagu dry "${dag}"
|
||||||
done
|
done
|
||||||
|
|||||||
@@ -22,18 +22,28 @@
|
|||||||
- name: Pre-check Vault secrets in templates
|
- name: Pre-check Vault secrets in templates
|
||||||
when: dag_templates | length > 0
|
when: dag_templates | length > 0
|
||||||
block:
|
block:
|
||||||
- name: Find all Vault lookup expressions in templates
|
- name: Read each DAG template safely
|
||||||
|
ansible.builtin.slurp:
|
||||||
|
src: "{{ item }}"
|
||||||
|
loop: "{{ dag_templates }}"
|
||||||
|
register: slurped_templates
|
||||||
|
|
||||||
|
- name: Extract Vault keys from DAG templates
|
||||||
ansible.builtin.set_fact:
|
ansible.builtin.set_fact:
|
||||||
vault_keys: >-
|
vault_keys: >-
|
||||||
{{
|
{{
|
||||||
dag_templates
|
slurped_templates.results
|
||||||
| map('file', 'r')
|
| map(attribute='content')
|
||||||
| select('string')
|
| map('b64decode')
|
||||||
| map('regex_findall',
|
| map('regex_findall',
|
||||||
"lookup\\('community.hashi_vault.vault_kv2_get',\\s*'[^']+',\\s*engine_mount_point='[^']+',\\s*url=[^,]+,\\s*token=[^\\)]+\\)\\['secret'\\]\\['([^']+)'\\]")
|
"lookup\\('community.hashi_vault.vault_kv2_get',\\s*'[^']+',\\s*engine_mount_point='[^']+',\\s*url=[^,]+,\\s*token=[^\\)]+\\)\\['secret'\\]\\['([^']+)'\\]")
|
||||||
| sum(start=[])
|
| sum(start=[])
|
||||||
}}
|
}}
|
||||||
when: dag_templates | length > 0
|
|
||||||
|
- name: Warn if any Vault keys might be missing
|
||||||
|
loop: "{{ vault_keys }}"
|
||||||
|
ansible.builtin.debug:
|
||||||
|
msg: "Vault key '{{ item }}' will be required by templates"
|
||||||
|
|
||||||
|
|
||||||
- name: Warn if any Vault keys might be missing
|
- name: Warn if any Vault keys might be missing
|
||||||
|
|||||||
Reference in New Issue
Block a user