feat(api): add spec.workspaceSize to BuildJob for configurable PVC size#30
Draft
ambient-code[bot] wants to merge 1 commit into
Draft
feat(api): add spec.workspaceSize to BuildJob for configurable PVC size#30ambient-code[bot] wants to merge 1 commit into
ambient-code[bot] wants to merge 1 commit into
Conversation
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" ```
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
Summary
Add
spec.workspaceSizetoBuildJobso users can configure the build workspace PVC size per job.Fixes #29
Problem
The build workspace PVC size was hardcoded to
10Giininternal/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.QuantitytoBuildJobSpec. The pipeline builder reads it and substitutes it into thevolumeClaimTemplate; when nil, it falls back to"10Gi". No changes to existingBuildJobresources are needed.Changes
api/v1alpha1/buildjob_types.goWorkspaceSize *resource.Quantityfieldapi/v1alpha1/zz_generated.deepcopy.gointernal/tekton/pipelinerun_builder.go"10Gi"with field valueconfig/crd/bases/builder.sdv.cloud.redhat.com_buildjobs.yamlinternal/tekton/pipelinerun_builder_test.goTesting
New regression tests:
TestBuildPipelineRun_WorkspaceSize_Custom—500Giis propagated to the PVCTestBuildPipelineRun_WorkspaceSize_DefaultWhenNil— nil falls back to10GiExample
Reviewer Notes
gofmtrun also re-aligned theannotationsmap inbuildOCIArtifactTask(whitespace only, no logic change).make manifeststarget prints a notice rather than running controller-gen). TheworkspaceSizefield usestype: string, matching the project's existing convention fortimeout.