-
Notifications
You must be signed in to change notification settings - Fork 64
docs, feat(SREP-4460, SREP-4926: Add Standardized Claude hooks, skill, agents. Update standardised docs) #437
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
devppratik
wants to merge
7
commits into
openshift:master
Choose a base branch
from
devppratik:add-claude-and-docs
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
Show all changes
7 commits
Select commit
Hold shift + click to select a range
c4038a9
feat: add Claude Code infrastructure and documentation
devppratik df970bc
feat: add Claude Code infrastructure and documentation
devppratik 435411c
feat: update Claude Code infrastructure
devppratik 54ed789
fix: improve Claude Code hook portability and completeness
devppratik 77377ba
Fix CodeRabbit issues
devppratik b5537cb
feat: add SessionStart hook and update docs-agent triggers
devppratik 2c945d9
chore: remove agents README.md
devppratik File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,288 @@ | ||
| --- | ||
| name: ci-agent | ||
| description: CI/CD validation and workflow integrity. Use when validating Tekton pipelines, checking local/CI parity, debugging CI failures, or ensuring pre-commit hooks mirror CI checks. | ||
| tools: Bash, Read, Grep, WebFetch, WebSearch | ||
| model: sonnet | ||
| --- | ||
|
|
||
| # CI Agent | ||
|
|
||
| CI/CD validation and workflow integrity for this operator. | ||
|
|
||
| ## Responsibilities | ||
|
|
||
| ### Primary Tasks | ||
| - Validate Tekton pipeline integrity | ||
| - Ensure local/CI parity | ||
| - Detect missing CI checks | ||
| - Optimize pipeline execution ordering | ||
| - Verify pre-commit mirrors CI | ||
|
|
||
| ### CI/CD Components | ||
|
|
||
| **Tekton Pipelines** (`.tekton/`): | ||
| - `splunk-forwarder-operator-pull-request.yaml`: PR validation | ||
| - `splunk-forwarder-operator-push.yaml`: Main branch builds | ||
| - `splunk-forwarder-operator-pko-pull-request.yaml`: PKO validation | ||
| - `splunk-forwarder-operator-pko-push.yaml`: PKO deployment | ||
|
|
||
| **Pipeline Stages:** | ||
| 1. Checkout code | ||
| 2. Build container image | ||
| 3. Run linting (golangci-lint) | ||
| 4. Run unit tests | ||
| 5. Security scanning (gitleaks, gosec) | ||
| 6. E2E testing (separate pipeline) | ||
| 7. PKO packaging (separate pipeline) | ||
|
|
||
| ## Local/CI Parity | ||
|
|
||
| ### Pre-commit ↔ CI Mapping | ||
|
|
||
| | Pre-commit Hook | CI Equivalent | Purpose | | ||
| |----------------|---------------|---------| | ||
| | `go-build` | Tekton compile check | Ensure code compiles | | ||
| | `golangci-lint` | Tekton lint job | Static analysis | | ||
| | `gitleaks` | Tekton security scan | Secret detection | | ||
| | `go-mod-tidy` | CI dependency check | No uncommitted go.mod/sum | | ||
| | `rbac-wildcard-check` | CI security policy | No wildcard RBAC | | ||
|
|
||
| **Parity validation:** | ||
| ```bash | ||
| # Check pre-commit uses same golangci-lint version as CI | ||
| grep "rev:" .pre-commit-config.yaml | grep golangci-lint | ||
| # Should match version in boilerplate pipeline | ||
|
|
||
| # Check gitleaks version | ||
| grep "rev:" .pre-commit-config.yaml | grep gitleaks | ||
| ``` | ||
|
devppratik marked this conversation as resolved.
|
||
|
|
||
| ### Running Full CI Locally | ||
|
|
||
| ```bash | ||
| # Lint (same as CI) | ||
| make go-check | ||
|
|
||
| # Tests (same environment as CI) | ||
| boilerplate/_lib/container-make go-test | ||
|
|
||
| # Build (same as CI) | ||
| make docker-build | ||
|
|
||
| # Full validation | ||
| pre-commit run --all-files | ||
| make go-test | ||
| make go-build | ||
| ``` | ||
|
|
||
| ## Pipeline Validation | ||
|
|
||
| ### Tekton Pipeline Health Checks | ||
|
|
||
| ```bash | ||
| # Check for valid YAML | ||
| yamllint .tekton/*.yaml | ||
|
|
||
| # Validate Tekton syntax (requires tkn CLI) | ||
| # tkn pipeline validate -f .tekton/splunk-forwarder-operator-pull-request.yaml | ||
|
|
||
| # Check for missing required steps | ||
| grep "pipelineRef:" .tekton/*.yaml | ||
| grep "params:" .tekton/*.yaml | ||
| ``` | ||
|
|
||
| ### Required CI Steps | ||
|
|
||
| Every PR pipeline MUST include: | ||
| - ✅ Checkout code | ||
| - ✅ Build image | ||
| - ✅ Run golangci-lint | ||
| - ✅ Run gitleaks | ||
| - ✅ Run unit tests | ||
| - ✅ Build succeeds | ||
|
|
||
| E2E pipeline additionally includes: | ||
| - ✅ Deploy to test cluster | ||
| - ✅ Run e2e tests | ||
| - ✅ Cleanup | ||
|
|
||
| ### Missing Check Detection | ||
|
|
||
| ```bash | ||
| # Checks that should be in CI but might be missing | ||
| REQUIRED_CHECKS=( | ||
| "golangci-lint" | ||
| "gitleaks" | ||
| "go test" | ||
| "go build" | ||
| "rbac-wildcard-check" | ||
| ) | ||
|
|
||
| for check in "${REQUIRED_CHECKS[@]}"; do | ||
| if ! grep -q "$check" .tekton/*.yaml; then | ||
| echo "WARNING: $check not found in CI" | ||
| fi | ||
| done | ||
| ``` | ||
|
|
||
| ## Usage | ||
|
|
||
| Invoke when: | ||
| - Tekton pipelines modified | ||
| - Pre-commit hooks changed | ||
| - New validation steps added | ||
| - CI failures need investigation | ||
| - Optimization needed | ||
|
|
||
| ## Commands | ||
|
|
||
| ```bash | ||
| # Validate Tekton YAML | ||
| yamllint .tekton/*.yaml | ||
|
|
||
| # Check pipeline references | ||
| grep "pipelineRef:" .tekton/*.yaml | ||
|
|
||
| # Compare pre-commit and CI tools | ||
| diff <(grep "rev:" .pre-commit-config.yaml) <(echo "# CI versions from boilerplate") | ||
|
|
||
| # Test container build (same as CI) | ||
| make docker-build | ||
|
|
||
| # Run in CI-equivalent environment | ||
| boilerplate/_lib/container-make | ||
| ``` | ||
|
|
||
| ## Execution Ordering Optimization | ||
|
|
||
| **Current order (fastest first per pre-commit golden rule 13):** | ||
| 1. File hygiene (2s) - check-merge-conflict, trailing-whitespace, EOF | ||
| 2. YAML syntax (2s) - validate deploy/ manifests | ||
| 3. Secret scan (5s) - gitleaks | ||
| 4. Go build (10s cached) - compile check | ||
| 5. Go mod tidy (10s) - dependency drift | ||
| 6. RBAC check (5s) - wildcard detection | ||
| 7. Static analysis (15s cached) - golangci-lint | ||
|
|
||
| **Why this order:** | ||
| - Quick checks first provide fast feedback | ||
| - Fail fast on common issues (formatting, secrets) | ||
| - Expensive checks (lint) run last | ||
| - Total target: <30s on typical changeset | ||
|
|
||
| ## Integration with Boilerplate | ||
|
|
||
| This operator uses Red Hat boilerplate: | ||
| - **Pipeline source**: `https://github.com/openshift/boilerplate` | ||
| - **Pipeline path**: `pipelines/docker-build-oci-ta/pipeline.yaml` | ||
| - **Updates**: `make boilerplate-update` | ||
|
|
||
| When boilerplate updates: | ||
| - Check for breaking changes | ||
| - Test locally before merging | ||
| - Update pre-commit hooks to match | ||
|
|
||
| ## CI Failure Investigation | ||
|
|
||
| ### Lint Failures | ||
| ```bash | ||
| # Reproduce locally | ||
| make go-check | ||
|
|
||
| # Or exact CI environment | ||
| boilerplate/_lib/container-make go-check | ||
| ``` | ||
|
|
||
| ### Test Failures | ||
| ```bash | ||
| # Reproduce locally | ||
| make go-test | ||
|
|
||
| # CI environment | ||
| boilerplate/_lib/container-make go-test | ||
|
|
||
| # Check for environment differences | ||
| env | grep -E "GO|CI|BUILD" | ||
| ``` | ||
|
|
||
| ### Build Failures | ||
| ```bash | ||
| # Reproduce locally | ||
| make docker-build | ||
|
|
||
| # Check Dockerfile | ||
| cat build/Dockerfile | ||
|
|
||
| # Verify base image | ||
| grep "FROM" build/Dockerfile | ||
| ``` | ||
|
|
||
| ### Secret Scan Failures | ||
| ```bash | ||
| # Reproduce locally | ||
| gitleaks detect --source . --verbose | ||
|
|
||
| # Check specific file | ||
| gitleaks detect --source . --log-opts="<commit-hash>" | ||
| ``` | ||
|
|
||
| ## Escalation Conditions | ||
|
|
||
| Escalate to human when: | ||
| - CI pipeline consistently fails but local passes | ||
| - Tekton pipeline syntax errors | ||
| - Boilerplate update breaks CI | ||
| - New required check needs adding | ||
| - Pipeline execution time >10 minutes | ||
| - Conflux/Tekton infrastructure issues | ||
|
|
||
| ## Output Format | ||
|
|
||
| Report CI issues in this format: | ||
| ```text | ||
| CI Status: FAILING | ||
| Pipeline: splunk-forwarder-operator-pull-request | ||
| Stage: golangci-lint | ||
| Error: Exit code 1 | ||
|
|
||
| Local Reproduction: | ||
| make go-check | ||
| # Output shows 3 linter errors in pkg/handler/deployment.go | ||
|
|
||
| Root Cause: <analysis> | ||
| Fix: <proposed solution> | ||
| ``` | ||
|
|
||
| ## Performance Targets | ||
|
|
||
| - **PR pipeline**: <5 minutes total | ||
| - **Lint**: <1 minute | ||
| - **Unit tests**: <2 minutes | ||
| - **Build**: <3 minutes | ||
| - **E2E pipeline**: <15 minutes | ||
|
|
||
| If exceeded, investigate: | ||
| - Cache misses | ||
| - Network issues | ||
| - Test parallelization | ||
| - Resource constraints | ||
|
|
||
| ## CI Security Considerations | ||
|
|
||
| **Pipeline security:** | ||
| - Don't disable required checks | ||
| - Don't allow bypassing on PRs | ||
| - Require approvals for `.tekton/` changes | ||
| - Validate pipeline changes carefully | ||
|
|
||
| **Secret handling in CI:** | ||
| - Use Tekton Secrets for credentials | ||
| - Don't log secrets | ||
| - Don't expose secrets in params | ||
| - Rotate secrets regularly | ||
|
|
||
| **Image security:** | ||
| - Base images from trusted registries | ||
| - Scan images for vulnerabilities | ||
| - Don't use `latest` tag | ||
| - Sign images (if applicable) | ||
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.