Skip to content

Commit a9fa1e4

Browse files
committed
Merge branch 'stable' into isc
2 parents dc661a2 + 31e7ccf commit a9fa1e4

112 files changed

Lines changed: 9726 additions & 284 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

.github/workflows/docs.yml

Lines changed: 51 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,51 @@
1+
name: Build Documentation
2+
3+
on:
4+
push:
5+
branches:
6+
- '**'
7+
tags-ignore:
8+
- '**'
9+
release:
10+
types: [ published ]
11+
12+
# Ensure only one build at a time for any branch, cancelling any in-progress builds
13+
concurrency:
14+
group: ${{ github.workflow }}-${{ github.ref }}
15+
cancel-in-progress: true
16+
17+
jobs:
18+
deploy-docs:
19+
runs-on: ubuntu-latest
20+
steps:
21+
- name: Checkout repository
22+
uses: actions/checkout@v4
23+
24+
- name: Set up Python
25+
uses: actions/setup-python@v5
26+
with:
27+
python-version: '3.12'
28+
29+
- name: Cache pip packages
30+
uses: actions/cache@v4
31+
with:
32+
path: ~/.cache/pip
33+
key: ${{ runner.os }}-pip-${{ hashFiles('**/setup.py', '**/pyproject.toml') }}
34+
restore-keys: |
35+
${{ runner.os }}-pip-
36+
37+
- name: Install package and doc build dependencies
38+
run: |
39+
python -m pip install --upgrade pip
40+
pip install -e ".[docs]"
41+
42+
- name: Build documentation
43+
run: |
44+
mkdocs build
45+
46+
- name: Deploy
47+
uses: JamesIves/github-pages-deploy-action@4.1.7
48+
if: ${{ github.event_name == 'release' || contains(github.event.head_commit.message, '[doc]') }}
49+
with:
50+
branch: gh-pages
51+
folder: site

.gitignore

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,3 +19,5 @@ venv/
1919
# Other
2020
kubectl.exe
2121
/build
22+
/.vscode
23+
/site

.secrets.baseline

Lines changed: 49 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
"files": "^.secrets.baseline$",
44
"lines": null
55
},
6-
"generated_at": "2025-12-15T15:57:18Z",
6+
"generated_at": "2026-01-14T11:35:47Z",
77
"plugins_used": [
88
{
99
"name": "AWSKeyDetector"
@@ -95,6 +95,44 @@
9595
"verified_result": null
9696
}
9797
],
98+
"docs/cli/create-initial-users.md": [
99+
{
100+
"hashed_secret": "33f220dd67f717cc949db63e21c90e130a6137da",
101+
"is_secret": false,
102+
"is_verified": false,
103+
"line_number": 126,
104+
"type": "Secret Keyword",
105+
"verified_result": null
106+
}
107+
],
108+
"docs/cli/index.md": [
109+
{
110+
"hashed_secret": "33f220dd67f717cc949db63e21c90e130a6137da",
111+
"is_secret": false,
112+
"is_verified": false,
113+
"line_number": 56,
114+
"type": "Secret Keyword",
115+
"verified_result": null
116+
}
117+
],
118+
"docs/cli/notify-slack.md": [
119+
{
120+
"hashed_secret": "1572c8dd915cf3bdecae817b1cb65847b4e94037",
121+
"is_secret": false,
122+
"is_verified": false,
123+
"line_number": 61,
124+
"type": "Secret Keyword",
125+
"verified_result": null
126+
},
127+
{
128+
"hashed_secret": "2d8b1074eb78b85690ced3d2cc0aed0466f6f652",
129+
"is_secret": false,
130+
"is_verified": false,
131+
"line_number": 207,
132+
"type": "Secret Keyword",
133+
"verified_result": null
134+
}
135+
],
98136
"src/mas/devops/templates/ibm-entitlement-dockerconfig.json.j2": [
99137
{
100138
"hashed_secret": "d2e2ab0f407e4ee3cf2ab87d61c31b25a74085e5",
@@ -105,6 +143,16 @@
105143
"verified_result": null
106144
}
107145
],
146+
"test/src/test_backup.py": [
147+
{
148+
"hashed_secret": "4dfd3a58b4820476afe7efa2e2c52b267eec876a",
149+
"is_secret": false,
150+
"is_verified": false,
151+
"line_number": 753,
152+
"type": "Secret Keyword",
153+
"verified_result": null
154+
}
155+
],
108156
"test/src/test_db2.py": [
109157
{
110158
"hashed_secret": "a4b48a81cdab1e1a5dd37907d6c85ca1c61ddc7c",

AGENT_INSTRUCTIONS.md

Lines changed: 84 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,84 @@
1+
# python-devops AI Coding Instructions
2+
3+
## Project Overview
4+
Python package for IBM Maximo DevOps utilities. Provides command-line tools for deployment automation, database validation, Slack notifications, and user management. Distributed as installable package with `setup.py`/`pyproject.toml` and standalone scripts in `bin/`.
5+
6+
## Architecture
7+
- **bin/**: Executable CLI scripts (entry points)
8+
- `mas-devops-*`: Command-line tools for specific operations
9+
- Scripts import from `src/` package for implementation
10+
- Each script typically wraps a single operational task
11+
- **src/**: Main package source code
12+
- Organized by module/function (import path: `from mas_devops import ...`)
13+
- Core utilities: configuration management, API clients, database handlers
14+
- **test/**: Test suite (pytest structure)
15+
- Mirror `src/` structure in test files
16+
- Run with `pytest` or `make test`
17+
- **build/**: Generated artifacts (don't edit)
18+
- `*.egg-info/`: Package metadata
19+
- `dist/`, `*.whl`: Distribution packages
20+
- **setup.py** / **pyproject.toml**: Package definition
21+
- Entry points defined in setup.py pointing to `bin/` scripts
22+
- Dependencies in both files (must keep in sync)
23+
- Version defined once (check both files)
24+
25+
## Key Patterns
26+
- **CLI Tool Pattern**: `bin/mas-devops-*` scripts are thin wrappers
27+
- Import main logic from `src/mas_devops/`
28+
- Handle argument parsing and error reporting
29+
- Example: `mas-devops-notify-slack` → calls slack notification module
30+
- **Dependency Management**:
31+
- Core dependencies in `setup.py` `install_requires`
32+
- Dev dependencies in `setup.py` `extras_require['dev']`
33+
- `requirements.txt` for pinned versions (reproducible installs)
34+
- Keep all three in sync
35+
- **Entry Points**: `setup.py` defines CLI commands
36+
- Format: `'mas-devops-task-name = mas_devops.module:main_function'`
37+
- Creates executable scripts in `bin/` when package installed
38+
- **Module Organization**: Import directly from package
39+
- `from mas_devops.db2_validator import validate_config`
40+
- Avoid deep nesting; keep public API clear
41+
42+
## Development Workflow
43+
```bash
44+
make install # Install package in dev mode (pip install -e .)
45+
make test # Run pytest suite
46+
make test-verbose # Pytest with verbose output
47+
make build # Build distribution (wheel/tarball)
48+
make clean # Remove build artifacts
49+
make all # Clean, test, build
50+
```
51+
52+
## Important Conventions
53+
- **Python Version**: Check `setup.py` for `python_requires` (e.g., `>=3.8`)
54+
- **Entry Points**: Adding new CLI tool requires editing `setup.py` entry_points section
55+
- **Error Handling**: CLI scripts should catch exceptions and exit with meaningful error messages
56+
- **Logging**: Use Python logging module; configure in main module
57+
- **Testing**: Test structure mirrors source; test file for `src/module.py` is `test/test_module.py`
58+
- **Documentation**: Docstrings in functions should describe parameters, return, exceptions
59+
- **Imports**: Use absolute imports from package (`from mas_devops import ...`), not relative
60+
61+
## Common CLI Tools (Reference)
62+
- `mas-devops-create-initial-users-for-saas`: User provisioning (SaaS)
63+
- `mas-devops-db2-validate-config`: Validate DB2 configuration
64+
- `mas-devops-notify-slack`: Send notifications
65+
- `mas-devops-saas-job-cleaner`: Cleanup SaaS jobs
66+
67+
## Integration Points
68+
- **ansible-devops**: Playbooks call these Python utilities for infrastructure setup
69+
- **playbook**: Runbooks document procedures; Python tools automate them
70+
- **Standalone Usage**: Scripts can be called independently or from other tools via entry points
71+
- **Distribution**: Package installed via pip; entry points register CLI commands globally
72+
73+
## When Adding New CLI Tool
74+
1. Create implementation module in `src/mas_devops/`
75+
2. Create script in `bin/mas-devops-tool-name` or update `setup.py` entry_points
76+
3. Add entry to `setup.py` entry_points section
77+
4. Add tests in `test/` matching module structure
78+
5. Update `requirements.txt` if adding dependencies
79+
6. Test with `make install` then run `mas-devops-tool-name --help`
80+
81+
## Packaging & Distribution
82+
- Build: `python -m build` or `make build`
83+
- Outputs: wheel file in `dist/` ready for pip install
84+
- Version managed in `setup.py` (check both setup.py and pyproject.toml)

MANIFEST.in

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
11
include src/mas/devops/templates/*.json.j2
22
include src/mas/devops/templates/*.yml.j2
33
include src/mas/devops/data/catalogs/*.yaml
4+
include src/mas/devops/data/*.yaml

README.md

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -88,5 +88,4 @@ mas-devops-create-initial-users-for-saas \
8888
Example of initial_users secret:
8989
```json
9090
{"john.smith1@example.com":"primary,john1,smith1","john.smith2@example.com":"primary,john2,smith2","john.smith3@example.com":"secondary,john3,smith3"}
91-
```
92-
91+
```

bin/mas-devops-notify-slack

100644100755
Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ def _getToolchainLink() -> str:
3333
return ""
3434

3535

36-
def notifyProvisionFyre(channels: list[str], rc: int, additionalMsg: str = None) -> bool:
36+
def notifyProvisionFyre(channels: list[str], rc: int, additionalMsg: str | None = None) -> bool:
3737
"""Send Slack notification about Fyre OCP cluster provisioning status."""
3838
name = _getClusterName()
3939
toolchainLink = _getToolchainLink()
@@ -67,7 +67,7 @@ def notifyProvisionFyre(channels: list[str], rc: int, additionalMsg: str = None)
6767
return response.data.get("ok", False)
6868

6969

70-
def notifyProvisionRoks(channels: list[str], rc: int, additionalMsg: str = None) -> bool:
70+
def notifyProvisionRoks(channels: list[str], rc: int, additionalMsg: str | None = None) -> bool:
7171
"""Send Slack notification about ROKS cluster provisioning status."""
7272
name = _getClusterName()
7373
toolchainLink = _getToolchainLink()
@@ -81,14 +81,14 @@ def notifyProvisionRoks(channels: list[str], rc: int, additionalMsg: str = None)
8181
message = [
8282
SlackUtil.buildHeader(f":glyph-ok: Your IBM Cloud ROKS cluster ({name}) is ready"),
8383
SlackUtil.buildSection(f"{url}"),
84-
SlackUtil.buildSection(f"<https://cloud.ibm.com/kubernetes/clusters|IBM Cloud Dashboard>{toolchainLink}")
84+
SlackUtil.buildSection(f"<https://cloud.ibm.com/kubernetes/clusters|IBM Cloud Dashboard> | {toolchainLink}")
8585
]
8686
if additionalMsg is not None:
8787
message.append(SlackUtil.buildSection(additionalMsg))
8888
else:
8989
message = [
9090
SlackUtil.buildHeader(f":glyph-fail: Your IBM Cloud ROKS cluster ({name}) failed to deploy"),
91-
SlackUtil.buildSection(f"<https://cloud.ibm.com/kubernetes/clusters|IBM Cloud Dashboard>{toolchainLink}")
91+
SlackUtil.buildSection(f"<https://cloud.ibm.com/kubernetes/clusters|IBM Cloud Dashboard> | {toolchainLink}")
9292
]
9393

9494
response = SlackUtil.postMessageBlocks(channels, message)

docs/api/aiservice.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
# AI Service Module
2+
3+
The `aiservice` module provides functions for AI/ML service management and configuration.
4+
5+
::: mas.devops.aiservice

docs/api/db2.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
# DB2 Module
2+
3+
The `db2` module provides functions for DB2 database configuration and validation.
4+
5+
::: mas.devops.db2

docs/api/index.md

Lines changed: 98 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,98 @@
1+
# API Reference
2+
3+
Welcome to the MAS DevOps API reference documentation. This section provides detailed documentation for all modules, classes, and functions in the `mas-devops` package.
4+
5+
## Core Modules
6+
7+
These modules provide fundamental operations for working with OpenShift/Kubernetes and related technologies:
8+
9+
- **[OCP](ocp.md)**: OpenShift/Kubernetes cluster operations including namespace management, resource creation, and cluster interactions
10+
- **[Tekton](tekton.md)**: Pipeline management, installation, and execution of Tekton pipelines for MAS automation
11+
- **[OLM](olm.md)**: Operator Lifecycle Manager operations for installing and managing operators
12+
- **[Utils](utils.md)**: Common utility functions and helper methods used throughout the library
13+
14+
## MAS Modules
15+
16+
Modules specifically designed for managing Maximo Application Suite:
17+
18+
- **[Suite](mas/suite.md)**: Core MAS suite management including installation, configuration, and lifecycle operations
19+
- **[Apps](mas/apps.md)**: MAS application management for deploying and configuring MAS applications like Manage, Monitor, etc.
20+
21+
## Service Integration Modules
22+
23+
Modules for integrating with various services and dependencies:
24+
25+
- **[DB2](db2.md)**: Database operations including DB2 configuration validation and management
26+
- **[SLS](sls.md)**: Suite License Service integration for license management
27+
- **[AI Service](aiservice.md)**: AI/ML service management and configuration
28+
- **[Slack](slack.md)**: Slack notification and alerting integration
29+
30+
## SaaS Modules
31+
32+
Modules for SaaS-specific operations:
33+
34+
- **[Job Cleaner](saas/job_cleaner.md)**: Utilities for cleaning up completed jobs in SaaS environments
35+
36+
## User Management
37+
38+
- **[Users](users.md)**: User creation and management for MAS deployments
39+
40+
## Module Overview
41+
42+
### Core Operations
43+
44+
The core modules provide the foundation for all MAS DevOps operations:
45+
46+
```python
47+
from mas.devops.ocp import createNamespace, getResource
48+
from mas.devops.tekton import installOpenShiftPipelines
49+
from mas.devops.olm import installOperator
50+
from mas.devops.utils import waitForResource
51+
```
52+
53+
### MAS Management
54+
55+
Work with MAS suite and applications:
56+
57+
```python
58+
from mas.devops.mas.suite import installMAS, configureMAS
59+
from mas.devops.mas.apps import installApp, configureApp
60+
```
61+
62+
### Service Integration
63+
64+
Integrate with external services:
65+
66+
```python
67+
from mas.devops.db2 import validateDB2Config
68+
from mas.devops.sls import configureSLS
69+
from mas.devops.slack import sendSlackNotification
70+
```
71+
72+
## Navigation
73+
74+
Use the navigation menu on the left to browse through the API documentation for each module. Each module page includes:
75+
76+
- Module overview and purpose
77+
- Class and function documentation with parameters and return types
78+
- Usage examples
79+
- Related modules and cross-references
80+
81+
## Conventions
82+
83+
Throughout the API documentation:
84+
85+
- **Required parameters** are clearly marked
86+
- **Optional parameters** include default values
87+
- **Return types** are specified for all functions
88+
- **Exceptions** that may be raised are documented
89+
- **Examples** demonstrate common usage patterns
90+
91+
## Getting Help
92+
93+
If you need help using the API:
94+
95+
1. Check the [Quick Start Guide](../getting-started/quickstart.md) for common usage patterns
96+
2. Review the specific module documentation for detailed information
97+
3. Look at the [CLI Tools](../cli/index.md) for command-line usage examples
98+
4. Visit the [GitHub repository](https://github.com/ibm-mas/python-devops) to report issues or ask questions

0 commit comments

Comments
 (0)