Skip to content

Add repo source type for AOSP/AAOS manifest-based builds #28

@vtz

Description

@vtz

Summary

bob currently supports two source types: git (single-repo clone) and pvc. AOSP-based builds (AAOS, Cuttlefish targets) fetch source via Google's repo tool, which syncs hundreds of git repos from a manifest URL. We need a repo source type so the operator can manage this natively.

Context

AAOS builds use repo init -u <manifest-url> -b <branch> && repo sync -j16 to fetch ~100+ GB of source. Today this can be modeled as a build stage, but that approach:

  • Re-downloads everything on each build (no mirror reuse)
  • Doesn't let the operator manage a shared local mirror across builds
  • Misses validation (manifest URL, branch existence)

What needs to change

1. CRD: add repo source type

In api/v1alpha1/buildjob_types.go:

  • Add SourceTypeRepo SourceType = "repo" to the const block (currently only git and pvc)
  • Add enum value to the SourceSpec.Type kubebuilder validation: Enum=git;pvc;repo
  • Add a RepoSource struct:
type RepoSource struct {
    ManifestURL  string `json:"manifestUrl"`
    Branch       string `json:"branch,omitempty"`
    ManifestName string `json:"manifestName,omitempty"`
    MirrorRef    string `json:"mirrorRef,omitempty"`    // PVC name for local mirror
    SyncJobs     int    `json:"syncJobs,omitempty"`     // parallelism for repo sync
}
  • Add Repo *RepoSource field to SourceSpec

2. Pipeline builder: generate repo-sync task

In internal/tekton/pipelinerun_builder.go:

  • When source.type == "repo", generate a clone task that runs repo init + repo sync instead of git clone
  • If mirrorRef is set, mount the mirror PVC read-only and pass --reference=<mirror-path> to repo init
  • Inject BOB_MANIFEST_URL and BOB_MANIFEST_BRANCH as env vars

3. Tests

  • Unit tests in pipelinerun_builder_test.go for repo source task generation
  • Validate mirror mount is present when mirrorRef is set

4. CRD regeneration

Run make manifests to regenerate the CRD YAML with the new fields.

Example BuildJob using repo source

apiVersion: builder.sdv.cloud.redhat.com/v1alpha1
kind: BuildJob
metadata:
  name: aaos-cuttlefish
spec:
  toolchain:
    image: registry.example.com/aaos-host-tools:android-14
  source:
    type: repo
    repo:
      manifestUrl: https://android.googlesource.com/platform/manifest
      branch: android-14.0.0_r50
      mirrorRef: aosp-mirror
      syncJobs: 16
  target:
    board: cf_x86_64_auto
    platform: aaos
    architecture: x86_64
    variant: userdebug
  stages:
    - name: build
      command: |
        source build/envsetup.sh
        lunch aosp_${BOB_BOARD}-${BOB_VARIANT}
        m -j$(nproc)

Files to change

  • api/v1alpha1/buildjob_types.go — new type + enum value
  • api/v1alpha1/zz_generated.deepcopy.go — regenerated
  • internal/tekton/pipelinerun_builder.go — repo-sync task generation
  • internal/tekton/pipelinerun_builder_test.go — new tests
  • config/crd/bases/builder.sdv.cloud.redhat.com_buildjobs.yaml — regenerated

/ambient

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions