zuul-jobs/roles/render-diff/tasks/main.yaml
Tristan Cacqueray 4903ecd30b dhall-diff: add new job
This change adds a new dhall-diff job to verify generated config
is idempotent.

Change-Id: I96a335dc78c4fa74564b854997433e5be0b5e633
2020-05-03 19:06:37 +00:00

39 lines
1.0 KiB
YAML

- name: "Run render command: {{ render_command }}"
command: "{{ render_command }}"
args:
chdir: "{{ zuul_work_dir }}"
- name: Check for diff
command: git diff
args:
chdir: "{{ zuul_work_dir }}"
register: render_diff
# ANSIBLE0006: Skip linting since it triggers on the "git" command,
# but diff is not supported by ansible git module.
tags:
- skip_ansible_lint
- name: Abort on diff
when:
- render_diff.stdout
- not diff_ignore_errors
failed_when: true
debug:
msg: |
The repository content is not consistent.
Please run `{{ render_command }}` before `git commit`
{% if render_diff.stdout | regex_search('^-') %}
You commited change in a configuration file without using the equivalent source file.
Please update the source file first and run {{ render_command }}.
{% else %}
You commited change in a file without running make.
Please run `{{ render_command }}` before `git commit`.
{% endif %}
The difference is:
{{ git_diff.stdout }}