Skip to content

Commit 6893fc1

Browse files
committed
Support branches in version checks
1 parent a4c43ed commit 6893fc1

File tree

2 files changed

+32
-10
lines changed

2 files changed

+32
-10
lines changed

etc/kayobe/ansible/check-kayobe-version.yml

Lines changed: 16 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,13 @@
4444
ansible.builtin.command:
4545
cmd: git describe --tags {{ kayobe_git_commit.stdout }}
4646
chdir: "{{ kayobe_temp_dir.path }}/kayobe-git"
47-
register: kayobe_current_version
47+
register: kayobe_current_tag
48+
49+
- name: Get branch from Kayobe commit
50+
ansible.builtin.command:
51+
cmd: git branch --show-current {{ kayobe_git_commit.stdout }}
52+
chdir: "{{ kayobe_temp_dir.path }}/kayobe-git"
53+
register: kayobe_current_branch
4854

4955
- name: Clean up temporary directory
5056
ansible.builtin.file:
@@ -59,14 +65,19 @@
5965

6066
- name: Check installed Kayobe version is the latest
6167
ansible.builtin.assert:
62-
that: "kayobe_latest_version.stdout in kayobe_current_version.stdout"
68+
that: >
69+
kayobe_latest_version.stdout in kayobe_current_tag.stdout or
70+
kayobe_latest_version.stdout in kayobe_current_branch.stdout
6371
fail_msg: |
64-
Kayobe must use the expected version before continuing.
72+
Kayobe must use the expected version before continuing. Either the
73+
tag or the branch should match the expected version
6574
66-
Current Kayobe version: {{ kayobe_current_version.stdout }}
75+
Current Kayobe tag: {{ kayobe_current_tag.stdout }}
76+
Current Kayobe branch: {{ kayobe_current_branch.stdout }}
6777
Expected Kayobe version: {{ kayobe_latest_version.stdout }}
6878
6979
Recreate the Kayobe environment, or install the expected version
7080
by running: pip install --force-reinstall -r {{ requirements_path }}
7181
success_msg: |
72-
Kayobe running at version: {{ kayobe_current_version.stdout }}
82+
Kayobe running at tag: {{ kayobe_current_tag.stdout }}
83+
on branch: {{ kayobe_current_branch.stdout }}

etc/kayobe/ansible/check-kolla-ansible-version.yml

Lines changed: 16 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -12,17 +12,28 @@
1212
ansible.builtin.command:
1313
cmd: git describe --tags
1414
chdir: "{{ lookup('ansible.builtin.env', 'KOLLA_SOURCE_PATH') }}"
15-
register: kolla_ansible_current_version
15+
register: kolla_ansible_current_tag
16+
17+
- name: Get current Kolla-Ansible branch
18+
ansible.builtin.command:
19+
cmd: git branch --show-current
20+
chdir: "{{ lookup('ansible.builtin.env', 'KOLLA_SOURCE_PATH') }}"
21+
register: kolla_ansible_current_branch
1622

1723
- name: Check installed Kolla-Ansible version is the expected version
1824
ansible.builtin.assert:
19-
that: "stackhpc_kolla_ansible_source_version in kolla_ansible_current_version.stdout"
25+
that: >
26+
stackhpc_kolla_ansible_source_version in kolla_ansible_current_tag.stdout or
27+
stackhpc_kolla_ansible_source_version in kolla_ansible_current_branch.stdout
2028
fail_msg: |
21-
Kolla-Ansible must use the expected version before continuing.
29+
Kolla-Ansible must use the expected version before continuing. Either the
30+
tag or the branch should match the expected version.
2231
23-
Current Kolla-Ansible version: {{ kolla_ansible_current_version.stdout }}
32+
Current Kolla-Ansible version: {{ kolla_ansible_current_tag.stdout }}
33+
Current Kolla-Ansible branch: {{ kolla_ansible_current_branch.stdout }}
2434
Expected Kolla-Ansible version: {{ stackhpc_kolla_ansible_source_version }}
2535
2636
Upgrade Kolla-Ansible by running: kayobe control host upgrade
2737
success_msg: |
28-
Kolla-Ansible running at version: {{ kolla_ansible_current_version.stdout }}
38+
Kolla-Ansible running at tag: {{ kolla_ansible_current_tag.stdout }}
39+
on branch: {{ kolla_ansible_current_branch.stdout }}

0 commit comments

Comments
 (0)