Skip to content

Commit d58da3b

Browse files
committed
Correct kayobe branch check
1 parent 05d123e commit d58da3b

File tree

1 file changed

+19
-17
lines changed

1 file changed

+19
-17
lines changed

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

Lines changed: 19 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -40,44 +40,46 @@
4040
dest: "{{ kayobe_temp_dir.path }}/kayobe-git"
4141
version: stackhpc/{{ openstack_release }}
4242

43+
- name: Get latest Kayobe version
44+
ansible.builtin.shell:
45+
cmd: set -o pipefail && grep -o kayobe@stackhpc\/.*$ {{ requirements_path }} | cut -d @ -f 2
46+
executable: /usr/bin/bash
47+
register: kayobe_latest_version
48+
49+
- name: Checkout latest Kayobe version
50+
ansible.builtin.command:
51+
cmd: git checkout {{ kayobe_latest_version.stdout }}
52+
chdir: "{{ kayobe_temp_dir.path }}/kayobe-git"
53+
4354
- name: Get tag from Kayobe commit
4455
ansible.builtin.command:
4556
cmd: git describe --tags {{ kayobe_git_commit.stdout }}
4657
chdir: "{{ kayobe_temp_dir.path }}/kayobe-git"
4758
register: kayobe_current_tag
4859

49-
- name: Get branch from Kayobe commit
60+
- name: Get version from Kayobe checkout
5061
ansible.builtin.command:
51-
cmd: git branch --show-current {{ kayobe_git_commit.stdout }}
62+
cmd: git rev-parse HEAD
5263
chdir: "{{ kayobe_temp_dir.path }}/kayobe-git"
53-
register: kayobe_current_branch
64+
register: kayobe_current_version
5465

5566
- name: Clean up temporary directory
5667
ansible.builtin.file:
5768
state: absent
5869
path: "{{ kayobe_temp_dir.path }}"
5970

60-
- name: Get latest Kayobe version
61-
ansible.builtin.shell:
62-
cmd: set -o pipefail && grep -o kayobe@stackhpc\/.*$ {{ requirements_path }} | cut -d @ -f 2
63-
executable: /usr/bin/bash
64-
register: kayobe_latest_version
65-
6671
- name: Check installed Kayobe version is the latest
6772
ansible.builtin.assert:
68-
that: >
69-
kayobe_latest_version.stdout in kayobe_current_tag.stdout or
70-
kayobe_latest_version.stdout in kayobe_current_branch.stdout
73+
that: kayobe_git_commit.stdout in kayobe_current_version.stdout
7174
fail_msg: |
72-
Kayobe must use the expected version before continuing. Either the
73-
tag or the branch should match the expected version.
75+
Kayobe must use the expected version before continuing.
7476
77+
Current Kayobe commit: {{ kayobe_current_version.stdout }}
7578
Current Kayobe tag: {{ kayobe_current_tag.stdout }}
76-
Current Kayobe branch: {{ kayobe_current_branch.stdout }}
7779
Expected Kayobe version: {{ kayobe_latest_version.stdout }}
80+
Expected Kayobe commit: {{ kayobe_git_commit.stdout }}
7881
7982
Recreate the Kayobe environment, or install the expected version
8083
by running: pip install --force-reinstall -r {{ requirements_path }}
8184
success_msg: |
82-
Kayobe running at tag: {{ kayobe_current_tag.stdout }}
83-
on branch: {{ kayobe_current_branch.stdout }}
85+
Kayobe running at version: {{ kayobe_current_version.stdout }}

0 commit comments

Comments
 (0)