From 4cada669298cfb2edd9948b521a0c12ab5148b4c Mon Sep 17 00:00:00 2001 From: Jack Hodgkiss Date: Thu, 23 Nov 2023 11:42:50 +0000 Subject: [PATCH 01/27] feat: add initial `install-pre-commit-hooks` playbook --- etc/kayobe/ansible/install-pre-commit-hooks.yml | 11 +++++++++++ .../post.d/50-install-pre-commit-hooks.yml | 1 + 2 files changed, 12 insertions(+) create mode 100644 etc/kayobe/ansible/install-pre-commit-hooks.yml create mode 120000 etc/kayobe/hooks/control-host-bootstrap/post.d/50-install-pre-commit-hooks.yml diff --git a/etc/kayobe/ansible/install-pre-commit-hooks.yml b/etc/kayobe/ansible/install-pre-commit-hooks.yml new file mode 100644 index 000000000..b604e92fb --- /dev/null +++ b/etc/kayobe/ansible/install-pre-commit-hooks.yml @@ -0,0 +1,11 @@ +--- +- name: Install pre-commit hooks + hosts: localhost + become: true + gather_facts: false + tasks: + - name: Install pre-commit hooks into kayobe virtual env + ansible.builtin.pip: + name: pre-commit + version: 3.5.0 + virtualenv: "{{ lookup('ansible.builtin.env', 'VIRTUAL_ENV') }}" diff --git a/etc/kayobe/hooks/control-host-bootstrap/post.d/50-install-pre-commit-hooks.yml b/etc/kayobe/hooks/control-host-bootstrap/post.d/50-install-pre-commit-hooks.yml new file mode 120000 index 000000000..fe09ffaef --- /dev/null +++ b/etc/kayobe/hooks/control-host-bootstrap/post.d/50-install-pre-commit-hooks.yml @@ -0,0 +1 @@ +../../../ansible/install-pre-commit-hooks.yml \ No newline at end of file From 39405c0ff6cad2c5cb414b71230f2eb44ffcb1e9 Mon Sep 17 00:00:00 2001 From: Jack Hodgkiss Date: Thu, 23 Nov 2023 13:44:23 +0000 Subject: [PATCH 02/27] feat: register `pre-commit` with `git` --- .pre-commit-config.yaml | 11 +++++++++++ etc/kayobe/ansible/install-pre-commit-hooks.yml | 8 +++++++- 2 files changed, 18 insertions(+), 1 deletion(-) create mode 100644 .pre-commit-config.yaml diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml new file mode 100644 index 000000000..498ddee33 --- /dev/null +++ b/.pre-commit-config.yaml @@ -0,0 +1,11 @@ +repos: + - repo: https://github.com/pre-commit/pre-commit-hooks + rev: v4.4.0 + hooks: + - id: check-yaml + - id: end-of-file-fixer + - id: trailing-whitespace + - repo: https://github.com/sirwart/ripsecrets + rev: v0.1.7 + hooks: + - id: ripsecrets diff --git a/etc/kayobe/ansible/install-pre-commit-hooks.yml b/etc/kayobe/ansible/install-pre-commit-hooks.yml index b604e92fb..fb5a709e4 100644 --- a/etc/kayobe/ansible/install-pre-commit-hooks.yml +++ b/etc/kayobe/ansible/install-pre-commit-hooks.yml @@ -1,7 +1,6 @@ --- - name: Install pre-commit hooks hosts: localhost - become: true gather_facts: false tasks: - name: Install pre-commit hooks into kayobe virtual env @@ -9,3 +8,10 @@ name: pre-commit version: 3.5.0 virtualenv: "{{ lookup('ansible.builtin.env', 'VIRTUAL_ENV') }}" + + - name: Register pre-commit hooks with git + ansible.builtin.command: + cmd: "{{ lookup('ansible.builtin.env', 'VIRTUAL_ENV') }}/bin/pre-commit install" + creates: "{{ lookup('ansible.builtin.env', 'KAYOBE_CONFIG_PATH') }}/../../.git/hooks/pre-commit" + args: + chdir: "{{ lookup('ansible.builtin.env', 'KAYOBE_CONFIG_PATH') }}" From 036b5f05a5a577f9b4b0d6e30940cc10a4c621cf Mon Sep 17 00:00:00 2001 From: Jack Hodgkiss Date: Thu, 23 Nov 2023 15:58:13 +0000 Subject: [PATCH 03/27] feat: make `install-pre-commit-hooks` opt-in --- .../ansible/install-pre-commit-hooks.yml | 27 +++++++++++-------- 1 file changed, 16 insertions(+), 11 deletions(-) diff --git a/etc/kayobe/ansible/install-pre-commit-hooks.yml b/etc/kayobe/ansible/install-pre-commit-hooks.yml index fb5a709e4..ad2737461 100644 --- a/etc/kayobe/ansible/install-pre-commit-hooks.yml +++ b/etc/kayobe/ansible/install-pre-commit-hooks.yml @@ -2,16 +2,21 @@ - name: Install pre-commit hooks hosts: localhost gather_facts: false + vars: + enable_pre_commit_hooks: false tasks: - - name: Install pre-commit hooks into kayobe virtual env - ansible.builtin.pip: - name: pre-commit - version: 3.5.0 - virtualenv: "{{ lookup('ansible.builtin.env', 'VIRTUAL_ENV') }}" + - name: Install pre-commit hooks + block: + - name: Install pre-commit hooks into kayobe virtual env + ansible.builtin.pip: + name: pre-commit + version: 3.5.0 + virtualenv: "{{ lookup('ansible.builtin.env', 'VIRTUAL_ENV') }}" - - name: Register pre-commit hooks with git - ansible.builtin.command: - cmd: "{{ lookup('ansible.builtin.env', 'VIRTUAL_ENV') }}/bin/pre-commit install" - creates: "{{ lookup('ansible.builtin.env', 'KAYOBE_CONFIG_PATH') }}/../../.git/hooks/pre-commit" - args: - chdir: "{{ lookup('ansible.builtin.env', 'KAYOBE_CONFIG_PATH') }}" + - name: Register pre-commit hooks with git + ansible.builtin.command: + cmd: "{{ lookup('ansible.builtin.env', 'VIRTUAL_ENV') }}/bin/pre-commit install" + creates: "{{ lookup('ansible.builtin.env', 'KAYOBE_CONFIG_PATH') }}/../../.git/hooks/pre-commit" + args: + chdir: "{{ lookup('ansible.builtin.env', 'KAYOBE_CONFIG_PATH') }}" + when: enable_pre_commit_hooks | default(false) From 9e309d25a287e3242c260e67d39bdb99cd38c68c Mon Sep 17 00:00:00 2001 From: Jack Hodgkiss Date: Thu, 23 Nov 2023 15:58:29 +0000 Subject: [PATCH 04/27] feat: add release note --- .../notes/add-pre-commit-hooks-07ce3b82bbe1d7a3.yaml | 9 +++++++++ 1 file changed, 9 insertions(+) create mode 100644 releasenotes/notes/add-pre-commit-hooks-07ce3b82bbe1d7a3.yaml diff --git a/releasenotes/notes/add-pre-commit-hooks-07ce3b82bbe1d7a3.yaml b/releasenotes/notes/add-pre-commit-hooks-07ce3b82bbe1d7a3.yaml new file mode 100644 index 000000000..69a149e72 --- /dev/null +++ b/releasenotes/notes/add-pre-commit-hooks-07ce3b82bbe1d7a3.yaml @@ -0,0 +1,9 @@ +--- +features: + - | + Add playbook to install pre-commit hooks and register them with git. + The hooks currently configured to be installed will check yaml syntax, + fix new line at end of file and remove excess whitespace. This is + currently opt-in and will require ``enable_pre_commit_hooks: true`` + in the the install-pre-commit-hooks playbook. + From ef2a2b3500323e7e1bf1e87792d89315ab76d98e Mon Sep 17 00:00:00 2001 From: Jack Hodgkiss Date: Mon, 8 Apr 2024 10:53:47 +0000 Subject: [PATCH 05/27] feat!: change when `pre-commit` hooks are installed Initally `pre-commit` hooks were installed due the presense of a hook for `control host bootstrap` and when `enable_pre_commit_hooks` was set to `true`. However now `pre-commit` hooks are only installed when the hook is present or the playbook is called, no requirement for an `Ansible` conditional to be true. --- etc/kayobe/ansible/install-pre-commit-hooks.yml | 1 - .../post.d/50-install-pre-commit-hooks.yml | 1 - 2 files changed, 2 deletions(-) delete mode 120000 etc/kayobe/hooks/control-host-bootstrap/post.d/50-install-pre-commit-hooks.yml diff --git a/etc/kayobe/ansible/install-pre-commit-hooks.yml b/etc/kayobe/ansible/install-pre-commit-hooks.yml index ad2737461..5967f88b7 100644 --- a/etc/kayobe/ansible/install-pre-commit-hooks.yml +++ b/etc/kayobe/ansible/install-pre-commit-hooks.yml @@ -19,4 +19,3 @@ creates: "{{ lookup('ansible.builtin.env', 'KAYOBE_CONFIG_PATH') }}/../../.git/hooks/pre-commit" args: chdir: "{{ lookup('ansible.builtin.env', 'KAYOBE_CONFIG_PATH') }}" - when: enable_pre_commit_hooks | default(false) diff --git a/etc/kayobe/hooks/control-host-bootstrap/post.d/50-install-pre-commit-hooks.yml b/etc/kayobe/hooks/control-host-bootstrap/post.d/50-install-pre-commit-hooks.yml deleted file mode 120000 index fe09ffaef..000000000 --- a/etc/kayobe/hooks/control-host-bootstrap/post.d/50-install-pre-commit-hooks.yml +++ /dev/null @@ -1 +0,0 @@ -../../../ansible/install-pre-commit-hooks.yml \ No newline at end of file From 05ccc8ec73ec360b21ee3b4865abc29bf792c07e Mon Sep 17 00:00:00 2001 From: Jack Hodgkiss Date: Mon, 8 Apr 2024 11:50:27 +0000 Subject: [PATCH 06/27] fix: update release note for `pre-commit hooks` --- .../notes/add-pre-commit-hooks-07ce3b82bbe1d7a3.yaml | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/releasenotes/notes/add-pre-commit-hooks-07ce3b82bbe1d7a3.yaml b/releasenotes/notes/add-pre-commit-hooks-07ce3b82bbe1d7a3.yaml index 69a149e72..1f0ac091d 100644 --- a/releasenotes/notes/add-pre-commit-hooks-07ce3b82bbe1d7a3.yaml +++ b/releasenotes/notes/add-pre-commit-hooks-07ce3b82bbe1d7a3.yaml @@ -4,6 +4,5 @@ features: Add playbook to install pre-commit hooks and register them with git. The hooks currently configured to be installed will check yaml syntax, fix new line at end of file and remove excess whitespace. This is - currently opt-in and will require ``enable_pre_commit_hooks: true`` - in the the install-pre-commit-hooks playbook. - + currently opt-in which can be achieved by running `install-pre-commit-hooks` + playbook. From ac3abce48e4cc3f26994a3d789f80b4773cd5d8d Mon Sep 17 00:00:00 2001 From: Jack Hodgkiss Date: Mon, 8 Apr 2024 11:57:27 +0000 Subject: [PATCH 07/27] feat: add `pre-commit` to contributor docs --- doc/source/contributor/index.rst | 1 + doc/source/contributor/pre-commit.rst | 38 +++++++++++++++++++++++++++ 2 files changed, 39 insertions(+) create mode 100644 doc/source/contributor/pre-commit.rst diff --git a/doc/source/contributor/index.rst b/doc/source/contributor/index.rst index 346e67989..988957541 100644 --- a/doc/source/contributor/index.rst +++ b/doc/source/contributor/index.rst @@ -11,3 +11,4 @@ This guide is for contributors of the StackHPC Kayobe configuration project. release-notes environments/index package-updates + pre-commit diff --git a/doc/source/contributor/pre-commit.rst b/doc/source/contributor/pre-commit.rst new file mode 100644 index 000000000..d094b4af6 --- /dev/null +++ b/doc/source/contributor/pre-commit.rst @@ -0,0 +1,38 @@ +================ +Pre-commit Hooks +================ + +StackHPC Kayobe configuration carries support for +`pre-commit hooks `_ which simplify the use of git +hooks enabling the identification and repairing of broken or poor code +before committing. +These hooks are designed to make working within SKC easier and less error prone. + +Currently the following hooks are provided: + +- ``check-yaml``: perform basic yaml syntax linting +- ``end-of-file-fixer``: identify and automatically fix missing newline +- ``trailing-whitespace``: identify and automatically fix excessive white space +- ``ripsecrets``: identify and prevent secrets from being committed to the branch + +.. warning:: + The hook ``ripsecrets`` is capable of preventing the accidental leaking of secrets + such as those found within `secrets.yml` or `passwords.yml`. + However if the secret is contained within a file on it's own and lacks a certain level + of entropy then the secret will not be identified as such as and maybe leaked as a result. + +Installation of `pre-commit` hooks is handled via the `install-pre-commit-hooks` playbook +found within the Ansible directory. +Either use `kayobe playbook run` or add the playbook as a hook within Kayobe config such as +within `control-host-bootstrap/post.d`. +Once done you should find `pre-commit` is available within the `kayobe` virtualenv. + +All that remains is the installation of the hooks themselves which can be accomplished either by +running `pre-commit run` or using `git commit` when you have changes that need to be committed. +This will trigger a brief installation process of the hooks which may take a few minutes. +This a one time process and will not be required again unless new hooks are added or existing ones are updated. + +.. note:: + Currently if you run ``pre-commit run --all-files`` it will make a series of changes to + release notes that lack new lines as well configuration files that ``check-yaml`` does not + approve of. From 94e52f4cb604de20395af0b8e0e9681e281c669f Mon Sep 17 00:00:00 2001 From: Jack Hodgkiss Date: Mon, 15 Apr 2024 15:37:59 +0100 Subject: [PATCH 08/27] fix: remove unused variable --- etc/kayobe/ansible/install-pre-commit-hooks.yml | 2 -- 1 file changed, 2 deletions(-) diff --git a/etc/kayobe/ansible/install-pre-commit-hooks.yml b/etc/kayobe/ansible/install-pre-commit-hooks.yml index 5967f88b7..e82051403 100644 --- a/etc/kayobe/ansible/install-pre-commit-hooks.yml +++ b/etc/kayobe/ansible/install-pre-commit-hooks.yml @@ -2,8 +2,6 @@ - name: Install pre-commit hooks hosts: localhost gather_facts: false - vars: - enable_pre_commit_hooks: false tasks: - name: Install pre-commit hooks block: From 7c4da9a3657f4e40421257154978254c1d24f15c Mon Sep 17 00:00:00 2001 From: Jack Hodgkiss Date: Mon, 15 Apr 2024 15:40:10 +0100 Subject: [PATCH 09/27] feat: run `pre-commit install` if package is installed or updated --- etc/kayobe/ansible/install-pre-commit-hooks.yml | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/etc/kayobe/ansible/install-pre-commit-hooks.yml b/etc/kayobe/ansible/install-pre-commit-hooks.yml index e82051403..1b247fc7f 100644 --- a/etc/kayobe/ansible/install-pre-commit-hooks.yml +++ b/etc/kayobe/ansible/install-pre-commit-hooks.yml @@ -10,10 +10,11 @@ name: pre-commit version: 3.5.0 virtualenv: "{{ lookup('ansible.builtin.env', 'VIRTUAL_ENV') }}" + register: pip_install - name: Register pre-commit hooks with git ansible.builtin.command: cmd: "{{ lookup('ansible.builtin.env', 'VIRTUAL_ENV') }}/bin/pre-commit install" - creates: "{{ lookup('ansible.builtin.env', 'KAYOBE_CONFIG_PATH') }}/../../.git/hooks/pre-commit" args: chdir: "{{ lookup('ansible.builtin.env', 'KAYOBE_CONFIG_PATH') }}" + when: pip_install is changed From cf4aaa02bd4fae500a7fbc2a4a4a510733cff893 Mon Sep 17 00:00:00 2001 From: Jack Hodgkiss Date: Mon, 15 Apr 2024 15:40:56 +0100 Subject: [PATCH 10/27] feat: use variable to control `pre_commit` version --- etc/kayobe/ansible/install-pre-commit-hooks.yml | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/etc/kayobe/ansible/install-pre-commit-hooks.yml b/etc/kayobe/ansible/install-pre-commit-hooks.yml index 1b247fc7f..a2947231c 100644 --- a/etc/kayobe/ansible/install-pre-commit-hooks.yml +++ b/etc/kayobe/ansible/install-pre-commit-hooks.yml @@ -2,13 +2,15 @@ - name: Install pre-commit hooks hosts: localhost gather_facts: false + vars: + pre_commit_version: 3.5.0 tasks: - name: Install pre-commit hooks block: - name: Install pre-commit hooks into kayobe virtual env ansible.builtin.pip: name: pre-commit - version: 3.5.0 + version: "{{ pre_commit_version }}" virtualenv: "{{ lookup('ansible.builtin.env', 'VIRTUAL_ENV') }}" register: pip_install From 54766db633c507d7318a8c2b093882aaba45fb9a Mon Sep 17 00:00:00 2001 From: Jack Hodgkiss Date: Mon, 15 Apr 2024 15:53:01 +0100 Subject: [PATCH 11/27] feat: provide commands within docs for pre-commit hooks setup --- doc/source/contributor/pre-commit.rst | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/doc/source/contributor/pre-commit.rst b/doc/source/contributor/pre-commit.rst index d094b4af6..3afffc11b 100644 --- a/doc/source/contributor/pre-commit.rst +++ b/doc/source/contributor/pre-commit.rst @@ -23,10 +23,19 @@ Currently the following hooks are provided: Installation of `pre-commit` hooks is handled via the `install-pre-commit-hooks` playbook found within the Ansible directory. -Either use `kayobe playbook run` or add the playbook as a hook within Kayobe config such as +Either run the playbook manually or add the playbook as a hook within Kayobe config such as within `control-host-bootstrap/post.d`. Once done you should find `pre-commit` is available within the `kayobe` virtualenv. +To run the playbook using the following command + +- ``kayobe playbook run ${KAYOBE_CONFIG_PATH}/ansible/install-pre-commit-hooks.yml`` + +Whereas to run the playbook when control host bootstrap runs ensure it registered as symlink using the following command + +- ``mkdir -p ${KAYOBE_CONFIG_PATH}/hooks/control-host-bootstrap/post.d`` +- ``ln -s ${KAYOBE_CONFIG_PATH}/ansible/install-pre-commit-hooks.yml ${KAYOBE_CONFIG_PATH}/hooks/control-host-bootstrap/post.d/install-pre-commit-hooks.yml`` + All that remains is the installation of the hooks themselves which can be accomplished either by running `pre-commit run` or using `git commit` when you have changes that need to be committed. This will trigger a brief installation process of the hooks which may take a few minutes. From d277afb7b8a776afea25ed7a016fc235ebee1bba Mon Sep 17 00:00:00 2001 From: Jack Hodgkiss Date: Thu, 22 Aug 2024 15:00:06 +0000 Subject: [PATCH 12/27] feat: support install `pre-commit` without `kayobe-venv` --- etc/kayobe/ansible/install-pre-commit-hooks.yml | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/etc/kayobe/ansible/install-pre-commit-hooks.yml b/etc/kayobe/ansible/install-pre-commit-hooks.yml index a2947231c..694e07bec 100644 --- a/etc/kayobe/ansible/install-pre-commit-hooks.yml +++ b/etc/kayobe/ansible/install-pre-commit-hooks.yml @@ -11,12 +11,11 @@ ansible.builtin.pip: name: pre-commit version: "{{ pre_commit_version }}" - virtualenv: "{{ lookup('ansible.builtin.env', 'VIRTUAL_ENV') }}" + virtualenv: "{{ lookup('ansible.builtin.env', 'VIRTUAL_ENV') | default(omit, true) }}" register: pip_install - name: Register pre-commit hooks with git ansible.builtin.command: - cmd: "{{ lookup('ansible.builtin.env', 'VIRTUAL_ENV') }}/bin/pre-commit install" + cmd: "{{ lookup('ansible.builtin.env', 'VIRTUAL_ENV') | default(lookup('ansible.builtin.env', 'HOME') ~ '/.local', true) }}/bin/pre-commit install" args: - chdir: "{{ lookup('ansible.builtin.env', 'KAYOBE_CONFIG_PATH') }}" - when: pip_install is changed + chdir: "{{ playbook_dir | dirname | dirname | dirname }}" From 901c0c29564a1ea99ae1ba6aa76060156894efed Mon Sep 17 00:00:00 2001 From: Alex-Welsh Date: Thu, 22 Aug 2024 15:33:43 +0100 Subject: [PATCH 13/27] Explicitly set rabbit flags for MN-CI upgrades --- etc/kayobe/environments/ci-multinode/kolla/globals.yml | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/etc/kayobe/environments/ci-multinode/kolla/globals.yml b/etc/kayobe/environments/ci-multinode/kolla/globals.yml index 303ef600e..ece979ae1 100644 --- a/etc/kayobe/environments/ci-multinode/kolla/globals.yml +++ b/etc/kayobe/environments/ci-multinode/kolla/globals.yml @@ -60,3 +60,10 @@ designate_ns_record: designate_backend: "bind9" designate_recursion: "yes" designate_forwarders_addresses: "1.1.1.1; 8.8.8.8" + +############################################################################ +# RabbitMQ + +# Ensure Rabbit is deployed with HA rather than quorum queues (to test migrations) +om_enable_rabbitmq_high_availability: true +om_enable_rabbitmq_quorum_queues: false From df379832be5dc3341e05348ce7af564c0d650d4d Mon Sep 17 00:00:00 2001 From: Mark Goddard Date: Thu, 22 Aug 2024 15:39:11 +0100 Subject: [PATCH 14/27] CI: Add a periodic multinode job The job runs nightly at 2:42 AM and runs a test of a randomly selected test scenario from a list of supported combinations. Note that scheduled workflows must live in the default branch of the repository. --- .github/workflows/multinode-inputs.py | 80 +++++++++++++++++++ .../stackhpc-multinode-scheduled.yml | 49 ++++++++++++ 2 files changed, 129 insertions(+) create mode 100644 .github/workflows/multinode-inputs.py create mode 100644 .github/workflows/stackhpc-multinode-scheduled.yml diff --git a/.github/workflows/multinode-inputs.py b/.github/workflows/multinode-inputs.py new file mode 100644 index 000000000..b862cbf91 --- /dev/null +++ b/.github/workflows/multinode-inputs.py @@ -0,0 +1,80 @@ +# Generate inputs for the reusable multinode.yml workflow. +# The test scenario is randomly selected. +# The inputs are printed to stdout in GitHub step output key=value format. + +from dataclasses import dataclass +import random +import typing as t + + +@dataclass +class OSRelease: + distribution: str + release: str + ssh_username: str + + +@dataclass +class OpenStackRelease: + version: str + previous_version: str + os_releases: t.List[OSRelease] + + +@dataclass +class Scenario: + openstack_release: OpenStackRelease + os_release: OSRelease + neutron_plugin: str + upgrade: bool + + +ROCKY_9 = OSRelease("rocky", "9", "cloud-user") +UBUNTU_JAMMY = OSRelease("ubuntu", "jammy", "ubuntu") +# NOTE(upgrade): Add supported releases here. +OPENSTACK_RELEASES = [ + OpenStackRelease("2023.1", "zed", [ROCKY_9, UBUNTU_JAMMY]) +] +NEUTRON_PLUGINS = ["ovs", "ovn"] + + +def main() -> None: + scenario = random_scenario() + inputs = generate_inputs(scenario) + for name, value in inputs.items(): + write_output(name, value) + + +def random_scenario() -> Scenario: + openstack_release = random.choice(OPENSTACK_RELEASES) + os_release = random.choice(openstack_release.os_releases) + neutron_plugin = random.choice(NEUTRON_PLUGINS) + upgrade = random.random() > 0.6 + return Scenario(openstack_release, os_release, neutron_plugin, upgrade) + + +def generate_inputs(scenario: Scenario) -> t.Dict[str, str]: + branch = get_branch(scenario.openstack_release.version) + previous_branch = get_branch(scenario.openstack_release.previous_version) + inputs = { + "os_distribution": scenario.os_release.distribution, + "os_release": scenario.os_release.release, + "ssh_username": scenario.os_release.ssh_username, + "neutron_plugin": scenario.neutron_plugin, + "upgrade": str(scenario.upgrade).lower(), + "stackhpc_kayobe_config_version": branch, + "stackhpc_kayobe_config_previous_version": previous_branch, + } + return inputs + + +def get_branch(version: str) -> str: + return f"stackhpc/{version}" + + +def write_output(name: str, value: str) -> None: + print(f"{name}={value}") + + +if __name__ == "__main__": + main() diff --git a/.github/workflows/stackhpc-multinode-scheduled.yml b/.github/workflows/stackhpc-multinode-scheduled.yml new file mode 100644 index 000000000..9bbd1e50c --- /dev/null +++ b/.github/workflows/stackhpc-multinode-scheduled.yml @@ -0,0 +1,49 @@ +--- +# This workflow provides a periodic deploy of a multi-node test cluster. +# The test scenario is randomly selected. + +name: Multinode periodic +'on': + schedule: + # Runs nightly at 2:42 AM. + - cron: "42 2 * * *" +jobs: + generate-inputs: + name: Generate inputs + runs-on: ubuntu-latest + outputs: + os_distribution: ${{ steps.generate-inputs.outputs.os_distribution }} + os_release: ${{ steps.generate-inputs.outputs.os_release }} + ssh_username: ${{ steps.generate-inputs.outputs.ssh_username }} + neutron_plugin: ${{ steps.generate-inputs.outputs.neutron_plugin }} + upgrade: ${{ steps.generate-inputs.outputs.upgrade }} + stackhpc_kayobe_config_version: ${{ steps.generate-inputs.outputs.stackhpc_kayobe_config_version }} + stackhpc_kayobe_config_previous_version: ${{ steps.generate-inputs.outputs.stackhpc_kayobe_config_previous_version }} + steps: + - name: Checkout + uses: actions/checkout@v4 + + - name: Generate inputs for multinode workflow + id: generate-inputs + run: | + python3 .github/workflows/multinode-inputs.py >> $GITHUB_OUTPUT + + - name: Display generated inputs + run: | + echo '${{ toJSON(steps.generate-inputs.outputs) }}' + multinode: + name: Multinode periodic + needs: + - generate-inputs + uses: stackhpc/stackhpc-openstack-gh-workflows/.github/workflows/multinode.yml@main + with: + multinode_name: mn-prdc-${{ github.run_id }} + os_distribution: ${{ needs.generate-inputs.outputs.os_distribution }} + os_release: ${{ needs.generate-inputs.outputs.os_release }} + ssh_username: ${{ needs.generate-inputs.outputs.ssh_username }} + neutron_plugin: ${{ needs.generate-inputs.outputs.neutron_plugin }} + upgrade: ${{ needs.generate-inputs.outputs.upgrade == 'true' }} + stackhpc_kayobe_config_version: ${{ needs.generate-inputs.outputs.stackhpc_kayobe_config_version }} + stackhpc_kayobe_config_previous_version: ${{ needs.generate-inputs.outputs.stackhpc_kayobe_config_previous_version }} + enable_slack_alert: true + secrets: inherit From 4e18723d2fdf9085ba6c7d6d4c8dab8c8b37b96e Mon Sep 17 00:00:00 2001 From: Mark Goddard Date: Thu, 22 Aug 2024 19:09:33 +0100 Subject: [PATCH 15/27] CI: Only run nightly multinode job in stackhpc repo --- .github/workflows/stackhpc-multinode-scheduled.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/stackhpc-multinode-scheduled.yml b/.github/workflows/stackhpc-multinode-scheduled.yml index 9bbd1e50c..f663173a0 100644 --- a/.github/workflows/stackhpc-multinode-scheduled.yml +++ b/.github/workflows/stackhpc-multinode-scheduled.yml @@ -47,3 +47,4 @@ jobs: stackhpc_kayobe_config_previous_version: ${{ needs.generate-inputs.outputs.stackhpc_kayobe_config_previous_version }} enable_slack_alert: true secrets: inherit + if: github.repository == 'stackhpc/stackhpc-kayobe-config' From d18b5e80b721a11a5ee477eb3691090f085d47a0 Mon Sep 17 00:00:00 2001 From: Mark Goddard Date: Thu, 22 Aug 2024 20:00:47 +0100 Subject: [PATCH 16/27] CI: Bump multinode.yml reusable workflow to 1.0.1 This includes fixes for breaking, terraform destroy retries, and support for slack alerts. --- .github/workflows/stackhpc-multinode-scheduled.yml | 2 +- .github/workflows/stackhpc-multinode.yml | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/stackhpc-multinode-scheduled.yml b/.github/workflows/stackhpc-multinode-scheduled.yml index f663173a0..341fbe55b 100644 --- a/.github/workflows/stackhpc-multinode-scheduled.yml +++ b/.github/workflows/stackhpc-multinode-scheduled.yml @@ -35,7 +35,7 @@ jobs: name: Multinode periodic needs: - generate-inputs - uses: stackhpc/stackhpc-openstack-gh-workflows/.github/workflows/multinode.yml@main + uses: stackhpc/stackhpc-openstack-gh-workflows/.github/workflows/multinode.yml@1.0.1 with: multinode_name: mn-prdc-${{ github.run_id }} os_distribution: ${{ needs.generate-inputs.outputs.os_distribution }} diff --git a/.github/workflows/stackhpc-multinode.yml b/.github/workflows/stackhpc-multinode.yml index 353a07334..a6d1c49a8 100644 --- a/.github/workflows/stackhpc-multinode.yml +++ b/.github/workflows/stackhpc-multinode.yml @@ -52,7 +52,7 @@ name: Multinode jobs: multinode: name: Multinode - uses: stackhpc/stackhpc-openstack-gh-workflows/.github/workflows/multinode.yml@1.0.0 + uses: stackhpc/stackhpc-openstack-gh-workflows/.github/workflows/multinode.yml@1.0.1 with: multinode_name: ${{ inputs.multinode_name }} os_distribution: ${{ inputs.os_distribution }} From 69975d5f132a051b4764e61029d71b2933675248 Mon Sep 17 00:00:00 2001 From: Mark Goddard Date: Thu, 22 Aug 2024 20:01:37 +0100 Subject: [PATCH 17/27] CI: Rename stackhpc-multinode-scheduled.yml to stackhpc-multinode-periodic.yml Aligns better with friendly name of the workflow. --- ...pc-multinode-scheduled.yml => stackhpc-multinode-periodic.yml} | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename .github/workflows/{stackhpc-multinode-scheduled.yml => stackhpc-multinode-periodic.yml} (100%) diff --git a/.github/workflows/stackhpc-multinode-scheduled.yml b/.github/workflows/stackhpc-multinode-periodic.yml similarity index 100% rename from .github/workflows/stackhpc-multinode-scheduled.yml rename to .github/workflows/stackhpc-multinode-periodic.yml From 4a45e6c758dcc4752d309904ea515c6cf700ec5e Mon Sep 17 00:00:00 2001 From: Mark Goddard Date: Tue, 27 Aug 2024 16:00:04 +0100 Subject: [PATCH 18/27] ci-multinode: Add Kolla Ansible TLS config to globals.yml Previously we provided an additional file, globals-tls-config.yml, which would be appended to globals.yml at an appropriate point during multinode deployment. This could result in a merge conflict, which cannot be resolved by an automated process such as a GitHub Actions workflow. This change adds the TLS config to globals.yml conditionally, based on whether internal TLS is enabled. We are not removing globals-tls-config.yml for now, since it is used in the terraform-kayobe-multinode repo as a proxy for internal TLS support. The file has already been removed in the Antelope branch. --- .../environments/ci-multinode/kolla/globals.yml | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/etc/kayobe/environments/ci-multinode/kolla/globals.yml b/etc/kayobe/environments/ci-multinode/kolla/globals.yml index 0f9dfe6f0..4462a45b5 100644 --- a/etc/kayobe/environments/ci-multinode/kolla/globals.yml +++ b/etc/kayobe/environments/ci-multinode/kolla/globals.yml @@ -44,3 +44,15 @@ designate_ns_record: designate_backend: "bind9" designate_recursion: "yes" designate_forwarders_addresses: "1.1.1.1; 8.8.8.8" + +{% if kolla_enable_tls_internal | bool %} +############################################################################ +# Internal and backend TLS configuration + +# Copy the self-signed CA into the kolla containers +kolla_copy_ca_into_containers: "yes" +openstack_cacert: "{{ '/etc/pki/tls/certs/ca-bundle.crt' if os_distribution == 'rocky' else '/etc/ssl/certs/ca-certificates.crt' }}" +kolla_enable_tls_backend: "yes" +rabbitmq_enable_tls: "yes" + +{% endif %} From 85ffbefe4af1cd8cc6b5a6b4403aca6ec0a32503 Mon Sep 17 00:00:00 2001 From: Matt Crees Date: Wed, 28 Aug 2024 10:55:43 +0100 Subject: [PATCH 19/27] Bump RMQ tag for multiple versions Allows up to run the intermediary RabbitMQ version upgrades before a SLURP upgrade to Caracal. --- etc/kayobe/kolla-image-tags.yml | 3 +++ .../add-rabbitmq-multiple-versions-7c6fdb470092409b.yaml | 7 +++++++ 2 files changed, 10 insertions(+) create mode 100644 releasenotes/notes/add-rabbitmq-multiple-versions-7c6fdb470092409b.yaml diff --git a/etc/kayobe/kolla-image-tags.yml b/etc/kayobe/kolla-image-tags.yml index cf8f74ada..2abd37c07 100644 --- a/etc/kayobe/kolla-image-tags.yml +++ b/etc/kayobe/kolla-image-tags.yml @@ -37,3 +37,6 @@ kolla_image_tags: rocky-9: 2023.1-rocky-9-20240809T102431 ovn: rocky-9: 2023.1-rocky-9-20240809T102431 + rabbitmq: + rocky-9: 2023.1-rocky-9-20240823T101942 + ubuntu-jammy: 2023.1-ubuntu-jammy-20240823T101942 diff --git a/releasenotes/notes/add-rabbitmq-multiple-versions-7c6fdb470092409b.yaml b/releasenotes/notes/add-rabbitmq-multiple-versions-7c6fdb470092409b.yaml new file mode 100644 index 000000000..34d0a07f3 --- /dev/null +++ b/releasenotes/notes/add-rabbitmq-multiple-versions-7c6fdb470092409b.yaml @@ -0,0 +1,7 @@ +--- +features: + - | + Adds alternative RabbitMQ container images for versions 3.11, 3.12 and + 3.13. This allows us to perform intermediary RabbitMQ upgrades prior to a + SLURP upgrade to Caracal. See the Kolla docs for more details: + https://docs.openstack.org/kolla-ansible/latest/reference/message-queues/rabbitmq.html#slurp From b75895ce7d35e8617dd52472fd5463aac11d76bc Mon Sep 17 00:00:00 2001 From: Pierre Riteau Date: Mon, 2 Sep 2024 09:59:17 +0200 Subject: [PATCH 20/27] Revert to upstream ovn-octavia-provider The bug fix we were using in our fork was backported upstream [1]. [1] https://review.opendev.org/c/openstack/ovn-octavia-provider/+/926715 --- etc/kayobe/kolla.yml | 8 -------- 1 file changed, 8 deletions(-) diff --git a/etc/kayobe/kolla.yml b/etc/kayobe/kolla.yml index 45c322fcf..e518d4065 100644 --- a/etc/kayobe/kolla.yml +++ b/etc/kayobe/kolla.yml @@ -147,14 +147,6 @@ kolla_sources: type: git location: https://github.com/stackhpc/networking-generic-switch.git reference: stackhpc/{{ openstack_release }} - octavia-api-plugin-ovn-octavia-provider: - type: git - location: https://github.com/stackhpc/ovn-octavia-provider.git - reference: stackhpc/{{ openstack_release }} - octavia-driver-agent-plugin-ovn-octavia-provider: - type: git - location: https://github.com/stackhpc/ovn-octavia-provider.git - reference: stackhpc/{{ openstack_release }} ############################################################################### # Kolla image build configuration. From cf5332f367955e95996999a75a90c54cce93dc01 Mon Sep 17 00:00:00 2001 From: Will Szumski Date: Thu, 27 Jun 2024 13:46:11 +0100 Subject: [PATCH 21/27] Add workaround for rc: -13 (#1108) I've commonly hit this when configuring prometheus: ``` TASK [prometheus : Get container facts] ************************************************************************************************************************************* Monday 24 June 2024 11:09:37 +0000 (0:00:08.528) 0:01:31.707 *********** fatal: [will-compute-01]: FAILED! => changed=false module_stderr: '' module_stdout: '' msg: |- MODULE FAILURE See stdout/stderr for the exact error rc: -13 fatal: [will-compute-02]: FAILED! => changed=false module_stderr: '' module_stdout: '' msg: |- MODULE FAILURE See stdout/stderr for the exact error rc: -13 ``` The ControlPersist workaround is documented in these bug reports: - https://github.com/ansible/ansible/issues/78344 - https://github.com/ansible/ansible/issues/81777 From the comments, It seems like this does not completely resolve the issue, but does decrease the frequency that you hit this. The Prometheus tasks seem particuarly susceptible as they run on every host. (cherry picked from commit 699769ce3756c6dc80c1183e1c87f730ff05bb80) --- etc/kayobe/ansible.cfg | 1 + 1 file changed, 1 insertion(+) diff --git a/etc/kayobe/ansible.cfg b/etc/kayobe/ansible.cfg index b38cb8239..e6c3e9c12 100644 --- a/etc/kayobe/ansible.cfg +++ b/etc/kayobe/ansible.cfg @@ -17,3 +17,4 @@ any_unparsed_is_failed = True [ssh_connection] pipelining = True +ssh_extra_args = -o ControlPersist=1h From c2c9b2878ffe811c7396468b41fd79f548197a1d Mon Sep 17 00:00:00 2001 From: Matt Crees Date: Tue, 3 Sep 2024 09:28:35 +0100 Subject: [PATCH 22/27] Add new RMQ versions to stackhpc_pulp_images_kolla --- etc/kayobe/pulp.yml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/etc/kayobe/pulp.yml b/etc/kayobe/pulp.yml index c4a33ae85..7b7dd6721 100644 --- a/etc/kayobe/pulp.yml +++ b/etc/kayobe/pulp.yml @@ -532,6 +532,8 @@ stackhpc_pulp_images_kolla: - prometheus-openstack-exporter - prometheus-v2-server - rabbitmq + - rabbitmq-3-12 + - rabbitmq-3-13 - redis - redis-sentinel From efa672900bc06d2199647291605a74ff79d77098 Mon Sep 17 00:00:00 2001 From: Mark Goddard Date: Wed, 4 Sep 2024 14:16:01 +0100 Subject: [PATCH 23/27] Disable yamllint in ci-multinode globals.yml It is a jinja template. --- etc/kayobe/environments/ci-multinode/kolla/globals.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/etc/kayobe/environments/ci-multinode/kolla/globals.yml b/etc/kayobe/environments/ci-multinode/kolla/globals.yml index 4462a45b5..b4b6db260 100644 --- a/etc/kayobe/environments/ci-multinode/kolla/globals.yml +++ b/etc/kayobe/environments/ci-multinode/kolla/globals.yml @@ -1,3 +1,4 @@ +# yamllint disable-file --- # Most development environments will use nested virtualisation, and we can't # guarantee that nested KVM support is available. Use QEMU as a lowest common From 804ed07a3ea9096b18f077bf9aac727989d659b8 Mon Sep 17 00:00:00 2001 From: Matt Anson Date: Thu, 5 Sep 2024 09:16:12 +0100 Subject: [PATCH 24/27] Add git as a dependency for overcloud image build host Need git to clone the image-elements repo --- .github/workflows/overcloud-host-image-build.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/overcloud-host-image-build.yml b/.github/workflows/overcloud-host-image-build.yml index adeb7ffe7..29354217d 100644 --- a/.github/workflows/overcloud-host-image-build.yml +++ b/.github/workflows/overcloud-host-image-build.yml @@ -198,7 +198,7 @@ jobs: source venvs/kayobe/bin/activate && source src/kayobe-config/kayobe-env --environment ci-builder && kayobe seed host command run \ - --command "sudo dnf config-manager --set-enabled crb && sudo dnf -y install epel-release && sudo dnf -y install zstd debootstrap kpartx cloud-init" --show-output + --command "sudo dnf config-manager --set-enabled crb && sudo dnf -y install epel-release && sudo dnf -y install cloud-init debootstrap git kpartx zstd" --show-output env: KAYOBE_VAULT_PASSWORD: ${{ secrets.KAYOBE_VAULT_PASSWORD }} From 7c9361a8c28715d6eadc8290bc02fe404e2e7bef Mon Sep 17 00:00:00 2001 From: Mark Goddard Date: Fri, 6 Sep 2024 12:46:13 +0100 Subject: [PATCH 25/27] Revert "Bump RMQ tag for multiple versions" This reverts commit 85ffbefe4af1cd8cc6b5a6b4403aca6ec0a32503. --- .../add-rabbitmq-multiple-versions-7c6fdb470092409b.yaml | 7 ------- 1 file changed, 7 deletions(-) delete mode 100644 releasenotes/notes/add-rabbitmq-multiple-versions-7c6fdb470092409b.yaml diff --git a/releasenotes/notes/add-rabbitmq-multiple-versions-7c6fdb470092409b.yaml b/releasenotes/notes/add-rabbitmq-multiple-versions-7c6fdb470092409b.yaml deleted file mode 100644 index 34d0a07f3..000000000 --- a/releasenotes/notes/add-rabbitmq-multiple-versions-7c6fdb470092409b.yaml +++ /dev/null @@ -1,7 +0,0 @@ ---- -features: - - | - Adds alternative RabbitMQ container images for versions 3.11, 3.12 and - 3.13. This allows us to perform intermediary RabbitMQ upgrades prior to a - SLURP upgrade to Caracal. See the Kolla docs for more details: - https://docs.openstack.org/kolla-ansible/latest/reference/message-queues/rabbitmq.html#slurp From 52ab34dc740ad4b418d5c0688682524f633023b4 Mon Sep 17 00:00:00 2001 From: Mark Goddard Date: Fri, 6 Sep 2024 12:46:18 +0100 Subject: [PATCH 26/27] Revert "Add new RMQ versions to stackhpc_pulp_images_kolla" This reverts commit c2c9b2878ffe811c7396468b41fd79f548197a1d. --- etc/kayobe/pulp.yml | 2 -- 1 file changed, 2 deletions(-) diff --git a/etc/kayobe/pulp.yml b/etc/kayobe/pulp.yml index d44eacfcb..9f87b915d 100644 --- a/etc/kayobe/pulp.yml +++ b/etc/kayobe/pulp.yml @@ -531,8 +531,6 @@ stackhpc_pulp_images_kolla: - prometheus-openstack-exporter - prometheus-v2-server - rabbitmq - - rabbitmq-3-12 - - rabbitmq-3-13 - redis - redis-sentinel From a9c131b20d51e961c0c9c777f23c078124bda3a3 Mon Sep 17 00:00:00 2001 From: Mark Goddard Date: Fri, 6 Sep 2024 13:35:56 +0100 Subject: [PATCH 27/27] Revert "Explicitly set rabbit flags for MN-CI upgrades" This reverts commit 901c0c29564a1ea99ae1ba6aa76060156894efed. This is not required in Caracal. --- etc/kayobe/environments/ci-multinode/kolla/globals.yml | 7 ------- 1 file changed, 7 deletions(-) diff --git a/etc/kayobe/environments/ci-multinode/kolla/globals.yml b/etc/kayobe/environments/ci-multinode/kolla/globals.yml index 599618500..4a8b6626f 100644 --- a/etc/kayobe/environments/ci-multinode/kolla/globals.yml +++ b/etc/kayobe/environments/ci-multinode/kolla/globals.yml @@ -61,10 +61,3 @@ designate_ns_record: designate_backend: "bind9" designate_recursion: "yes" designate_forwarders_addresses: "1.1.1.1; 8.8.8.8" - -############################################################################ -# RabbitMQ - -# Ensure Rabbit is deployed with HA rather than quorum queues (to test migrations) -om_enable_rabbitmq_high_availability: true -om_enable_rabbitmq_quorum_queues: false