Skip to content

fix extra args#41

Merged
bennyz merged 1 commit into
centos-automotive-suite:mainfrom
bennyz:restore-extra-args
Jan 22, 2026
Merged

fix extra args#41
bennyz merged 1 commit into
centos-automotive-suite:mainfrom
bennyz:restore-extra-args

Conversation

@bennyz

@bennyz bennyz commented Jan 22, 2026

Copy link
Copy Markdown
Contributor

and some extra

Summary by CodeRabbit

  • New Features

    • Support for any AIB-supported disk image output formats (not limited to raw, qcow2, simg)
    • Support for tar.gz compressed archive handling
    • Ability to pass extra AIB arguments via CLI flag
  • Improvements

    • Format field is now optional in build-dev command
    • Enhanced artifact filename tracking throughout build pipeline

✏️ Tip: You can customize this high-level summary in your review settings.

and some extra

Signed-off-by: Benny Zlotnik <bzlotnik@redhat.com>
@coderabbitai

coderabbitai Bot commented Jan 22, 2026

Copy link
Copy Markdown
📝 Walkthrough

Walkthrough

This PR extends image build flexibility by introducing AIB extra arguments support, implementing artifact filename propagation through the build pipeline, adding tar.gz compression detection, removing strict format validation, and expanding artifact push media type handling.

Changes

Cohort / File(s) Summary
CRD and Type Definitions
api/v1alpha1/imagebuild_types.go, config/crd/bases/automotive.sdv.cloud.redhat.com_imagebuilds.yaml, bundle/manifests/automotive.sdv.cloud.redhat.com_imagebuilds.yaml
Removed enum constraints on ExportSpec.Format field, replacing strict validation (raw, qcow2, simg) with flexible string type allowing any AIB-supported format. Updated descriptions to reflect broader compatibility.
CLI Build Command
cmd/caib/main.go
Added aibExtraArgs flag across build, disk, and build-dev commands; integrated into BuildRequest payload. Introduced tar.gz compression detection via isTarInsideGzip helper. Removed required constraint on format flag in build-dev command.
Server API Logic
internal/buildapi/server.go
Removed strict ExportFormat validation, deferring format validation to AIB. Broadened push secret creation condition to trigger when either PushRepository or ExportOCI is set.
Pipeline Tasks and Results
internal/common/tasks/tasks.go, internal/common/tasks/scripts/build_image.sh
Added pipeline result for artifact-filename from build-image task results. Updated disk-image invocation to include AIB_EXTRA_ARGS alongside existing arguments.
Artifact Push Handling
internal/common/tasks/scripts/push_artifact.sh
Extended media type mapping to recognize *.tar.gz files with application/gzip content type.
Build Controller
internal/controller/imagebuild/controller.go
Removed compressionToExtension helper. Added extractArtifactFilename function to propagate pipeline artifact filenames. Updated createPushTaskRun signature to accept artifactFilename parameter; added validation and logging for artifact filename usage across push task creation paths.

Sequence Diagrams

sequenceDiagram
    actor User
    participant CLI as CLI (caib)
    participant Server as API Server
    participant Controller as Build Controller
    participant Pipeline as Tekton Pipeline
    participant Container as Build Container

    User->>CLI: caib build --aib-extra-args="..."
    CLI->>Server: CreateBuildRequest(AIBExtraArgs)
    Server->>Pipeline: Create PipelineRun
    Pipeline->>Container: Execute build-image<br/>(with AIB_EXTRA_ARGS)
    Container->>Pipeline: Return artifact-filename result
    Pipeline->>Controller: PipelineRun completed
    Controller->>Controller: extractArtifactFilename()
    Controller->>Pipeline: Create push TaskRun<br/>(with artifactFilename)
Loading
sequenceDiagram
    participant Controller as Build Controller
    participant PipelineRun as PipelineRun Results
    participant PushTask as Push TaskRun
    participant Registry as Container Registry

    Controller->>PipelineRun: Fetch artifact-filename result
    PipelineRun-->>Controller: artifact-filename value
    Controller->>Controller: Validate artifactFilename
    Controller->>PushTask: createPushTaskRun(imageBuild, artifactFilename)
    PushTask->>Registry: Push artifact using filename
    Registry-->>PushTask: Success
    PushTask-->>Controller: Task completed
Loading

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~25 minutes

Possibly related PRs

  • PR #32: Modifies controller push task creation logic and signatures, directly overlapping with artifactFilename parameter addition and call site updates in this PR.
  • PR #40: Manages ImageBuild ExportSpec.Format enum constraints that this PR relaxes; schema evolution is coordinated across both changes.
  • PR #37: Handles artifact serving and filename propagation at API/controller level, sharing overlapping changes to artifact handling functions and controller logic paths.

Poem

🐰 In the garden of builds so grand,
AIB_EXTRA_ARGS now grace the land,
Artifacts hop through pipelines bright,
tar.gz and formats—what a sight!
Flexible, flowing, validation release—
Build systems hop with newfound peace! 🌟

🚥 Pre-merge checks | ✅ 2 | ❌ 1
❌ Failed checks (1 warning)
Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 73.33% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (2 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title 'fix extra args' accurately summarizes the main change, which adds support for extra AIB arguments throughout the codebase via a new aibExtraArgs flag.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing touches
  • 📝 Generate docstrings

Comment @coderabbitai help to get the list of available commands and usage tips.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 0

Caution

Some comments are outside the diff and can’t be posted inline due to platform limitations.

⚠️ Outside diff range comments (1)
internal/buildapi/server.go (1)

864-873: Broadened push secret condition is correct, but error message could be clearer.

The logic correctly creates a push secret when either PushRepository or ExportOCI is specified. However, the error message on line 867 only mentions "push repository", which may confuse users when they specify ExportOCI without credentials.

Suggested improvement for error message clarity
 	// Create push secret if pushing to registry (PushRepository for bootc, ExportOCI for disk images)
 	if req.PushRepository != "" || req.ExportOCI != "" {
 		if req.RegistryCredentials == nil || !req.RegistryCredentials.Enabled {
-			return "", "", fmt.Errorf("registry credentials are required when push repository is specified")
+			return "", "", fmt.Errorf("registry credentials are required when pushing to registry (push repository or export OCI)")
 		}
🧹 Nitpick comments (1)
internal/controller/imagebuild/controller.go (1)

754-766: Consider adding early validation for empty artifact filename.

The current flow relies on createPushTaskRun to validate the empty filename, but adding an early check here would provide a more specific error message at the point of extraction failure.

♻️ Optional: Add early validation
 		artifactFilename := extractArtifactFilename(pipelineRun)
+		if artifactFilename == "" {
+			log.Error(nil, "Failed to extract artifact filename from PipelineRun results")
+			msg := "Build completed but artifact filename not found in results"
+			if statusErr := r.updateStatus(ctx, imageBuild, phaseFailed, msg); statusErr != nil {
+				return ctrl.Result{}, statusErr
+			}
+			return ctrl.Result{}, nil
+		}

 		// No push TaskRun yet, create one
 		if err := r.createPushTaskRun(ctx, imageBuild, artifactFilename); err != nil {

@bennyz bennyz merged commit e8fce51 into centos-automotive-suite:main Jan 22, 2026
4 checks passed
@bennyz bennyz deleted the restore-extra-args branch January 22, 2026 18:32
@coderabbitai coderabbitai Bot mentioned this pull request Feb 1, 2026
@coderabbitai coderabbitai Bot mentioned this pull request May 25, 2026
10 tasks
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.

1 participant