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
89 changes: 89 additions & 0 deletions AGENTS.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,89 @@
# AI Agent Instructions - OSDe2e

## What This Is
End-to-end testing framework for Managed services for OSD/ROSA. It is currently applied as a test framework in ROSA nightly CI jobs, OSD operator CICD pipelines and on-demand test schedules such as gap analysis.

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think there could be some value for the agent reading this to have a simple description of how this project is used and to see the README.md for more in depth context.

E.g. "This project is used as part of CICD workflows to validate changes to OpenShift Operators within OSD/ROSA, like Prow nightly jobs"

This extra little context I think would help the agent make decisions faster about design or troubleshooting issues.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The suggested description "This project is used as part of CICD workflows to validate changes to OpenShift Operators within OSD/ROSA, like Prow nightly jobs" is specific to one use case and doesn't represent all that osde2e supports fully. So I've updated the description slightly to include its applications.

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is great! It will give agents a bit more context to run off of without throwing too much at it.

## Core Test Workflow
1. Load config (CLI flags → env vars → custom YAML → defaults)
2. Provision cluster (or use existing via CLUSTER_ID)
3. Health check (optional)
4. Run tests
5. Upgrade (optional)
6. Cleanup (optional)

## Key Files
- `pkg/common/config/config.go` - All configuration options (START HERE)
- `cmd/osde2e/main.go` - Entry point
- `pkg/common/providers/` - Cloud provider implementations (OCM, ROSA)
- `pkg/common/cluster/healthchecks/` - Health validation logic
- `internal/llm/` - LLM/AI integration (Gemini)

## Common Patterns

### Configuration
- Everything in `config.go`: const key + env var + default
- Access via `viper.GetString(config.SomeKey)`
- Precedence: CLI > Env > Custom YAML > Default

### Providers
- Interface: `pkg/common/spi/`
- Registered in `main.go`


### Authoring new platform component tests
- To add new component tests: Use boilerplate (README https://github.com/openshift/boilerplate/blob/master/boilerplate/openshift/golang-osd-e2e/README.md), not here

### Logging
- Use `logr`/`klog`, not `fmt.Println`
- Structured logging preferred


## Quick Tips
1. Config changes? Edit `config.go` only
2. Provider logic? Use SPI abstraction
3. Integration test failures? Check credentials/env vars
4. Always use `gofumpt`, not `gofmt`
5. Check git status before committing

## Environment
- See `config.go` for complete list

## Architecture
```
osde2e
├── cmd/osde2e/ # CLI commands (provision, test, cleanup, krknai)
├── pkg/common/ # Core logic (config, providers, helpers)
├── internal/ # LLM analysis (llm, sanitizer, prompts)
└── test/ # Standalone Ginkgo test suites
```

## Interacting With The Code
- Always stick to existing design patterns in code
- Keep new code simple and concise
- Keep pull requests small
- Always reuse existing code
- Use go language best practices
- Prefer implementing existing or new interfaces, don't write extensive procedural logic
- Extend test helper functionality in https://github.com/openshift/osde2e-common, not here

## Before You Commit
```bash
gofumpt -w . # Format (not gofmt!)
make build # Compile
go test ./... -v # Test (integration tests need credentials)
```

## E2E Testing instructions
- Do not allow e2e test unless following env vars are set: AD_HOC_TEST_IMAGES|CLUSTER_ID|OCM_CLIENT_ID|OCM_CLIENT_SECRET|AWS_ACCESS_KEY_ID|AWS_SECRET_ACCESS_KEY
- To run via cli:
```bash
go run cmd/osde2e/main.go test --skip-health-check --skip-must-gather --skip-destroy-cluster --configs=rosa,sts,stage,ad-hoc-image"
````
- To run via IDE debugger, if IDE is VSCode, use configs/local/example-launch.json; if IDE is GoLand, use configs/local/example-e2e.run.xml

## Unit Testing instructions
- Add or update for unit tests for concrete implementation changes and new functionality, even if nobody asked.
- Fix any test or type errors until the whole suite is green.

## PR instructions
- Title format: [<jira-ID>] <Title>
20 changes: 20 additions & 0 deletions configs/local/example-e2e.run.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
<component name="ProjectRunConfigurationManager">
<configuration default="false" name="example-e2e" type="GoApplicationRunConfiguration" factoryName="Go Application">
<module name="osde2e" />
<working_directory value="$PROJECT_DIR$" />
<useCustomBuildTags value="true" />
<parameters value="test --configs=rosa,sts,stage,ad-hoc-image" />
<envs>
<env name="AD_HOC_TEST_IMAGES" value="quay.io/redhat-user-workloads/oeo-cicada-tenant/openshift/osd-example-operator-e2e:latest" />
<env name="AWS_REGION" value="us-east-1" />
<env name="SKIP_CLUSTER_HEALTH_CHECKS" value="true" />
<env name="SKIP_DESTROY_CLUSTER" value="True" />
<env name="SKIP_MUST_GATHER" value="TRUE" />
</envs>
<kind value="PACKAGE" />
<package value="github.com/openshift/osde2e/cmd/osde2e" />
<directory value="$PROJECT_DIR$" />
<filePath value="$PROJECT_DIR$" />
<method v="2" />
</configuration>
</component>
25 changes: 25 additions & 0 deletions configs/local/example-launch.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
{
"version": "0.2.0",
"configurations": [
{
"name": "example-e2e",
"type": "go",
"request": "launch",
"mode": "debug",
"hideSystemGoroutines": true,
"program": "./cmd/osde2e/main.go",
"env": {
"AD_HOC_TEST_IMAGES": "quay.io/redhat-user-workloads/oeo-cicada-tenant/openshift/osd-example-operator-e2e:latest",
"AWS_REGION": "us-east-1"
},
"args": [
"test",
"--configs",
"rosa,sts,stage,ad-hoc-image",
"--skip-must-gather",
"--skip-destroy-cluster",
"--skip-health-check"
]
}
]
}