Skip to content

Commit 341339d

Browse files
Merge pull request #1298 from r4f4/no-jira-agents-md
CLID-474: add AI configuration
2 parents 6dc33cc + cc0372c commit 341339d

File tree

1 file changed

+70
-0
lines changed

1 file changed

+70
-0
lines changed

AGENTS.md

Lines changed: 70 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,70 @@
1+
# AI Agent Guide for oc-mirror
2+
3+
This file provides guidance to AI agents when working with code in this repository.
4+
5+
## Project Overview
6+
7+
This is the `oc-mirror` repository - an OpenShift client tool for mirroring container registry content for disconnected cluster installs.
8+
oc-mirror reads an `ImageSetConfiguration` YAML file and mirrors container images from source registries to:
9+
- a target mirror registry (direct mirroring)
10+
- a local cache on disk, then generates a tarball for later mirroring (air-gapped scenarios)
11+
12+
### Key workflows
13+
1. **mirrorToMirror (m2m)** : direct registry-to-registry copying
14+
1. **mirrorToDisk (m2d)** : copy images to local cache and create tarball
15+
1. **diskToMirror (d2m)** : copy images from tarball to target registry
16+
17+
### Version structure
18+
- **v2** (Current) : code lives in the root directory - **THIS IS WHAT YOU SHOULD WORK ON**
19+
- **v1** (Deprecated) : code lives under the v1/ folder - **DO NOT MODIFY v1 CODE**
20+
21+
## Key Architecture components
22+
23+
The `oc-mirror` project relies heavily on the [container-libs](https://github.com/containers/container-libs) library for low-level container image operations.
24+
25+
For each container image type, `oc-mirror` defines a `Collector` interface responsible for discovering all the related images:
26+
27+
| Collector | Location | Purpose |
28+
|-----------|----------|---------|
29+
| Release | `internal/pkg/release` | Openshift release payloads |
30+
| Operator | `internal/pkg/operator`| RedHat operator catalogs |
31+
| Helm | `internal/pkg/helm`| Helm charts |
32+
| Additional | `internal/pkg/additional` | generic container images |
33+
34+
The image copying itself happens concurrently in batches via `internal/pkg/batch` for optimal performance.
35+
36+
The `ImageSetConfiguration` is defined in `internal/pkg/api/v2alpha1/`. See `docs/image-set-examples/imaget-set-config.yaml` for examples.
37+
38+
## Common development commands
39+
40+
### Building
41+
42+
```bash
43+
make clean # clean up build artifacts
44+
make build # compiles the oc-mirror binary
45+
```
46+
47+
**Important**: always use `make build`, not `go build` directly - the Makefile sets required build tags.
48+
49+
### Testing
50+
51+
```bash
52+
make test-unit # run unit tests
53+
make test-integration # run integration tests
54+
```
55+
56+
### Validation and Verification
57+
58+
```bash
59+
make verify # run golangci-lint
60+
make sanity # runs: tidy, format, and vet checks
61+
```
62+
63+
## Contributing
64+
65+
1. Write understandable code. Always prefer clarity over other things.
66+
1. Write comments and documentation in English.
67+
1. Write unit tests for your code.
68+
1. When instructed to fix tests, do not remove or modify existing tests.
69+
1. Write documentation for your code.
70+
1. Run `make sanity` before committing files.

0 commit comments

Comments
 (0)