Skip to content

Commit a29c2c9

Browse files
Merge pull request #462 from Ajpantuso/apantuso/fix_pko_fedramp
fix: ensure FEDRAMP env var is passed to operator deployment through PKO template
2 parents 5f69e78 + 558b6b2 commit a29c2c9

30 files changed

Lines changed: 1514 additions & 16 deletions

.pre-commit-config.yaml

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,14 @@
44
# =============================================================================
55
#
66
# INSTALL
7-
# pip install pre-commit
8-
# pre-commit install
7+
# For detailed setup instructions including uv (recommended) and pip,
8+
# see: boilerplate/openshift/golang-osd-operator/docs/pre-commit.md
9+
#
10+
# Quick start (uv):
11+
# uv sync && source .venv/bin/activate && pre-commit install
12+
#
13+
# Quick start (pip):
14+
# pip install 'pre-commit==4.6.0' && pre-commit install
915
#
1016
# USAGE
1117
# pre-commit run # staged files only (developer / agent workflow)
@@ -35,6 +41,9 @@
3541
# pre-existing violations on the first run. Stage and commit those fixes
3642
# separately before day-to-day use.
3743
#
44+
# Fix commits can be excluded from git blame
45+
# https://git-scm.com/docs/git-blame#Documentation/git-blame.txt---ignore-revs-filefile
46+
#
3847
# =============================================================================
3948

4049
repos:

OWNERS_ALIASES

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,10 +5,11 @@
55
aliases:
66
srep-functional-team-aurora:
77
- AlexSmithGH
8+
- BATMAN-JD
89
- dakotalongRH
910
- eth1030
11+
- geowa4
1012
- joshbranham
11-
- luis-falcon
1213
- reedcort
1314
srep-functional-team-fedramp:
1415
- theautoroboto
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
61dbfdfcfd8ab11f8ccbd58bf1d299c2fa3336dd
1+
7df87310d42bac5efb374ed0ca9aceb86076b108

boilerplate/openshift/golang-osd-operator/OWNERS_ALIASES

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,10 +5,11 @@
55
aliases:
66
srep-functional-team-aurora:
77
- AlexSmithGH
8+
- BATMAN-JD
89
- dakotalongRH
910
- eth1030
11+
- geowa4
1012
- joshbranham
11-
- luis-falcon
1213
- reedcort
1314
srep-functional-team-fedramp:
1415
- theautoroboto

boilerplate/openshift/golang-osd-operator/dependabot.yml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,8 @@ updates:
55
labels:
66
- "area/dependency"
77
- "ok-to-test"
8+
- "lgtm"
9+
- "approved"
810
schedule:
911
interval: "weekly"
1012
ignore:
Lines changed: 123 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,123 @@
1+
# Pre-Commit Hooks Setup Guide
2+
3+
## Installation
4+
5+
### Recommended: Using uv
6+
7+
[uv](https://github.com/astral-sh/uv) is recommended for Python dependency management. It provides dependency locking with package hashes (supply-chain protection), virtual environment management, and is 10-100x faster than pip.
8+
9+
**Install uv:**
10+
```bash
11+
# macOS/Linux
12+
curl -LsSf https://astral.sh/uv/install.sh | sh
13+
14+
# Windows
15+
powershell -c "irm https://astral.sh/uv/install.ps1 | iex"
16+
17+
# Via pip
18+
pip install uv
19+
```
20+
21+
**First-time setup:**
22+
```bash
23+
uv init --bare # creates pyproject.toml
24+
uv add --dev pre-commit==4.6.0 # adds dependency, generates uv.lock
25+
source .venv/bin/activate # macOS/Linux (.venv\Scripts\activate on Windows)
26+
pre-commit install
27+
```
28+
29+
**Subsequent setup** (when `pyproject.toml` and `uv.lock` exist):
30+
```bash
31+
uv sync
32+
source .venv/bin/activate
33+
pre-commit install
34+
```
35+
36+
### Alternative: Using pip
37+
38+
```bash
39+
pip install 'pre-commit==4.6.0' # pinned version (Golden Rule 15)
40+
pre-commit install
41+
```
42+
43+
Add to `requirements-dev.txt`: `pre-commit==4.6.0`
44+
45+
## First-Time Setup
46+
47+
Run on all files to catch existing issues:
48+
```bash
49+
pre-commit run --all-files
50+
```
51+
52+
Auto-fix hooks will modify files on first run. Stage and commit these separately:
53+
```bash
54+
git diff
55+
git add .
56+
git commit -m "Fix: Apply pre-commit auto-fixes"
57+
```
58+
59+
**Exclude fix commits from git blame:**
60+
```bash
61+
# Create .git-blame-ignore-revs with commit hashes
62+
git config blame.ignoreRevsFile .git-blame-ignore-revs
63+
```
64+
65+
See [git-blame docs](https://git-scm.com/docs/git-blame#Documentation/git-blame.txt---ignore-revs-filefile).
66+
67+
## Usage
68+
69+
**Automatic** (runs on `git commit`):
70+
```bash
71+
git add <files>
72+
git commit -m "Message"
73+
```
74+
75+
**Manual:**
76+
```bash
77+
pre-commit run # staged files only
78+
pre-commit run --all-files # entire repo
79+
pre-commit run --files path/to/file # specific files
80+
```
81+
82+
**Bypass (use sparingly):**
83+
```bash
84+
SKIP=hook-id git commit -m "Message" # skip one hook
85+
git commit --no-verify # NEVER use (Golden Rule 16)
86+
```
87+
88+
Rules: Agents never bypass hooks. Security hooks (gitleaks) never bypassable.
89+
90+
## Troubleshooting
91+
92+
**macOS timeout issues:**
93+
```bash
94+
brew install coreutils # provides gtimeout
95+
```
96+
97+
**Virtual environment not found:**
98+
```bash
99+
source .venv/bin/activate
100+
uv sync
101+
```
102+
103+
**Hooks not running:**
104+
```bash
105+
ls -la .git/hooks/pre-commit # verify installation
106+
pre-commit install # reinstall
107+
```
108+
109+
**Hook failures:** Read error messages and fix issues:
110+
- `go-build`: Fix compilation errors
111+
- `go-mod-tidy`: Run `go mod tidy` and stage go.mod/go.sum
112+
- `check-yaml`: Fix YAML syntax
113+
114+
## CI Integration
115+
116+
Pre-commit mirrors `ci/prow/lint`. CI is authoritative; pre-commit is developer convenience. All hooks run in CI with same config.
117+
118+
If pre-commit passes but CI fails: `pre-commit autoupdate`
119+
120+
## Resources
121+
122+
- [Pre-Commit Documentation](https://pre-commit.com/)
123+
- [uv Documentation](https://github.com/astral-sh/uv)

boilerplate/openshift/golang-osd-operator/olm_pko_migration.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111
import subprocess
1212
import sys
1313
from pathlib import Path
14-
from typing import Any
14+
from typing import Any, Optional
1515

1616
import yaml
1717

@@ -629,7 +629,7 @@ def write_pko_dockerfile():
629629
)
630630
)
631631

632-
def extract_deployment_selector() -> str | None:
632+
def extract_deployment_selector() -> Optional[str]:
633633
"""
634634
Extract the clusterDeploymentSelector from hack/olm-registry/olm-artifacts-template.yaml.
635635

boilerplate/openshift/golang-osd-operator/pre-commit-config.yaml

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,14 @@
44
# =============================================================================
55
#
66
# INSTALL
7-
# pip install pre-commit
8-
# pre-commit install
7+
# For detailed setup instructions including uv (recommended) and pip,
8+
# see: boilerplate/openshift/golang-osd-operator/docs/pre-commit.md
9+
#
10+
# Quick start (uv):
11+
# uv sync && source .venv/bin/activate && pre-commit install
12+
#
13+
# Quick start (pip):
14+
# pip install 'pre-commit==4.6.0' && pre-commit install
915
#
1016
# USAGE
1117
# pre-commit run # staged files only (developer / agent workflow)
@@ -35,6 +41,9 @@
3541
# pre-existing violations on the first run. Stage and commit those fixes
3642
# separately before day-to-day use.
3743
#
44+
# Fix commits can be excluded from git blame
45+
# https://git-scm.com/docs/git-blame#Documentation/git-blame.txt---ignore-revs-filefile
46+
#
3847
# =============================================================================
3948

4049
repos:

build/Dockerfile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ COPY . .
88
RUN make go-build
99

1010
####
11-
FROM registry.access.redhat.com/ubi9/ubi-minimal:9.7-1778562320
11+
FROM registry.access.redhat.com/ubi9/ubi-minimal:9.8-1779809423
1212

1313
ENV USER_UID=1001 \
1414
USER_NAME=certman-operator

build/Dockerfile.olm-registry

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ COPY ${SAAS_OPERATOR_DIR} manifests
44
RUN initializer --permissive
55

66
# ubi-micro does not work for clusters with fips enabled unless we make OpenSSL available
7-
FROM registry.access.redhat.com/ubi9/ubi-minimal:9.7-1778562320
7+
FROM registry.access.redhat.com/ubi9/ubi-minimal:9.8-1779809423
88

99
COPY --from=builder /bin/registry-server /bin/registry-server
1010
COPY --from=builder /bin/grpc_health_probe /bin/grpc_health_probe

0 commit comments

Comments
 (0)