-
Notifications
You must be signed in to change notification settings - Fork 23
2024.1: 2023.1 merge #1266
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
Merged
Merged
2024.1: 2023.1 merge #1266
Changes from 42 commits
Commits
Show all changes
43 commits
Select commit
Hold shift + click to select a range
7daaead
Merge pull request #1241 from stackhpc/2023.1-zed-merge
markgoddard 67181e8
Merge pull request #1240 from stackhpc/zed-yoga-merge
markgoddard 4cada66
feat: add initial `install-pre-commit-hooks` playbook
jackhodgkiss 39405c0
feat: register `pre-commit` with `git`
jackhodgkiss 036b5f0
feat: make `install-pre-commit-hooks` opt-in
jackhodgkiss 9e309d2
feat: add release note
jackhodgkiss ef2a2b3
feat!: change when `pre-commit` hooks are installed
jackhodgkiss 05ccc8e
fix: update release note for `pre-commit hooks`
jackhodgkiss ac3abce
feat: add `pre-commit` to contributor docs
jackhodgkiss 94e52f4
fix: remove unused variable
jackhodgkiss 7c4da9a
feat: run `pre-commit install` if package is installed or updated
jackhodgkiss cf4aaa0
feat: use variable to control `pre_commit` version
jackhodgkiss 54766db
feat: provide commands within docs for pre-commit hooks setup
jackhodgkiss d277afb
feat: support install `pre-commit` without `kayobe-venv`
jackhodgkiss 901c0c2
Explicitly set rabbit flags for MN-CI upgrades
Alex-Welsh 6c7c75b
Merge pull request #1244 from stackhpc/explicit-queues
Alex-Welsh df37983
CI: Add a periodic multinode job
markgoddard 62af91a
Merge pull request #1245 from stackhpc/periodic-multinodes
markgoddard 4e18723
CI: Only run nightly multinode job in stackhpc repo
markgoddard d18b5e8
CI: Bump multinode.yml reusable workflow to 1.0.1
markgoddard 69975d5
CI: Rename stackhpc-multinode-scheduled.yml to stackhpc-multinode-per…
markgoddard 4a1749f
Merge pull request #1246 from stackhpc/periodic-multinodes
markgoddard 4a45e6c
ci-multinode: Add Kolla Ansible TLS config to globals.yml
markgoddard 85ffbef
Bump RMQ tag for multiple versions
MoteHue a22c955
Merge pull request #1249 from stackhpc/rabbitmq-multiple-versions
Alex-Welsh b75895c
Revert to upstream ovn-octavia-provider
priteau 0546050
Merge pull request #1253 from stackhpc/upstream-ovn-octavia-provider
priteau cf5332f
Add workaround for rc: -13 (#1108)
jovial c2c9b28
Add new RMQ versions to stackhpc_pulp_images_kolla
MoteHue e643067
Merge pull request #1256 from stackhpc/yoga-workaround-rc-13
markgoddard efa6729
Disable yamllint in ci-multinode globals.yml
markgoddard 65b4b98
Merge pull request #798 from stackhpc/add-pre-commit-hooks
markgoddard 61070bb
Merge pull request #1255 from stackhpc/zed-multinode-tls
Alex-Welsh 804ed07
Add git as a dependency for overcloud image build host
m-bull 7eccb88
Merge pull request #1263 from stackhpc/overcloud-image-git-dep
m-bull 9313666
Merge pull request #1258 from stackhpc/rmq-pulp-multiple-versions
bbezak 105690d
Merge stackhpc/yoga into stackhpc/zed
markgoddard 535cf96
Merge stackhpc/zed into stackhpc/2023.1
markgoddard 96eb985
Merge pull request #1265 from stackhpc/2023.1-zed-merge
markgoddard c6b9bac
Merge stackhpc/2023.1 into stackhpc/2024.1
markgoddard 7c9361a
Revert "Bump RMQ tag for multiple versions"
markgoddard 52ab34d
Revert "Add new RMQ versions to stackhpc_pulp_images_kolla"
markgoddard a9c131b
Revert "Explicitly set rabbit flags for MN-CI upgrades"
markgoddard File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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() |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,50 @@ | ||
--- | ||
# 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/[email protected] | ||
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 | ||
if: github.repository == 'stackhpc/stackhpc-kayobe-config' |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -52,7 +52,7 @@ name: Multinode | |
jobs: | ||
multinode: | ||
name: Multinode | ||
uses: stackhpc/stackhpc-openstack-gh-workflows/.github/workflows/[email protected].0 | ||
uses: stackhpc/stackhpc-openstack-gh-workflows/.github/workflows/[email protected].1 | ||
with: | ||
multinode_name: ${{ inputs.multinode_name }} | ||
os_distribution: ${{ inputs.os_distribution }} | ||
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,47 @@ | ||
================ | ||
Pre-commit Hooks | ||
================ | ||
|
||
StackHPC Kayobe configuration carries support for | ||
`pre-commit hooks <https://pre-commit.com/>`_ 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 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. | ||
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. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
--- | ||
- 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: "{{ pre_commit_version }}" | ||
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') | default(lookup('ansible.builtin.env', 'HOME') ~ '/.local', true) }}/bin/pre-commit install" | ||
args: | ||
chdir: "{{ playbook_dir | dirname | dirname | dirname }}" |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
8 changes: 8 additions & 0 deletions
8
releasenotes/notes/add-pre-commit-hooks-07ce3b82bbe1d7a3.yaml
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
--- | ||
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 which can be achieved by running `install-pre-commit-hooks` | ||
playbook. |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.