Skip to content

feat(api): add spec.workspaceSize to BuildJob for configurable PVC size#30

Draft
ambient-code[bot] wants to merge 1 commit into
mainfrom
bugfix/issue-29-configurable-workspace-size
Draft

feat(api): add spec.workspaceSize to BuildJob for configurable PVC size#30
ambient-code[bot] wants to merge 1 commit into
mainfrom
bugfix/issue-29-configurable-workspace-size

Conversation

@ambient-code
Copy link
Copy Markdown

@ambient-code ambient-code Bot commented May 12, 2026

PR Description

Summary

Add spec.workspaceSize to BuildJob so users can configure the build workspace PVC size per job.

Fixes #29


Problem

The build workspace PVC size was hardcoded to 10Gi in internal/tekton/pipelinerun_builder.go. This is fine for MCU/Zephyr builds but far too small for AAOS/AOSP builds that need 500+ GB. There was no way to override it without patching the operator binary.

Solution

Added WorkspaceSize *resource.Quantity to BuildJobSpec. The pipeline builder reads it and substitutes it into the volumeClaimTemplate; when nil, it falls back to "10Gi". No changes to existing BuildJob resources are needed.

Changes

File Change
api/v1alpha1/buildjob_types.go New WorkspaceSize *resource.Quantity field
api/v1alpha1/zz_generated.deepcopy.go Deepcopy for new pointer field
internal/tekton/pipelinerun_builder.go Replace hardcoded "10Gi" with field value
config/crd/bases/builder.sdv.cloud.redhat.com_buildjobs.yaml CRD schema updated
internal/tekton/pipelinerun_builder_test.go Two new regression tests

Testing

ok  github.com/centos-automotive-suite/bob/api/v1alpha1       (all pass)
ok  github.com/centos-automotive-suite/bob/cmd/bob            (all pass)
ok  github.com/centos-automotive-suite/bob/internal/buildapi  (all pass)
ok  github.com/centos-automotive-suite/bob/internal/tekton    (35 tests, +2 new, all pass)

New regression tests:

  • TestBuildPipelineRun_WorkspaceSize_Custom500Gi is propagated to the PVC
  • TestBuildPipelineRun_WorkspaceSize_DefaultWhenNil — nil falls back to 10Gi

Example

spec:
  workspaceSize: 500Gi   # new field
  toolchain:
    image: registry.example.com/aaos-host-tools:android-14
  source:
    type: git
    git:
      url: https://github.com/example/aaos-manifest
  stages:
    - name: build
      command: "make"

Reviewer Notes

  • The gofmt run also re-aligned the annotations map in buildOCIArtifactTask (whitespace only, no logic change).
  • The CRD YAML is hand-maintained in this project (the make manifests target prints a notice rather than running controller-gen). The workspaceSize field uses type: string, matching the project's existing convention for timeout.

The build workspace PVC was hardcoded to 10Gi in
BuildPipelineRunWithConfig, making it impossible for users to run
AAOS/AOSP builds that require 500+ GB of workspace. This change adds
an optional WorkspaceSize *resource.Quantity field to BuildJobSpec
that is propagated to the volumeClaimTemplate; when nil the original
10Gi default is preserved, keeping all existing BuildJobs unchanged.

Fixes #29

## Summary

Add `spec.workspaceSize` to `BuildJob` so users can configure the build workspace PVC size per job.

## Problem

The build workspace PVC size was hardcoded to `10Gi` in `internal/tekton/pipelinerun_builder.go`. This is fine for MCU/Zephyr builds but far too small for AAOS/AOSP builds that need 500+ GB. There was no way to override it without patching the operator binary.

## Solution

Added `WorkspaceSize *resource.Quantity` to `BuildJobSpec`. The pipeline builder reads it and substitutes it into the `volumeClaimTemplate`; when nil, it falls back to `"10Gi"`. No changes to existing `BuildJob` resources are needed.

## Changes

| File | Change |
|------|--------|
| `api/v1alpha1/buildjob_types.go` | New `WorkspaceSize *resource.Quantity` field |
| `api/v1alpha1/zz_generated.deepcopy.go` | Deepcopy for new pointer field |
| `internal/tekton/pipelinerun_builder.go` | Replace hardcoded `"10Gi"` with field value |
| `config/crd/bases/builder.sdv.cloud.redhat.com_buildjobs.yaml` | CRD schema updated |
| `internal/tekton/pipelinerun_builder_test.go` | Two new regression tests |

## Testing

All 6 packages pass with -race. New regression tests:
- TestBuildPipelineRun_WorkspaceSize_Custom — 500Gi is propagated to the PVC
- TestBuildPipelineRun_WorkspaceSize_DefaultWhenNil — nil falls back to 10Gi

## Example

```yaml
spec:
  workspaceSize: 500Gi
  toolchain:
    image: registry.example.com/aaos-host-tools:android-14
  source:
    type: git
    git:
      url: https://github.com/example/aaos-manifest
  stages:
    - name: build
      command: "make"
```
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Make workspace PVC size configurable via spec.workspaceSize

0 participants