From 698d6c6ae9ec14dda2996f3e02bf2e98c3b5801a Mon Sep 17 00:00:00 2001 From: Douglas Holt Date: Wed, 18 Feb 2026 13:00:42 -0700 Subject: [PATCH 1/3] fix: replace distutils with packaging in setup.sh distutils.version.LooseVersion was removed from the Python stdlib in 3.12, breaking setup.sh on Ubuntu 24.04+ and any modern Python. Switch to packaging.version.Version (available via pip) and use the venv python3 instead of PYTHON_BIN so the import resolves correctly. Also bump jmespath 0.10.0 to 1.0.1 to match kubespray requirements, and add packaging to the explicit pip install list. Co-Authored-By: Claude Opus 4.6 Signed-off-by: Douglas Holt --- .gitignore | 7 +++++++ scripts/setup.sh | 7 ++++--- 2 files changed, 11 insertions(+), 3 deletions(-) diff --git a/.gitignore b/.gitignore index 994801774..ef8d9d733 100644 --- a/.gitignore +++ b/.gitignore @@ -4,6 +4,13 @@ # misc. .*.swp +# virtualenv +/.venv/ + +# claude code +/CLAUDE.md +/tasks/ + # project-specific /admin.conf /config*/ diff --git a/scripts/setup.sh b/scripts/setup.sh index e2196b90b..070682f6a 100755 --- a/scripts/setup.sh +++ b/scripts/setup.sh @@ -18,7 +18,7 @@ ANSIBLE_LINT_VERSION="${ANSIBLE_LINT_VERSION:-5.4.0}" CONFIG_DIR="${CONFIG_DIR:-${ROOT_DIR}/config}" # Default configuration directory location DEEPOPS_TAG="${1:-master}" # DeepOps branch to set up JINJA2_VERSION="${JINJA2_VERSION:-3.1.5}" # Jinja2 required version -JMESPATH_VERSION="${JMESPATH_VERSION:-0.10.0}" # jmespath pegged version, actual version probably not that crucial +JMESPATH_VERSION="${JMESPATH_VERSION:-1.0.1}" # jmespath version (matches kubespray requirements) MARKUPSAFE_VERSION="${MARKUPSAFE_VERSION:-3.0.2}" # MarkupSafe version PIP="${PIP:-pip3}" # Pip binary to use PYTHON_BIN="${PYTHON_BIN:-/usr/bin/python3}" # Python3 path @@ -100,12 +100,12 @@ if command -v virtualenv &> /dev/null ; then if pip show ansible 2>&1 >/dev/null; then current_version=$(pip show ansible | grep Version | awk '{print $2}') echo "Current version of Ansible is ${current_version}" - if "${PYTHON_BIN}" -c "from distutils.version import LooseVersion; print(LooseVersion('$current_version') >= LooseVersion('$ANSIBLE_TOO_NEW'))" | grep True 2>&1 >/dev/null; then + if python3 -c "from packaging.version import Version; print(Version('$current_version') >= Version('$ANSIBLE_TOO_NEW'))" | grep True 2>&1 >/dev/null; then echo "Ansible version ${current_version} too new for DeepOps" echo "Please uninstall any ansible, ansible-base, and ansible-core packages and re-run this script" exit 1 fi - if "${PYTHON_BIN}" -c "from distutils.version import LooseVersion; print(LooseVersion('$current_version') < LooseVersion('$ANSIBLE_VERSION'))" | grep True 2>&1 >/dev/null; then + if python3 -c "from packaging.version import Version; print(Version('$current_version') < Version('$ANSIBLE_VERSION'))" | grep True 2>&1 >/dev/null; then echo "Ansible will be upgraded from ${current_version} to ${ANSIBLE_VERSION}" fi fi @@ -115,6 +115,7 @@ if command -v virtualenv &> /dev/null ; then ansible-lint==${ANSIBLE_LINT_VERSION} \ Jinja2==${JINJA2_VERSION} \ netaddr \ + packaging \ ruamel.yaml \ PyMySQL \ paramiko \ From 16d746e32b5a2f9bc5185dec0d3fcd2b73bbe444 Mon Sep 17 00:00:00 2001 From: Douglas Holt Date: Wed, 18 Feb 2026 13:24:26 -0700 Subject: [PATCH 2/3] ci: update GitHub Actions workflows and add setup.sh test - Update runners from ubuntu-20.04 (removed) to ubuntu-22.04 - Bump actions to current versions (checkout@v4, setup-python@v4, codeql-action@v3, stale@v9) - Update Python 3.9 to 3.12, Ansible 4.8.0 to 9.13.0 in CI - Add setup.yml workflow to test setup.sh on Ubuntu 22.04 and 24.04 - Use explicit venv python path in setup.sh version checks Co-Authored-By: Claude Opus 4.6 Signed-off-by: Douglas Holt --- .github/workflows/ansible-lint-roles.yml | 10 +++++----- .github/workflows/codeql.yml | 8 ++++---- .github/workflows/molecule.yml | 10 +++++----- .github/workflows/setup.yml | 25 ++++++++++++++++++++++++ .github/workflows/stale.yml | 2 +- scripts/setup.sh | 4 ++-- 6 files changed, 42 insertions(+), 17 deletions(-) create mode 100644 .github/workflows/setup.yml diff --git a/.github/workflows/ansible-lint-roles.yml b/.github/workflows/ansible-lint-roles.yml index 9b574d673..0cfff3489 100644 --- a/.github/workflows/ansible-lint-roles.yml +++ b/.github/workflows/ansible-lint-roles.yml @@ -5,23 +5,23 @@ on: - pull_request jobs: lint: - runs-on: ubuntu-20.04 + runs-on: ubuntu-22.04 steps: - name: check out repo - uses: actions/checkout@v2 + uses: actions/checkout@v4 with: path: "${{ github.repository }}" - name: set up python - uses: actions/setup-python@v2 + uses: actions/setup-python@v4 with: - python-version: "3.9" + python-version: "3.12" - name: install dependencies run: | python3 -m pip install --upgrade pip - python3 -m pip install ansible-lint==5.4.0 ansible==4.8.0 + python3 -m pip install ansible-lint==5.4.0 ansible==9.13.0 - name: run lint script env: diff --git a/.github/workflows/codeql.yml b/.github/workflows/codeql.yml index 005da3b1e..c43a97068 100644 --- a/.github/workflows/codeql.yml +++ b/.github/workflows/codeql.yml @@ -24,18 +24,18 @@ jobs: steps: - name: Checkout - uses: actions/checkout@v3 + uses: actions/checkout@v4 - name: Initialize CodeQL - uses: github/codeql-action/init@v2 + uses: github/codeql-action/init@v3 with: languages: ${{ matrix.language }} queries: +security-and-quality - name: Autobuild - uses: github/codeql-action/autobuild@v2 + uses: github/codeql-action/autobuild@v3 - name: Perform CodeQL Analysis - uses: github/codeql-action/analyze@v2 + uses: github/codeql-action/analyze@v3 with: category: "/language:${{ matrix.language }}" diff --git a/.github/workflows/molecule.yml b/.github/workflows/molecule.yml index 55eee2ec7..defe7bcc9 100644 --- a/.github/workflows/molecule.yml +++ b/.github/workflows/molecule.yml @@ -5,7 +5,7 @@ on: - pull_request jobs: build: - runs-on: ubuntu-20.04 + runs-on: ubuntu-22.04 strategy: max-parallel: 4 matrix: @@ -28,17 +28,17 @@ jobs: - spack steps: - name: check out repo - uses: actions/checkout@v2 + uses: actions/checkout@v4 with: path: "${{ github.repository }}" - name: set up python - uses: actions/setup-python@v2 + uses: actions/setup-python@v4 with: - python-version: "3.9" + python-version: "3.12" - name: install dependencies run: | python3 -m pip install --upgrade pip - python3 -m pip install ansible==4.8.0 + python3 -m pip install ansible==9.13.0 python3 -m pip install molecule[docker] docker - name: run molecule test run: | diff --git a/.github/workflows/setup.yml b/.github/workflows/setup.yml new file mode 100644 index 000000000..c76487b07 --- /dev/null +++ b/.github/workflows/setup.yml @@ -0,0 +1,25 @@ +--- +name: test setup.sh +on: + - push + - pull_request +jobs: + setup: + runs-on: ${{ matrix.os }} + strategy: + matrix: + os: + - ubuntu-22.04 + - ubuntu-24.04 + steps: + - name: check out repo + uses: actions/checkout@v4 + + - name: run setup.sh + run: bash scripts/setup.sh + + - name: verify ansible in venv + run: | + source /opt/deepops/env/bin/activate + ansible --version + python3 -c "from packaging.version import Version; print('packaging OK')" diff --git a/.github/workflows/stale.yml b/.github/workflows/stale.yml index bee157879..59049dbbd 100644 --- a/.github/workflows/stale.yml +++ b/.github/workflows/stale.yml @@ -18,7 +18,7 @@ jobs: pull-requests: write steps: - - uses: actions/stale@v3 + - uses: actions/stale@v9 with: repo-token: ${{ secrets.GITHUB_TOKEN }} stale-issue-message: 'This issue is stale because it has been open for 60 days with no activity. Please update the issue or it will be closed in 7 days.' diff --git a/scripts/setup.sh b/scripts/setup.sh index 070682f6a..7d665056a 100755 --- a/scripts/setup.sh +++ b/scripts/setup.sh @@ -100,12 +100,12 @@ if command -v virtualenv &> /dev/null ; then if pip show ansible 2>&1 >/dev/null; then current_version=$(pip show ansible | grep Version | awk '{print $2}') echo "Current version of Ansible is ${current_version}" - if python3 -c "from packaging.version import Version; print(Version('$current_version') >= Version('$ANSIBLE_TOO_NEW'))" | grep True 2>&1 >/dev/null; then + if "${VENV_DIR}/bin/python3" -c "from packaging.version import Version; print(Version('$current_version') >= Version('$ANSIBLE_TOO_NEW'))" | grep True 2>&1 >/dev/null; then echo "Ansible version ${current_version} too new for DeepOps" echo "Please uninstall any ansible, ansible-base, and ansible-core packages and re-run this script" exit 1 fi - if python3 -c "from packaging.version import Version; print(Version('$current_version') < Version('$ANSIBLE_VERSION'))" | grep True 2>&1 >/dev/null; then + if "${VENV_DIR}/bin/python3" -c "from packaging.version import Version; print(Version('$current_version') < Version('$ANSIBLE_VERSION'))" | grep True 2>&1 >/dev/null; then echo "Ansible will be upgraded from ${current_version} to ${ANSIBLE_VERSION}" fi fi From 879ab712d7fb4af9bcf98461032e115aa827757d Mon Sep 17 00:00:00 2001 From: Douglas Holt Date: Wed, 18 Feb 2026 13:38:27 -0700 Subject: [PATCH 3/3] ci: fix ansible-lint version pairing and molecule docker driver - Keep ansible==4.8.0 for lint job (ansible-lint 5.4.0 is incompatible with ansible-core 2.16); use Python 3.10 for compatibility - Use molecule-plugins[docker] instead of molecule[docker] (driver moved to separate package in newer molecule versions) Co-Authored-By: Claude Opus 4.6 Signed-off-by: Douglas Holt --- .github/workflows/ansible-lint-roles.yml | 6 ++++-- .github/workflows/molecule.yml | 2 +- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/.github/workflows/ansible-lint-roles.yml b/.github/workflows/ansible-lint-roles.yml index 0cfff3489..420432132 100644 --- a/.github/workflows/ansible-lint-roles.yml +++ b/.github/workflows/ansible-lint-roles.yml @@ -16,12 +16,14 @@ jobs: - name: set up python uses: actions/setup-python@v4 with: - python-version: "3.12" + python-version: "3.10" - name: install dependencies + # ansible-lint 5.4.0 requires ansible-core <=2.12 (ansible 4.x/5.x) + # TODO: upgrade ansible-lint to 24.x for ansible 9.x+ compatibility run: | python3 -m pip install --upgrade pip - python3 -m pip install ansible-lint==5.4.0 ansible==9.13.0 + python3 -m pip install ansible-lint==5.4.0 ansible==4.8.0 - name: run lint script env: diff --git a/.github/workflows/molecule.yml b/.github/workflows/molecule.yml index defe7bcc9..c1d385fcf 100644 --- a/.github/workflows/molecule.yml +++ b/.github/workflows/molecule.yml @@ -39,7 +39,7 @@ jobs: run: | python3 -m pip install --upgrade pip python3 -m pip install ansible==9.13.0 - python3 -m pip install molecule[docker] docker + python3 -m pip install molecule molecule-plugins[docker] docker - name: run molecule test run: | cd "${{ github.repository }}/roles"