|
40 | 40 | dest: "{{ kayobe_temp_dir.path }}/kayobe-git" |
41 | 41 | version: stackhpc/{{ openstack_release }} |
42 | 42 |
|
| 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 | + |
43 | 54 | - name: Get tag from Kayobe commit |
44 | 55 | ansible.builtin.command: |
45 | 56 | cmd: git describe --tags {{ kayobe_git_commit.stdout }} |
46 | 57 | chdir: "{{ kayobe_temp_dir.path }}/kayobe-git" |
47 | 58 | register: kayobe_current_tag |
48 | 59 |
|
49 | | - - name: Get branch from Kayobe commit |
| 60 | + - name: Get version from Kayobe checkout |
50 | 61 | ansible.builtin.command: |
51 | | - cmd: git branch --show-current {{ kayobe_git_commit.stdout }} |
| 62 | + cmd: git rev-parse HEAD |
52 | 63 | chdir: "{{ kayobe_temp_dir.path }}/kayobe-git" |
53 | | - register: kayobe_current_branch |
| 64 | + register: kayobe_current_version |
54 | 65 |
|
55 | 66 | - name: Clean up temporary directory |
56 | 67 | ansible.builtin.file: |
57 | 68 | state: absent |
58 | 69 | path: "{{ kayobe_temp_dir.path }}" |
59 | 70 |
|
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 | | - |
66 | 71 | - name: Check installed Kayobe version is the latest |
67 | 72 | 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 |
71 | 74 | 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. |
74 | 76 |
|
| 77 | + Current Kayobe commit: {{ kayobe_current_version.stdout }} |
75 | 78 | Current Kayobe tag: {{ kayobe_current_tag.stdout }} |
76 | | - Current Kayobe branch: {{ kayobe_current_branch.stdout }} |
77 | 79 | Expected Kayobe version: {{ kayobe_latest_version.stdout }} |
| 80 | + Expected Kayobe commit: {{ kayobe_git_commit.stdout }} |
78 | 81 |
|
79 | 82 | Recreate the Kayobe environment, or install the expected version |
80 | 83 | by running: pip install --force-reinstall -r {{ requirements_path }} |
81 | 84 | 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