Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
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
10 changes: 6 additions & 4 deletions .github/workflows/ansible-lint-roles.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,20 +5,22 @@ 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.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==4.8.0
Expand Down
8 changes: 4 additions & 4 deletions .github/workflows/codeql.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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 }}"
12 changes: 6 additions & 6 deletions .github/workflows/molecule.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ on:
- pull_request
jobs:
build:
runs-on: ubuntu-20.04
runs-on: ubuntu-22.04
strategy:
max-parallel: 4
matrix:
Expand All @@ -28,18 +28,18 @@ 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 molecule[docker] docker
python3 -m pip install ansible==9.13.0
python3 -m pip install molecule molecule-plugins[docker] docker
- name: run molecule test
run: |
cd "${{ github.repository }}/roles"
Expand Down
25 changes: 25 additions & 0 deletions .github/workflows/setup.yml
Original file line number Diff line number Diff line change
@@ -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')"
2 changes: 1 addition & 1 deletion .github/workflows/stale.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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.'
Expand Down
7 changes: 7 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,13 @@
# misc.
.*.swp

# virtualenv
/.venv/

# claude code
/CLAUDE.md
/tasks/

# project-specific
/admin.conf
/config*/
Expand Down
7 changes: 4 additions & 3 deletions scripts/setup.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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 "${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 "${PYTHON_BIN}" -c "from distutils.version import LooseVersion; print(LooseVersion('$current_version') < LooseVersion('$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
Comment on lines +103 to +108

Copilot AI Feb 18, 2026

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The packaging module is imported on lines 103 and 108 to perform version comparisons, but it is not installed until line 118. This will cause the version checks to fail with an ImportError when ansible is already installed in the venv.

The packaging module should be installed before attempting to use it for version comparisons. Consider either:

  1. Installing packaging first (before the version checks), then installing the rest of the packages
  2. Installing packaging separately before line 100
  3. Using a different version comparison method that doesn't require the packaging module for the initial checks

Copilot uses AI. Check for mistakes.
echo "Ansible will be upgraded from ${current_version} to ${ANSIBLE_VERSION}"
fi
fi
Expand All @@ -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 \
Expand Down
Loading