Handle repos with no tags in version-from-git
The version-from-git role doesn't properly handle tag-less repos. Update it to handle that case too. Change-Id: I358037fd34f5dc202a6761b9e6f81bbe7870f3f2
This commit is contained in:
parent
fd35b1b9aa
commit
a966445c16
|
@ -54,9 +54,30 @@
|
|||
- skip_ansible_lint
|
||||
|
||||
- name: Set commits_since_tag fact
|
||||
when: commits_since_tag_output.rc == 0
|
||||
set_fact:
|
||||
commits_since_tag: "{{ commits_since_tag_output.stdout }}"
|
||||
|
||||
# Some repos, like storyboard-webclient, do not have any tags. git describe
|
||||
# throws an error in those repos. To be consistent, do a commit count the
|
||||
# hard way.
|
||||
- block:
|
||||
when: not commits_since_tag_output.rc != 0
|
||||
|
||||
- name: Get commits since the beginning
|
||||
command: git rev-list HEAD --count
|
||||
register: commits_since_beginning
|
||||
args:
|
||||
chdir: "{{ zuul_work_dir }}"
|
||||
# ANSIBLE0006: Skip linting since it triggers on the "git" command,
|
||||
# but rev-list is not supported by ansible git module.
|
||||
tags:
|
||||
- skip_ansible_lint
|
||||
|
||||
- name: Set commits_since_tag fact
|
||||
set_fact:
|
||||
commits_since_tag: "{{ commits_since_beginning.stdout }}"
|
||||
|
||||
- name: Set project_ver to scm_tag if there are no commits
|
||||
when: not commits_since_tag
|
||||
set_fact:
|
||||
|
|
Loading…
Reference in New Issue