zuul-jobs/roles/render-diff/tasks/main.yaml
Tristan Cacqueray ca4111a586 render-diff: fix typo in failure messsage
This change fix a typo where `git_diff` is undefined and should be replaced
by render_diff.

Change-Id: I9f1322853b7abdf6abd8b0d287b4b538963e6674
2020-09-03 16:30:15 +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:
{{ render_diff.stdout }}