feat(source): add repo source type for AOSP/AAOS manifest-based builds#31
Draft
ambient-code[bot] wants to merge 1 commit into
Draft
feat(source): add repo source type for AOSP/AAOS manifest-based builds#31ambient-code[bot] wants to merge 1 commit into
ambient-code[bot] wants to merge 1 commit into
Conversation
Adds repo as a first-class source type enabling AOSP/AAOS and Cuttlefish target builds via Google's repo tool. Previously, users had to embed repo init/repo sync inside a build stage, which prevented operator-managed mirror reuse and re-downloaded 100+ GB of source on every build. Changes: - api/v1alpha1/buildjob_types.go: add SourceTypeRepo constant, RepoSource struct (manifestUrl, branch, manifestName, mirrorRef, syncJobs), Repo field in SourceSpec, update kubebuilder enum to Enum=git;pvc;repo - api/v1alpha1/zz_generated.deepcopy.go: add RepoSource deepcopy methods, update SourceSpec.DeepCopyInto to handle Repo pointer - internal/tekton/pipelinerun_builder.go: add repo case in source switch, buildRepoTaskSpec() generating a repo-sync Tekton task with optional mirror PVC mount (--reference=<path>), inject BOB_MANIFEST_URL/BOB_MANIFEST_BRANCH - internal/tekton/pipelinerun_builder_test.go: 9 new regression tests covering basic task generation, mirror mount, env vars, chaining, nil guard, and more - config/crd/bases/builder.sdv.cloud.redhat.com_buildjobs.yaml: update enum to [git, pvc, repo], add repo object schema - gofmt alignment fixes across api/ and internal/ (no logic changes) Fixes #28 ## Summary - Added `repo` source type for AOSP/AAOS manifest-based builds - When `mirrorRef` is set, mounts the named PVC read-only at `/mnt/mirror` and passes `--reference=/mnt/mirror` to `repo init` to avoid re-downloading - Injects `BOB_MANIFEST_URL` and `BOB_MANIFEST_BRANCH` into all build stages - 9 unit tests added; all 6 test packages pass with race detector ## Test plan - [ ] Apply updated CRD: `kubectl apply -f config/crd/bases/builder.sdv.cloud.redhat.com_buildjobs.yaml` - [ ] Create a BuildJob with `source.type: repo` and verify `repo-sync` task appears in PipelineRun - [ ] Verify `BOB_MANIFEST_URL` and `BOB_MANIFEST_BRANCH` are set in build stage env - [ ] With `mirrorRef` set, verify mirror PVC is mounted read-only at `/mnt/mirror` - [ ] Confirm existing `git` and `pvc` source types still work unchanged 🤖 Generated with [Claude Code](https://claude.com/claude-code)
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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
PR Description
feat(source): add
reposource type for AOSP/AAOS manifest-based buildsFixes #28
Summary
Adds
repoas a first-class source type in builder-operator, enabling AOSP,AAOS, and Cuttlefish target builds via Google's
repotool. Previously, usershad to embed
repo init/repo syncinside a build stage, which preventedoperator-managed mirror reuse and re-downloaded 100+ GB of source on every build.
Changes
API types (
api/v1alpha1/buildjob_types.go)SourceTypeRepo SourceType = "repo"constantRepoSourcestruct:manifestUrl(required),branch,manifestName,mirrorRef(PVC name for local mirror),syncJobs(repo sync parallelism)Repo *RepoSourcefield toSourceSpecEnum=git;pvctoEnum=git;pvc;repoDeepcopy (
api/v1alpha1/zz_generated.deepcopy.go)RepoSource.DeepCopyInto/RepoSource.DeepCopySourceSpec.DeepCopyIntoto handle the newRepopointerPipeline builder (
internal/tekton/pipelinerun_builder.go)RepoInitImage = "python:3.12-slim"constantrepocase to the source switch inBuildPipelineRunWithConfigbuildRepoTaskSpec()— generates arepo-syncTekton task:repovia pip if not already presentrepo init -u <url> [-b <branch>] [-m <manifest>]repo sync -j<N>(default 4)mirrorRefis set: mounts the named PVC read-only at/mnt/mirrorand passes
--reference=/mnt/mirrortorepo initbuildEnvVarsto injectBOB_MANIFEST_URLandBOB_MANIFEST_BRANCHwhen source type is
repoCRD YAML (
config/crd/bases/builder.sdv.cloud.redhat.com_buildjobs.yaml)source.typeenum:[git, pvc]→[git, pvc, repo]repoobject definition with all five fieldsExample BuildJob
Testing
internal/tekton/pipelinerun_builder_test.gogo test ./... -race)go build ./...andgo vet ./...passNew tests
TestBuildPipelineRun_RepoSourceTaskTestBuildPipelineRun_RepoSourceDefaultSyncJobsTestBuildPipelineRun_RepoSourceMirrorMount--reference=TestBuildPipelineRun_RepoSourceNoMirrorMountTestBuildPipelineRun_RepoSourceEnvVarsTestBuildPipelineRun_RepoSourceRunAfterChainingTestBuildPipelineRun_RepoSourceManifestName-mflag for manifestNameTestBuildPipelineRun_RepoSourceNoPipelineResultTestBuildPipelineRun_RepoSourceRepoNilSkipsTaskBreaking Changes
None. The
Repofield is optional (omitempty). ExistinggitandpvcBuildJobs are unaffected.
Reviewer Notes
make manifestsandmake generateare no-ops in this project — both theCRD YAML and
zz_generated.deepcopy.goare maintained manually. The CRDYAML has been updated by hand to match the new type.
RepoInitImage = "python:3.12-slim"with runtimepip install repoworksin connected clusters. An air-gapped follow-up (configurable image field or
pre-baked image) is tracked separately.