Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Kolla-Ansible/Kayobe version enforcement #1551

Open
wants to merge 20 commits into
base: stackhpc/2024.1
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
42 changes: 42 additions & 0 deletions etc/kayobe/ansible/check-kayobe-version.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
---
- name: Check kayobe version
hosts: localhost
gather_facts: false
vars:
requirements_path: "{{ kayobe_config_path }}/../../requirements.txt"
tasks:
- name: Get installed kayobe commit

Check failure on line 8 in etc/kayobe/ansible/check-kayobe-version.yml

View workflow job for this annotation

GitHub Actions / Ansible 2.16 lint with Python 3.12

risky-shell-pipe

Shells that use pipes should set the pipefail option.

Check failure on line 8 in etc/kayobe/ansible/check-kayobe-version.yml

View workflow job for this annotation

GitHub Actions / Ansible 2.15 lint with Python 3.10

risky-shell-pipe

Shells that use pipes should set the pipefail option.
ansible.builtin.shell:
cmd: pip freeze | grep kayobe | cut -d @ -f 3 -s
register: kayobe_git_commit

- name: Clone kayobe
ansible.builtin.git:
repo: https://github.com/stackhpc/kayobe.git
dest: /tmp/kayobe-git
version: stackhpc/{{ openstack_release }}

- name: Get tag from kayobe commit

Check failure on line 19 in etc/kayobe/ansible/check-kayobe-version.yml

View workflow job for this annotation

GitHub Actions / Ansible 2.16 lint with Python 3.12

command-instead-of-module

git used in place of git module

Check failure on line 19 in etc/kayobe/ansible/check-kayobe-version.yml

View workflow job for this annotation

GitHub Actions / Ansible 2.15 lint with Python 3.10

command-instead-of-module

git used in place of git module
ansible.builtin.command:
cmd: git describe --tags {{ kayobe_git_commit.stdout }}
chdir: /tmp/kayobe-git
register: kayobe_current_version

- name: Get latest Kayobe version

Check failure on line 25 in etc/kayobe/ansible/check-kayobe-version.yml

View workflow job for this annotation

GitHub Actions / Ansible 2.16 lint with Python 3.12

risky-shell-pipe

Shells that use pipes should set the pipefail option.

Check failure on line 25 in etc/kayobe/ansible/check-kayobe-version.yml

View workflow job for this annotation

GitHub Actions / Ansible 2.15 lint with Python 3.10

risky-shell-pipe

Shells that use pipes should set the pipefail option.
ansible.builtin.shell:
cmd: grep -o kayobe@stackhpc\/.*$ {{ requirements_path }} | cut -d @ -f 2
register: kayobe_latest_version

- name: Check installed kayobe version is the latest
ansible.builtin.assert:
that: "kayobe_latest_version.stdout in kayobe_current_version.stdout"
fail_msg: |
Kayobe must be updated to the latest version before continuing.

Current Kayobe version: {{ kayobe_current_version.stdout }}
Latest Kayobe version: {{ kayobe_latest_version.stdout }}

Recreate the Kayobe environment, or install the latest version
by running: pip install --force-reinstall -r {{ requirements_path }}
success_msg: |
Kayobe running at version: {{ kayobe_current_version.stdout }}
6 changes: 6 additions & 0 deletions releasenotes/notes/check-kayobe-version-f44d43c9c34d1b89.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
---
features:
- |
Ansible playbook to check the installed Kayobe version against
the version defined in Kayobe configuration. This playbook will
run on Kayobe bootstrap, host and service operations.
Loading