Skip to content

Commit e75c77d

Browse files
committed
feat: initial OpsPortal implementation
Signed-off-by: Damian Skrzyński <polprog.tech@gmail.com>
1 parent c52653b commit e75c77d

71 files changed

Lines changed: 12542 additions & 1 deletion

Some content is hidden

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

.env.example

Lines changed: 49 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,49 @@
1+
# OpsPortal — Environment Variables
2+
# Copy to .env and adjust as needed.
3+
4+
# ── Server ─────────────────────────────────────────────────────────────────
5+
OPSPORTAL_HOST=127.0.0.1
6+
OPSPORTAL_PORT=8000
7+
OPSPORTAL_DEBUG=false
8+
OPSPORTAL_LOG_LEVEL=info
9+
10+
# ── Paths ──────────────────────────────────────────────────────────────────
11+
# Path to the YAML tool manifest
12+
OPSPORTAL_MANIFEST_PATH=opsportal.yaml
13+
14+
# Base directory for resolving relative tool repo paths
15+
OPSPORTAL_TOOLS_BASE_DIR=..
16+
17+
# Where generated artifacts (HTML dashboards, reports) are stored
18+
OPSPORTAL_ARTIFACT_DIR=artifacts
19+
20+
# Working directory for temporary files
21+
OPSPORTAL_WORK_DIR=work
22+
23+
# ── Process Management ─────────────────────────────────────────────────────
24+
OPSPORTAL_PROCESS_STARTUP_TIMEOUT=30
25+
OPSPORTAL_CLI_TASK_TIMEOUT=300
26+
OPSPORTAL_LOG_BUFFER_SIZE=5000
27+
OPSPORTAL_HEALTH_CHECK_INTERVAL=30
28+
29+
# ── Tool Config Overrides ─────────────────────────────────────────────────
30+
# Override the default config file location for ReleaseBoard.
31+
# If unset, the adapter searches: repo_path/, tools_base_dir/, cwd/
32+
# OPSPORTAL_RELEASEBOARD_CONFIG=/path/to/releaseboard.json
33+
34+
# ── Corporate Proxy / SSL (auto-propagated to child tools) ─────────────────
35+
# These are standard environment variables. Set them in your shell or here.
36+
# OpsPortal automatically forwards them to all child tool subprocesses.
37+
#
38+
# HTTP_PROXY=http://proxy.corp.example.com:8080
39+
# HTTPS_PROXY=http://proxy.corp.example.com:8080
40+
# NO_PROXY=localhost,127.0.0.1,.corp.example.com
41+
#
42+
# ── Custom CA Certificates ─────────────────────────────────────────────────
43+
# If your organisation uses SSL inspection (Zscaler, Netskope, etc.),
44+
# point these to your corporate CA bundle:
45+
#
46+
# SSL_CERT_FILE=/etc/ssl/certs/corporate-ca-bundle.pem
47+
# REQUESTS_CA_BUNDLE=/etc/ssl/certs/corporate-ca-bundle.pem
48+
# CURL_CA_BUNDLE=/etc/ssl/certs/corporate-ca-bundle.pem
49+
# NODE_EXTRA_CA_CERTS=/etc/ssl/certs/corporate-ca-bundle.pem

.github/workflows/ci.yml

Lines changed: 131 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,131 @@
1+
name: CI
2+
3+
on:
4+
push:
5+
branches: [main]
6+
pull_request:
7+
branches: [main]
8+
9+
permissions:
10+
contents: read
11+
12+
env:
13+
PYTHON_VERSION: "3.13"
14+
15+
jobs:
16+
lint:
17+
name: Lint & Format
18+
runs-on: ubuntu-latest
19+
steps:
20+
- uses: actions/checkout@v4
21+
22+
- uses: actions/setup-python@v5
23+
with:
24+
python-version: ${{ env.PYTHON_VERSION }}
25+
26+
- name: Install dependencies
27+
run: pip install -e ".[dev]"
28+
29+
- name: Ruff lint
30+
run: python -m ruff check src/ tests/
31+
32+
- name: Ruff format check
33+
run: python -m ruff format --check src/ tests/
34+
35+
test:
36+
name: Test (Python ${{ matrix.python-version }})
37+
runs-on: ubuntu-latest
38+
strategy:
39+
matrix:
40+
python-version: ["3.12", "3.13"]
41+
steps:
42+
- uses: actions/checkout@v4
43+
44+
- uses: actions/setup-python@v5
45+
with:
46+
python-version: ${{ matrix.python-version }}
47+
48+
- name: Install dependencies
49+
run: pip install -e ".[dev]"
50+
51+
- name: Run tests
52+
run: python -m pytest tests/ -v --tb=short --junitxml=test-results.xml
53+
54+
- name: Upload test results
55+
if: always()
56+
uses: actions/upload-artifact@v4
57+
with:
58+
name: test-results-py${{ matrix.python-version }}
59+
path: test-results.xml
60+
61+
validate-config:
62+
name: Validate Configs
63+
runs-on: ubuntu-latest
64+
steps:
65+
- uses: actions/checkout@v4
66+
67+
- uses: actions/setup-python@v5
68+
with:
69+
python-version: ${{ env.PYTHON_VERSION }}
70+
71+
- name: Install dependencies
72+
run: pip install -e ".[dev]"
73+
74+
- name: Validate manifest YAML
75+
run: python -c "
76+
from opsportal.config.manifest import load_manifest
77+
from pathlib import Path
78+
m = load_manifest(Path('opsportal.yaml'), Path('.'), Path('work/tools'))
79+
print(f'Manifest OK: {len(m.enabled_tools)} tool(s) registered')
80+
for t in m.enabled_tools:
81+
src = f' [source: {t.source.repository}@{t.source.ref}]' if t.source else ''
82+
print(f' - {t.slug} ({t.integration_mode}){src}')
83+
"
84+
85+
deploy-example:
86+
name: Deploy (Example)
87+
runs-on: ubuntu-latest
88+
needs: [build]
89+
if: github.ref == 'refs/heads/main'
90+
steps:
91+
- uses: actions/checkout@v4
92+
93+
- uses: actions/setup-python@v5
94+
with:
95+
python-version: ${{ env.PYTHON_VERSION }}
96+
97+
- name: Install OpsPortal
98+
run: pip install -e ".[dev]"
99+
100+
- name: Install managed tools from remote sources
101+
run: |
102+
pip install "git+https://github.com/POLPROG-TECH/ReleasePilot.git@v1.1.0[all]"
103+
pip install "git+https://github.com/POLPROG-TECH/ReleaseBoard.git@v1.1.0"
104+
105+
- name: Verify CLI entrypoints
106+
run: |
107+
releasepilot --version
108+
releaseboard --version
109+
110+
build:
111+
name: Build Package
112+
runs-on: ubuntu-latest
113+
needs: [lint, test]
114+
steps:
115+
- uses: actions/checkout@v4
116+
117+
- uses: actions/setup-python@v5
118+
with:
119+
python-version: ${{ env.PYTHON_VERSION }}
120+
121+
- name: Install build tools
122+
run: pip install build
123+
124+
- name: Build wheel
125+
run: python -m build
126+
127+
- name: Upload artifacts
128+
uses: actions/upload-artifact@v4
129+
with:
130+
name: dist
131+
path: dist/

.gitignore

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
__pycache__/
2+
*.pyc
3+
artifacts/
4+
work/
5+
.env
6+
*.egg-info/

CODE_OF_CONDUCT.md

Lines changed: 62 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,62 @@
1+
# Contributor Covenant Code of Conduct
2+
3+
## Our Pledge
4+
5+
We as members, contributors, and leaders pledge to make participation in our
6+
community a harassment-free experience for everyone, regardless of age, body
7+
size, visible or invisible disability, ethnicity, sex characteristics, gender
8+
identity and expression, level of experience, education, socio-economic status,
9+
nationality, personal appearance, race, religion, or sexual identity
10+
and orientation.
11+
12+
We pledge to act and interact in ways that contribute to an open, welcoming,
13+
diverse, inclusive, and healthy community.
14+
15+
## Our Standards
16+
17+
Examples of behavior that contributes to a positive environment for our
18+
community include:
19+
20+
* Demonstrating empathy and kindness toward other people
21+
* Being respectful of differing opinions, viewpoints, and experiences
22+
* Giving and gracefully accepting constructive feedback
23+
* Accepting responsibility and apologizing to those affected by our mistakes,
24+
and learning from the experience
25+
* Focusing on what is best not just for us as individuals, but for the
26+
overall community
27+
28+
Examples of unacceptable behavior include:
29+
30+
* The use of sexualized language or imagery, and sexual attention or
31+
advances of any kind
32+
* Trolling, insulting or derogatory comments, and personal or political attacks
33+
* Public or private harassment
34+
* Publishing others' private information, such as a physical or email
35+
address, without their explicit permission
36+
* Other conduct which could reasonably be considered inappropriate in a
37+
professional setting
38+
39+
## Enforcement Responsibilities
40+
41+
Community leaders are responsible for clarifying and enforcing our standards of
42+
acceptable behavior and will take appropriate and fair corrective action in
43+
response to any behavior that they deem inappropriate, threatening, offensive,
44+
or harmful.
45+
46+
## Scope
47+
48+
This Code of Conduct applies within all community spaces, and also applies when
49+
an individual is officially representing the community in public spaces.
50+
51+
## Enforcement
52+
53+
Instances of abusive, harassing, or otherwise unacceptable behavior may be
54+
reported to the project maintainers at **polprog.tech@gmail.com**.
55+
56+
All complaints will be reviewed and investigated promptly and fairly.
57+
58+
## Attribution
59+
60+
This Code of Conduct is adapted from the [Contributor Covenant](https://www.contributor-covenant.org/),
61+
version 2.1, available at
62+
[https://www.contributor-covenant.org/version/2/1/code_of_conduct.html](https://www.contributor-covenant.org/version/2/1/code_of_conduct.html).

CONTRIBUTING.md

Lines changed: 69 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,69 @@
1+
# Contributing to OpsPortal
2+
3+
Thank you for your interest in contributing to OpsPortal! This guide covers everything you need to get started.
4+
5+
## Development Setup
6+
7+
Clone all repositories into a shared parent directory:
8+
9+
```bash
10+
mkdir opsportal-dev && cd opsportal-dev
11+
git clone https://github.com/POLPROG-TECH/OpsPortal.git
12+
git clone https://github.com/POLPROG-TECH/ReleasePilot.git
13+
git clone https://github.com/POLPROG-TECH/ReleaseBoard.git
14+
15+
pip3 install -e "./ReleasePilot[all]"
16+
pip3 install -e ./ReleaseBoard
17+
pip3 install -e ./OpsPortal
18+
```
19+
20+
Verify the installation:
21+
22+
```bash
23+
opsportal version
24+
```
25+
26+
### Pre-commit hook
27+
28+
```bash
29+
cd OpsPortal
30+
cp scripts/pre-commit .git/hooks/pre-commit && chmod +x .git/hooks/pre-commit
31+
```
32+
33+
## Running Tests
34+
35+
```bash
36+
pytest # all tests
37+
pytest -v # verbose
38+
pytest tests/test_security.py # specific file
39+
pytest tests/test_security.py::TestCSP # specific class
40+
```
41+
42+
Tests follow the **GIVEN/WHEN/THEN** docstring pattern (see existing tests for examples).
43+
44+
## Code Quality
45+
46+
```bash
47+
ruff check src/ tests/
48+
```
49+
50+
## How to Contribute
51+
52+
### Reporting Bugs
53+
54+
Include: expected vs actual behavior, `opsportal.yaml` (redacted), Python/OS version, steps to reproduce.
55+
56+
### Pull Requests
57+
58+
1. Branch from `main`
59+
2. Make changes + add tests
60+
3. Run `pytest` and `ruff check src/ tests/`
61+
4. Open PR with clear description
62+
63+
## Commit Convention
64+
65+
[Conventional Commits](https://www.conventionalcommits.org/): `feat:`, `fix:`, `docs:`, `test:`, `refactor:`, `chore:`
66+
67+
## License
68+
69+
See [LICENSE](LICENSE).

0 commit comments

Comments
 (0)