Skip to content
Merged
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
24 changes: 12 additions & 12 deletions .github/workflows/Build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ jobs:
runs-on: ubuntu-latest
strategy:
matrix:
python-version: [ '3.9', '3.10', '3.11', '3.12', '3.13' ]
python-version: [ '3.10', '3.11', '3.12', '3.13', '3.14' ]
steps:
- uses: actions/checkout@v6
- name: Set up Python ${{ matrix.python-version }}
Expand All @@ -32,7 +32,7 @@ jobs:
sudo apt-get install build-essential python3-dev libldap2-dev libsasl2-dev vim -y
python -m pip install --upgrade pip
pip install "setuptools<82"
pip install --no-build-isolation ibm-cloud-sdk-core==3.18.0 ibm-platform-services==0.27.0 ibm-vpc==0.21.0
pip install ibm-cloud-sdk-core==3.24.4 ibm-platform-services==0.75.0 ibm-vpc==0.33.0
pip install flake8 pytest pytest-cov
if [ -f requirements.txt ]; then pip install -r requirements.txt; fi
if [ -f tests_requirements.txt ]; then pip install -r tests_requirements.txt; fi
Expand Down Expand Up @@ -69,7 +69,7 @@ jobs:
INSTANCE_ID: ${{ steps.terraform_instance_id.outputs.INSTANCE_ID }}
strategy:
matrix:
python-version: [ '3.13' ]
python-version: [ '3.14' ]
steps:
- uses: actions/checkout@v6
- name: Set up Python ${{ matrix.python-version }}
Expand Down Expand Up @@ -123,7 +123,7 @@ jobs:
strategy:
max-parallel: 1
matrix:
python-version: [ '3.9', '3.10', '3.11', '3.12', '3.13' ]
python-version: [ '3.10', '3.11', '3.12', '3.13', '3.14' ]
services:
elasticsearch:
image: docker.elastic.co/elasticsearch/elasticsearch:7.11.0
Expand All @@ -149,7 +149,7 @@ jobs:
sudo apt-get install build-essential python3-dev libldap2-dev libsasl2-dev vim -y
python -m pip install --upgrade pip
pip install "setuptools<82"
pip install --no-build-isolation ibm-cloud-sdk-core==3.18.0 ibm-platform-services==0.27.0 ibm-vpc==0.21.0
pip install ibm-cloud-sdk-core==3.24.4 ibm-platform-services==0.75.0 ibm-vpc==0.33.0
pip install flake8 pytest pytest-cov
if [ -f requirements.txt ]; then pip install -r requirements.txt; fi
if [ -f tests_requirements.txt ]; then pip install -r tests_requirements.txt; fi
Expand Down Expand Up @@ -201,7 +201,7 @@ jobs:
runs-on: ubuntu-latest
strategy:
matrix:
python-version: [ '3.13' ]
python-version: [ '3.14' ]
steps:
- uses: actions/checkout@v6
- name: Set up Python ${{ matrix.python-version }}
Expand Down Expand Up @@ -248,7 +248,7 @@ jobs:
runs-on: ubuntu-latest
strategy:
matrix:
python-version: [ '3.13' ]
python-version: [ '3.14' ]
steps:
- uses: actions/checkout@v6
- name: Set up Python ${{ matrix.python-version }}
Expand All @@ -271,7 +271,7 @@ jobs:
runs-on: ubuntu-latest
strategy:
matrix:
python-version: [ '3.13' ]
python-version: [ '3.14' ]
steps:
- uses: actions/checkout@v6
- name: Set up Python ${{ matrix.python-version }}
Expand All @@ -288,7 +288,7 @@ jobs:
sudo apt-get install build-essential python3-dev libldap2-dev libsasl2-dev vim -y
python -m pip install --upgrade pip
pip install "setuptools<82"
pip install --no-build-isolation ibm-cloud-sdk-core==3.18.0 ibm-platform-services==0.27.0 ibm-vpc==0.21.0 ibm-schematics==1.0.1
pip install ibm-cloud-sdk-core==3.24.4 ibm-platform-services==0.75.0 ibm-vpc==0.33.0 ibm-schematics==1.0.1
echo '⌛ Wait till package will be updated in PyPI'
# Verfiy and wait till latest cloud-governance version will be updated in Pypi (timeout 900 seconds)
timeout=900
Expand Down Expand Up @@ -324,7 +324,7 @@ jobs:
runs-on: ubuntu-latest
strategy:
matrix:
python-version: [ '3.13' ]
python-version: [ '3.14' ]
steps:
- uses: actions/checkout@v6
- name: Set up Python ${{ matrix.python-version }}
Expand All @@ -345,7 +345,7 @@ jobs:
runs-on: ubuntu-latest
strategy:
matrix:
python-version: [ '3.13' ]
python-version: [ '3.14' ]
steps:
- uses: actions/checkout@v6
- name: Set up Python ${{ matrix.python-version }}
Expand All @@ -369,7 +369,7 @@ jobs:
runs-on: ubuntu-latest
strategy:
matrix:
python-version: [ '3.13' ]
python-version: [ '3.14' ]
needs: [ unittest, terraform_apply, integration, pypi_upload, pypi_validate, public_quay_upload, private_quay_upload ]
steps:
- uses: actions/checkout@v6
Expand Down
12 changes: 6 additions & 6 deletions .github/workflows/PR.yml
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ jobs:
runs-on: ubuntu-latest
strategy:
matrix:
python-version: [ '3.13' ]
python-version: [ '3.14' ]
outputs:
INSTANCE_ID: ${{ steps.terraform_instance_id.outputs.INSTANCE_ID }}
steps:
Expand Down Expand Up @@ -101,7 +101,7 @@ jobs:
strategy:
max-parallel: 1
matrix:
python-version: [ '3.9', '3.10', '3.11', '3.12', '3.13' ]
python-version: [ '3.10', '3.11', '3.12', '3.13', '3.14' ]
services:
elasticsearch:
image: docker.elastic.co/elasticsearch/elasticsearch:7.11.0
Expand Down Expand Up @@ -131,7 +131,7 @@ jobs:
sudo apt-get install -y build-essential python3-dev libldap2-dev libsasl2-dev
python -m pip install --upgrade pip
pip install "setuptools<82"
pip install --no-build-isolation ibm-cloud-sdk-core==3.18.0 ibm-platform-services==0.27.0 ibm-vpc==0.21.0
pip install ibm-cloud-sdk-core==3.24.4 ibm-platform-services==0.75.0 ibm-vpc==0.33.0
pip install pytest pytest-cov
if [ -f requirements.txt ]; then pip install -r requirements.txt; fi
if [ -f tests_requirements.txt ]; then pip install -r tests_requirements.txt; fi
Expand Down Expand Up @@ -170,7 +170,7 @@ jobs:
if: success() || failure()
strategy:
matrix:
python-version: [ '3.13' ]
python-version: [ '3.14' ]
steps:
- uses: actions/checkout@v6
with:
Expand Down Expand Up @@ -218,7 +218,7 @@ jobs:
runs-on: ubuntu-latest
strategy:
matrix:
python-version: [ '3.9', '3.10', '3.11', '3.12', '3.13' ]
python-version: [ '3.10', '3.11', '3.12', '3.13', '3.14' ]
steps:
- uses: actions/checkout@v6
with:
Expand All @@ -235,7 +235,7 @@ jobs:
sudo apt-get install -y build-essential python3-dev libldap2-dev libsasl2-dev
python -m pip install --upgrade pip
pip install "setuptools<82"
pip install --no-build-isolation ibm-cloud-sdk-core==3.18.0 ibm-platform-services==0.27.0 ibm-vpc==0.21.0
pip install ibm-cloud-sdk-core==3.24.4 ibm-platform-services==0.75.0 ibm-vpc==0.33.0
pip install pytest pytest-cov
if [ -f requirements.txt ]; then pip install -r requirements.txt; fi
if [ -f tests_requirements.txt ]; then pip install -r tests_requirements.txt; fi
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/PR_Approval.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ jobs:
runs-on: ubuntu-latest
strategy:
matrix:
python-version: ['3.9', '3.10', '3.11', '3.12', '3.13']
python-version: ['3.10', '3.11', '3.12', '3.13', '3.14']
steps:
- uses: actions/checkout@v6
with:
Expand All @@ -31,7 +31,7 @@ jobs:
sudo apt-get install -y build-essential python3-dev libldap2-dev libsasl2-dev
python -m pip install --upgrade pip
pip install "setuptools<82"
pip install --no-build-isolation ibm-cloud-sdk-core==3.18.0 ibm-platform-services==0.27.0 ibm-vpc==0.21.0
pip install ibm-cloud-sdk-core==3.24.4 ibm-platform-services==0.75.0 ibm-vpc==0.33.0
pip install flake8 pytest pytest-cov
if [ -f requirements.txt ]; then pip install -r requirements.txt; fi
if [ -f tests_requirements.txt ]; then pip install -r tests_requirements.txt; fi
Expand Down
4 changes: 2 additions & 2 deletions CLAUDE.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ This file provides guidance to Claude Code (claude.ai/code) when working with co

### Development Setup
```bash
python3.9 -m venv .venv
python3.10 -m venv .venv
source ./.venv/bin/activate
pip install -r requirements.txt
pip install -r tests_requirements.txt
Expand Down Expand Up @@ -102,7 +102,7 @@ flake8 . --count --exit-zero --max-complexity=10 --max-line-length=127 --statist
```

### Testing Strategy
- **Unit Tests**: `pytest -v tests/unittest` - Python 3.9-3.13 matrix
- **Unit Tests**: `pytest -v tests/unittest` - Python 3.10-3.14 matrix
- **Integration Tests**: `pytest -v tests/integration` - Requires AWS/Azure/GCP credentials and ElasticSearch
- **E2E Tests**: Cross-region policy validation using containerized deployments
- **Coverage**: Uses coveralls.io for coverage reporting
Expand Down
2 changes: 1 addition & 1 deletion CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ git clone --single-branch --branch main https://github.com/redhat-performance/cl
```
cd cloud-governance/
git checkout -b <name_of_change>
python3.9 -m venv .venv
python3.10 -m venv .venv
source ./.venv/bin/activate
pip install -r requirmenets.txt
```
Expand Down
11 changes: 7 additions & 4 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
FROM python:3.13-slim
FROM python:3.14-slim

# cloud-governance latest version
ARG VERSION
Expand All @@ -14,10 +14,13 @@ RUN apt-get update \
&& mv gitleaks /usr/local/bin/ \
&& gitleaks --version

# Pin setuptools<82 so pkg_resources is available when building ibm-cloud-sdk-core
# Pre-install IBM packages, then use a constraints file so pip cannot
# downgrade them when resolving cloud-governance's published dependencies.
RUN python -m pip --no-cache-dir install --upgrade pip "setuptools>=58,<82" wheel && \
pip --no-cache-dir install --no-build-isolation ibm-cloud-sdk-core==3.18.0 ibm-platform-services==0.27.0 ibm-vpc==0.21.0 ibm-schematics==1.0.1 && \
pip --no-cache-dir install cloud-governance --upgrade
pip --no-cache-dir install ibm-cloud-sdk-core==3.24.4 ibm-platform-services==0.75.0 ibm-vpc==0.33.0 ibm-schematics==1.0.1 && \
printf 'ibm-cloud-sdk-core==3.24.4\nibm-platform-services==0.75.0\nibm-vpc==0.33.0\nibm-schematics==1.0.1\n' > /tmp/constraints.txt && \
pip --no-cache-dir install cloud-governance --upgrade -c /tmp/constraints.txt && \
rm /tmp/constraints.txt
RUN pip3 --no-cache-dir install --upgrade awscli
ADD cloud_governance/policy /usr/local/cloud_governance/policy/
COPY cloud_governance/main/main.py /usr/local/cloud_governance/main.py
Expand Down
6 changes: 4 additions & 2 deletions cloud_governance/common/clouds/aws/price/price.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,9 @@
from time import strftime

import json
from pkg_resources import resource_filename
from pathlib import Path

import botocore

from cloud_governance.common.clouds.aws.utils.common_methods import get_boto3_client
from cloud_governance.common.logger.init_logger import logger
Expand Down Expand Up @@ -62,7 +64,7 @@ def get_region_name(self, region_code):
@return:
"""
default_region = 'us-east-1'
endpoint_file = resource_filename('botocore', 'data/endpoints.json')
endpoint_file = str(Path(botocore.__file__).parent / 'data' / 'endpoints.json')
try:
with open(endpoint_file, 'r') as f:
data = json.load(f)
Expand Down
4 changes: 2 additions & 2 deletions cloud_governance/common/ldap/ldap_search.py
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
import os

import ldap
# installation for rhel/centos - python3.9
# sudo dnf install -y python39-devel openldap-devel gcc
# installation for rhel/centos
# sudo dnf install -y python3-devel openldap-devel gcc

from cloud_governance.common.logger.init_logger import logger
from cloud_governance.common.utils.api_requests import APIRequests
Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,10 @@
import json
import os

from pathlib import Path

import boto3
from pkg_resources import resource_filename
import botocore


class InstanceTypes:
Expand All @@ -29,7 +31,7 @@ def get_region_name(self, region_code):
@return:
"""
default_region = 'us-east-1'
endpoint_file = resource_filename('botocore', 'data/endpoints.json')
endpoint_file = str(Path(botocore.__file__).parent / 'data' / 'endpoints.json')
try:
with open(endpoint_file, 'r') as f:
data = json.load(f)
Expand Down
26 changes: 14 additions & 12 deletions requirements.txt
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
aiohttp==3.10.11
aiohttp==3.13.3
attrs==21.4.0
azure-identity==1.16.1
azure-mgmt-billing==6.0.0
Expand All @@ -8,33 +8,35 @@ azure-mgmt-monitor==6.0.2
azure-mgmt-network==25.0.0
azure-mgmt-resource==23.0.1
azure-mgmt-subscription==3.1.1
boto3==1.33.1
botocore==1.33.8
elasticsearch==7.13.4 # opensearch 1.2.4 for elasticsearch
boto3==1.42.89
botocore==1.42.89
elasticsearch==7.17.13 # opensearch 1.2.4 for elasticsearch
elasticsearch-dsl==7.4.0
google-api-python-client==2.57.0
google-auth-httplib2==0.1.0
google-auth-oauthlib==0.5.2
google-cloud-bigquery==3.5.0
google-cloud-billing==1.9.1
ibm-cloud-sdk-core==3.18.0
ibm-cos-sdk==2.13.6
ibm-platform-services==0.27.0
google-cloud-bigquery==3.41.0
google-cloud-billing==1.19.0
ibm-cloud-sdk-core==3.24.4
ibm-cos-sdk==2.16.1
ibm-platform-services==0.75.0
ibm-schematics==1.0.1
ibm-vpc==0.21.0
ibm-vpc==0.33.0
myst-parser==1.0.0
numpy<=1.26.4 # opensearch 1.2.4 for elasticsearch
oauthlib~=3.1.1
pandas
protobuf==5.29.6
PyAthena[Pandas]==3.0.5
PyGitHub==1.55
python-ldap==3.4.2
requests==2.32.2
pytz
requests==2.33.1
retry==0.9.2
setuptools
SoftLayer==6.0.0
sphinx==5.0.0
sphinx-rtd-theme==1.0.0
typeguard==2.13.3
typing==3.7.4.3
urllib3==1.26.19
urllib3==2.6.3
Loading