Skip to content

Conversation

@kairosci
Copy link

@kairosci kairosci commented Feb 7, 2026

Summary

This PR implements time-based automatic cleanup for Build objects by adding TTL (time-to-live) fields to both and , following the same pattern as Kubernetes Jobs' ttlSecondsAfterFinished.

Changes

API Changes

  • Added successfulBuildTTLSeconds and failedBuildTTLSeconds to BuildSpec
  • Added defaultSuccessfulBuildTTLSeconds and defaultFailedBuildTTLSeconds to BuildConfigSpec

Generated Code

  • Regenerated deepcopy functions
  • Regenerated swagger documentation
  • Regenerated OpenAPI schemas

Motivation

This addresses issue #2550. Currently, OpenShift administrators need to implement custom automation (e.g., cronjobs or external scripts) to prune old builds. While OpenShift provides successfulBuildsHistoryLimit and failedBuildsHistoryLimit, those are count-based, not time-based.

This PR extends both Build and BuildConfig objects to include time-based retention semantics, providing more predictable and automated cleanup.

Backward Compatibility

All new fields are optional (*int32 pointer types with omitempty JSON tags), ensuring full backward compatibility.

Next Steps

The actual TTL deletion logic will need to be implemented in a separate PR in the build controller repository.

Testing

  • Unit tests pass
  • Code generation succeeds
  • All fields have proper protobuf tags

Fixes #2550

This commit implements time-based automatic cleanup for Build objects
by adding TTL (time-to-live) fields to both BuildSpec and BuildConfigSpec,
following the same pattern as Kubernetes Jobs' ttlSecondsAfterFinished.

Changes:
- Add SuccessfulBuildTTLSeconds and FailedBuildTTLSeconds to BuildSpec
- Add DefaultSuccessfulBuildTTLSeconds and DefaultFailedBuildTTLSeconds to BuildConfigSpec
- Regenerate deepcopy, swagger, and OpenAPI code

This addresses issue openshift#2550: openshift#2550

The actual TTL deletion logic will be implemented in a separate PR
in the build controller repository.
@openshift-ci-robot
Copy link

Pipeline controller notification
This repo is configured to use the pipeline controller. Second-stage tests will be triggered either automatically or after lgtm label is added, depending on the repository configuration. The pipeline controller will automatically detect which contexts are required and will utilize /test Prow commands to trigger the second stage.

For optional jobs, comment /test ? to see a list of all defined jobs. To trigger manually all jobs from second stage use /pipeline required command.

This repository is configured in: LGTM mode

@openshift-ci openshift-ci bot added the size/M Denotes a PR that changes 30-99 lines, ignoring generated files. label Feb 7, 2026
@openshift-ci openshift-ci bot requested review from JoelSpeed and bparees February 7, 2026 21:54
@openshift-ci
Copy link
Contributor

openshift-ci bot commented Feb 7, 2026

[APPROVALNOTIFIER] This PR is NOT APPROVED

This pull-request has been approved by:
Once this PR has been reviewed and has the lgtm label, please assign deads2k for approval. For more information see the Code Review Process.

The full list of commands accepted by this bot can be found here.

Details Needs approval from an approver in each of these files:

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@coderabbitai
Copy link

coderabbitai bot commented Feb 7, 2026

📝 Walkthrough

Walkthrough

This change introduces time-based retention fields to the Build and BuildConfig APIs. Four new optional integer pointer fields are added: SuccessfulBuildTTLSeconds and FailedBuildTTLSeconds in BuildSpec, and DefaultSuccessfulBuildTTLSeconds and DefaultFailedBuildTTLSeconds in BuildConfigSpec. The fields follow Kubernetes Job TTL semantics, where nil indicates no automatic deletion. Supporting changes include deep copy logic in the generated deepcopy file and Swagger documentation updates to describe the new TTL behavior for build retention and cleanup.

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Title check ✅ Passed The title 'Add TTL fields to Build and BuildConfig APIs' directly and clearly summarizes the main change in the pull request.
Linked Issues check ✅ Passed All code changes in the PR fully implement the requirements from issue #2550: both BuildSpec and BuildConfigSpec have the four required TTL fields as optional *int32 types with proper protobuf and JSON tags.
Out of Scope Changes check ✅ Passed All changes are directly related to adding TTL fields to Build and BuildConfig APIs as specified in issue #2550; no out-of-scope modifications are present.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Description check ✅ Passed The PR description clearly explains the addition of TTL fields to Build and BuildConfig APIs, references the motivation (issue #2550), documents backward compatibility, and describes the generated code changes.

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

✨ Finishing touches
  • 📝 Generate docstrings
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

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

@openshift-ci
Copy link
Contributor

openshift-ci bot commented Feb 7, 2026

Hello @kairosci! Some important instructions when contributing to openshift/api:
API design plays an important part in the user experience of OpenShift and as such API PRs are subject to a high level of scrutiny to ensure they follow our best practices. If you haven't already done so, please review the OpenShift API Conventions and ensure that your proposed changes are compliant. Following these conventions will help expedite the api review process for your PR.

@qodo-code-review
Copy link

Review Summary by Qodo

Add TTL fields to Build and BuildConfig APIs

✨ Enhancement

Grey Divider

Walkthroughs

Description
• Add TTL fields to Build and BuildConfig APIs for time-based cleanup
• Implement successfulBuildTTLSeconds and failedBuildTTLSeconds in BuildSpec
• Implement defaultSuccessfulBuildTTLSeconds and defaultFailedBuildTTLSeconds in BuildConfigSpec
• Regenerate deepcopy, swagger, and OpenAPI code for new fields
Diagram
flowchart LR
  BuildSpec["BuildSpec"]
  BuildConfigSpec["BuildConfigSpec"]
  TTLFields["TTL Fields<br/>successfulBuildTTLSeconds<br/>failedBuildTTLSeconds"]
  DefaultTTLFields["Default TTL Fields<br/>defaultSuccessfulBuildTTLSeconds<br/>defaultFailedBuildTTLSeconds"]
  DeepCopy["DeepCopy Functions"]
  Swagger["Swagger Documentation"]
  OpenAPI["OpenAPI Schema"]
  
  BuildSpec -- "adds" --> TTLFields
  BuildConfigSpec -- "adds" --> DefaultTTLFields
  TTLFields -- "regenerates" --> DeepCopy
  DefaultTTLFields -- "regenerates" --> DeepCopy
  DeepCopy -- "updates" --> Swagger
  DeepCopy -- "updates" --> OpenAPI
Loading

Grey Divider

File Changes

1. build/v1/types.go ✨ Enhancement +32/-0

Add TTL fields to Build and BuildConfig types

• Add SuccessfulBuildTTLSeconds and FailedBuildTTLSeconds pointer fields to BuildSpec struct
• Add DefaultSuccessfulBuildTTLSeconds and DefaultFailedBuildTTLSeconds pointer fields to
 BuildConfigSpec struct
• Include comprehensive comments explaining TTL semantics and Kubernetes Job alignment
• All fields are optional with omitempty JSON tags and proper protobuf tags

build/v1/types.go


2. build/v1/zz_generated.deepcopy.go Code generation +20/-0

Regenerate deepcopy functions for TTL fields

• Add deepcopy logic for SuccessfulBuildTTLSeconds and FailedBuildTTLSeconds in
 BuildSpec.DeepCopyInto()
• Add deepcopy logic for DefaultSuccessfulBuildTTLSeconds and DefaultFailedBuildTTLSeconds in
 BuildConfigSpec.DeepCopyInto()
• Handle nil pointer checks for all new int32 pointer fields

build/v1/zz_generated.deepcopy.go


3. build/v1/zz_generated.swagger_doc_generated.go 📝 Documentation +11/-7

Regenerate swagger documentation for TTL fields

• Add swagger documentation entries for successfulBuildTTLSeconds and failedBuildTTLSeconds in
 BuildSpec
• Add swagger documentation entries for defaultSuccessfulBuildTTLSeconds and
 defaultFailedBuildTTLSeconds in BuildConfigSpec
• Update map key alignment for consistent formatting

build/v1/zz_generated.swagger_doc_generated.go


View more (1)
4. openapi/generated_openapi/zz_generated.openapi.go Code generation +28/-0

Regenerate OpenAPI schema for TTL fields

• Add OpenAPI schema definitions for successfulBuildTTLSeconds and failedBuildTTLSeconds in
 BuildSpec
• Add OpenAPI schema definitions for defaultSuccessfulBuildTTLSeconds and
 defaultFailedBuildTTLSeconds in BuildConfigSpec
• Define all new fields as integer type with int32 format

openapi/generated_openapi/zz_generated.openapi.go


Grey Divider

Qodo Logo

@openshift-ci openshift-ci bot added the needs-ok-to-test Indicates a PR that requires an org member to verify it is safe to test. label Feb 7, 2026
@openshift-ci
Copy link
Contributor

openshift-ci bot commented Feb 7, 2026

Hi @kairosci. Thanks for your PR.

I'm waiting for a openshift member to verify that this patch is reasonable to test. If it is, they should reply with /ok-to-test on its own line. Until that is done, I will not automatically test new commits in this PR, but the usual testing commands by org members will still work. Regular contributors should join the org to skip this step.

Once the patch is verified, the new status will be reflected by the ok-to-test label.

I understand the commands that are listed here.

Details

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes-sigs/prow repository.

@qodo-code-review
Copy link

Code Review by Qodo

🐞 Bugs (0) 📘 Rule violations (3) 📎 Requirement gaps (1)

Grey Divider


Action required

1. generated.proto missing TTL fields 📘 Rule violation ✓ Correctness
Description
BuildSpec/BuildConfigSpec gained new TTL fields with protobuf tags, but the protobuf schema
  (generated.proto) does not include them.
• This means protobuf clients/code that rely on generated.proto/generated.pb.go will not see or
  serialize the new fields, causing API/schema drift.
• This indicates generated artifacts were not fully regenerated/synchronized prior to commit.
Code

build/v1/types.go[R46-58]

+	// successfulBuildTTLSeconds defines how long (in seconds) a successful build
+	// is retained after completion before being automatically deleted.
+	// If not set, the build will not be automatically deleted.
+	// This mirrors the semantics of Kubernetes Job's ttlSecondsAfterFinished.
+	// +optional
+	SuccessfulBuildTTLSeconds *int32 `json:"successfulBuildTTLSeconds,omitempty" protobuf:"varint,3,opt,name=successfulBuildTTLSeconds"`
+
+	// failedBuildTTLSeconds defines how long (in seconds) a failed or errored build
+	// is retained after completion before being automatically deleted.
+	// If not set, the build will not be automatically deleted.
+	// This mirrors the semantics of Kubernetes Job's ttlSecondsAfterFinished.
+	// +optional
+	FailedBuildTTLSeconds *int32 `json:"failedBuildTTLSeconds,omitempty" protobuf:"varint,4,opt,name=failedBuildTTLSeconds"`
Evidence
Compliance requires generated outputs to be fully synchronized. The PR adds TTL fields with protobuf
tags in build/v1/types.go, but the protobuf schema in build/v1/generated.proto still shows
BuildSpec only containing fields 1-2 and BuildConfigSpec only containing fields 1-5, with no TTL
fields present.

AGENTS.md
build/v1/types.go[46-58]
build/v1/generated.proto[136-161]
build/v1/generated.proto[455-464]

Agent prompt
The issue below was found during a code review. Follow the provided context and guidance below and implement a solution

## Issue description
The new TTL API fields were added to `BuildSpec`/`BuildConfigSpec` with protobuf tags, but the protobuf-generated schema/code was not updated, leaving `generated.proto` (and likely `generated.pb.go`) out of sync.

## Issue Context
This repository commits generated artifacts. When Go types change (especially with protobuf tags), the corresponding protobuf outputs must be regenerated and committed so clients and tooling remain consistent.

## Fix Focus Areas
- build/v1/types.go[46-58]
- build/v1/types.go[1012-1028]
- build/v1/generated.proto[136-161]
- build/v1/generated.proto[455-464]

ⓘ Copy this prompt and use it to remediate the issue with your preferred AI generation tools


2. TTL fields lack FeatureGate 📘 Rule violation ⛯ Reliability
Description
• New fields were added to stable build/v1 APIs without a +openshift:enable:FeatureGate=...
  marker.
• Without feature-gating, clusters/profiles cannot control rollout of this stable API change,
  violating the repository’s stability/compatibility policy for new v1 fields.
• No corresponding FeatureGate registration for a Build TTL feature exists in features/features.go
  using the required builder pattern.
Code

build/v1/types.go[R46-58]

+	// successfulBuildTTLSeconds defines how long (in seconds) a successful build
+	// is retained after completion before being automatically deleted.
+	// If not set, the build will not be automatically deleted.
+	// This mirrors the semantics of Kubernetes Job's ttlSecondsAfterFinished.
+	// +optional
+	SuccessfulBuildTTLSeconds *int32 `json:"successfulBuildTTLSeconds,omitempty" protobuf:"varint,3,opt,name=successfulBuildTTLSeconds"`
+
+	// failedBuildTTLSeconds defines how long (in seconds) a failed or errored build
+	// is retained after completion before being automatically deleted.
+	// If not set, the build will not be automatically deleted.
+	// This mirrors the semantics of Kubernetes Job's ttlSecondsAfterFinished.
+	// +optional
+	FailedBuildTTLSeconds *int32 `json:"failedBuildTTLSeconds,omitempty" protobuf:"varint,4,opt,name=failedBuildTTLSeconds"`
Evidence
Compliance requires new fields on stable APIs to be feature-gated and the FeatureGate to be
registered with the repository builder pattern. The new TTL fields are added to build/v1/types.go
with no +openshift:enable:FeatureGate=... marker, and features/features.go demonstrates the
required registration pattern (e.g., BuildCSIVolumes) but contains no Build TTL gate.

AGENTS.md
AGENTS.md
build/v1/types.go[46-58]
features/features.go[79-86]

Agent prompt
The issue below was found during a code review. Follow the provided context and guidance below and implement a solution

## Issue description
The new TTL fields were added to stable `build/v1` APIs without FeatureGate markers, and there is no registered FeatureGate for this capability in `features/features.go`.

## Issue Context
Repository policy requires stable API field additions to be gated via `+openshift:enable:FeatureGate=...`, and any new FeatureGate must be registered using the builder pattern with required metadata.

## Fix Focus Areas
- build/v1/types.go[46-58]
- build/v1/types.go[1012-1028]
- features/features.go[36-90]

ⓘ Copy this prompt and use it to remediate the issue with your preferred AI generation tools


3. No TTL integration validation tests 📘 Rule violation ⛯ Reliability
Description
• The PR changes the build/v1 API schema but does not add integration validation tests under the
  repository’s /<group>/<version>/tests/<crd-name>/ structure.
• Without these tests, schema expectations for the new TTL fields (presence, optionality, gating
  expectations) are not enforced and regressions are more likely.
Code

build/v1/types.go[R1012-1028]

+	// defaultSuccessfulBuildTTLSeconds sets the default retention time (in seconds)
+	// for successful builds created from this BuildConfig.
+	// Builds created from this BuildConfig will inherit this value unless overridden
+	// in the Build's own successfulBuildTTLSeconds field.
+	// If not set, builds will not have an automatic TTL set.
+	// This mirrors the semantics of Kubernetes Job's ttlSecondsAfterFinished.
+	// +optional
+	DefaultSuccessfulBuildTTLSeconds *int32 `json:"defaultSuccessfulBuildTTLSeconds,omitempty" protobuf:"varint,6,opt,name=defaultSuccessfulBuildTTLSeconds"`
+
+	// defaultFailedBuildTTLSeconds sets the default retention time (in seconds)
+	// for failed or errored builds created from this BuildConfig.
+	// Builds created from this BuildConfig will inherit this value unless overridden
+	// in the Build's own failedBuildTTLSeconds field.
+	// If not set, builds will not have an automatic TTL set.
+	// This mirrors the semantics of Kubernetes Job's ttlSecondsAfterFinished.
+	// +optional
+	DefaultFailedBuildTTLSeconds *int32 `json:"defaultFailedBuildTTLSeconds,omitempty" protobuf:"varint,7,opt,name=defaultFailedBuildTTLSeconds"`
Evidence
The compliance checklist requires API additions/changes to include integration validation tests
under the standard tests directory structure. The PR introduces new API fields in
build/v1/types.go, and the repository contains examples of the required test format under
operator/v1/tests/..., but no analogous tests are added for the build/v1 API change.

AGENTS.md
build/v1/types.go[1012-1028]
operator/v1/tests/networks.operator.openshift.io/AAA_ungated.yaml[1-16]

Agent prompt
The issue below was found during a code review. Follow the provided context and guidance below and implement a solution

## Issue description
API schema was extended with TTL fields but no integration validation tests were added under the expected `/&lt;group&gt;/&lt;version&gt;/tests/&lt;crd-name&gt;/` structure.

## Issue Context
The repository uses YAML-based integration schema tests (see `operator/v1/tests/...`). Similar tests should be added/updated to ensure the new TTL fields are validated in generated schemas and remain stable over time.

## Fix Focus Areas
- build/v1/types.go[46-58]
- build/v1/types.go[1012-1028]
- operator/v1/tests/networks.operator.openshift.io/AAA_ungated.yaml[1-20]

ⓘ Copy this prompt and use it to remediate the issue with your preferred AI generation tools



Remediation recommended

4. TTL behavior not implemented 📎 Requirement gap ⛯ Reliability
Description
• The checklist requires default TTL values from BuildConfigSpec to propagate to newly created
  Build objects, and for a controller to delete finished Builds after the TTL elapses.
• This PR adds only API fields and generated schema/docs, and the PR description explicitly states
  the actual TTL deletion logic is deferred to a separate PR.
• As-is, the feature is incomplete relative to the required propagation and controller behavior.
Code

build/v1/types.go[R1012-1028]

+	// defaultSuccessfulBuildTTLSeconds sets the default retention time (in seconds)
+	// for successful builds created from this BuildConfig.
+	// Builds created from this BuildConfig will inherit this value unless overridden
+	// in the Build's own successfulBuildTTLSeconds field.
+	// If not set, builds will not have an automatic TTL set.
+	// This mirrors the semantics of Kubernetes Job's ttlSecondsAfterFinished.
+	// +optional
+	DefaultSuccessfulBuildTTLSeconds *int32 `json:"defaultSuccessfulBuildTTLSeconds,omitempty" protobuf:"varint,6,opt,name=defaultSuccessfulBuildTTLSeconds"`
+
+	// defaultFailedBuildTTLSeconds sets the default retention time (in seconds)
+	// for failed or errored builds created from this BuildConfig.
+	// Builds created from this BuildConfig will inherit this value unless overridden
+	// in the Build's own failedBuildTTLSeconds field.
+	// If not set, builds will not have an automatic TTL set.
+	// This mirrors the semantics of Kubernetes Job's ttlSecondsAfterFinished.
+	// +optional
+	DefaultFailedBuildTTLSeconds *int32 `json:"defaultFailedBuildTTLSeconds,omitempty" protobuf:"varint,7,opt,name=defaultFailedBuildTTLSeconds"`
Evidence
Compliance IDs 8 and 9 require runtime behavior (propagation and TTL-based deletion). The PR
description states deletion logic is not included here, and within this repository the changes are
limited to API/type additions without accompanying behavioral implementation.

BuildConfigSpec includes default TTL fields that propagate to new Builds
Build controller automatically deletes finished Builds based on TTL from completionTimestamp
build/v1/types.go[1012-1028]

Agent prompt
The issue below was found during a code review. Follow the provided context and guidance below and implement a solution

## Issue description
The compliance checklist requires TTL default propagation from `BuildConfigSpec` into new `Build`s and controller-driven deletion after TTL elapses. This PR adds fields but does not include the runtime behavior.

## Issue Context
The PR description notes TTL deletion logic is planned for a separate controller PR. Ensure the overall feature includes both (a) default propagation at Build creation time and (b) TTL-based deletion using `completionTimestamp`.

## Fix Focus Areas
- build/v1/types.go[46-58]
- build/v1/types.go[1012-1028]

ⓘ Copy this prompt and use it to remediate the issue with your preferred AI generation tools


Grey Divider

ⓘ The new review experience is currently in Beta. Learn more

Grey Divider

Qodo Logo

Comment on lines +46 to +58
// successfulBuildTTLSeconds defines how long (in seconds) a successful build
// is retained after completion before being automatically deleted.
// If not set, the build will not be automatically deleted.
// This mirrors the semantics of Kubernetes Job's ttlSecondsAfterFinished.
// +optional
SuccessfulBuildTTLSeconds *int32 `json:"successfulBuildTTLSeconds,omitempty" protobuf:"varint,3,opt,name=successfulBuildTTLSeconds"`

// failedBuildTTLSeconds defines how long (in seconds) a failed or errored build
// is retained after completion before being automatically deleted.
// If not set, the build will not be automatically deleted.
// This mirrors the semantics of Kubernetes Job's ttlSecondsAfterFinished.
// +optional
FailedBuildTTLSeconds *int32 `json:"failedBuildTTLSeconds,omitempty" protobuf:"varint,4,opt,name=failedBuildTTLSeconds"`

Choose a reason for hiding this comment

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

Action required

1. generated.proto missing ttl fields 📘 Rule violation ✓ Correctness

BuildSpec/BuildConfigSpec gained new TTL fields with protobuf tags, but the protobuf schema
  (generated.proto) does not include them.
• This means protobuf clients/code that rely on generated.proto/generated.pb.go will not see or
  serialize the new fields, causing API/schema drift.
• This indicates generated artifacts were not fully regenerated/synchronized prior to commit.
Agent Prompt
## Issue description
The new TTL API fields were added to `BuildSpec`/`BuildConfigSpec` with protobuf tags, but the protobuf-generated schema/code was not updated, leaving `generated.proto` (and likely `generated.pb.go`) out of sync.

## Issue Context
This repository commits generated artifacts. When Go types change (especially with protobuf tags), the corresponding protobuf outputs must be regenerated and committed so clients and tooling remain consistent.

## Fix Focus Areas
- build/v1/types.go[46-58]
- build/v1/types.go[1012-1028]
- build/v1/generated.proto[136-161]
- build/v1/generated.proto[455-464]

ⓘ Copy this prompt and use it to remediate the issue with your preferred AI generation tools

Comment on lines +46 to +58
// successfulBuildTTLSeconds defines how long (in seconds) a successful build
// is retained after completion before being automatically deleted.
// If not set, the build will not be automatically deleted.
// This mirrors the semantics of Kubernetes Job's ttlSecondsAfterFinished.
// +optional
SuccessfulBuildTTLSeconds *int32 `json:"successfulBuildTTLSeconds,omitempty" protobuf:"varint,3,opt,name=successfulBuildTTLSeconds"`

// failedBuildTTLSeconds defines how long (in seconds) a failed or errored build
// is retained after completion before being automatically deleted.
// If not set, the build will not be automatically deleted.
// This mirrors the semantics of Kubernetes Job's ttlSecondsAfterFinished.
// +optional
FailedBuildTTLSeconds *int32 `json:"failedBuildTTLSeconds,omitempty" protobuf:"varint,4,opt,name=failedBuildTTLSeconds"`

Choose a reason for hiding this comment

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

Action required

2. Ttl fields lack featuregate 📘 Rule violation ⛯ Reliability

• New fields were added to stable build/v1 APIs without a +openshift:enable:FeatureGate=...
  marker.
• Without feature-gating, clusters/profiles cannot control rollout of this stable API change,
  violating the repository’s stability/compatibility policy for new v1 fields.
• No corresponding FeatureGate registration for a Build TTL feature exists in features/features.go
  using the required builder pattern.
Agent Prompt
## Issue description
The new TTL fields were added to stable `build/v1` APIs without FeatureGate markers, and there is no registered FeatureGate for this capability in `features/features.go`.

## Issue Context
Repository policy requires stable API field additions to be gated via `+openshift:enable:FeatureGate=...`, and any new FeatureGate must be registered using the builder pattern with required metadata.

## Fix Focus Areas
- build/v1/types.go[46-58]
- build/v1/types.go[1012-1028]
- features/features.go[36-90]

ⓘ Copy this prompt and use it to remediate the issue with your preferred AI generation tools

Comment on lines +1012 to +1028
// defaultSuccessfulBuildTTLSeconds sets the default retention time (in seconds)
// for successful builds created from this BuildConfig.
// Builds created from this BuildConfig will inherit this value unless overridden
// in the Build's own successfulBuildTTLSeconds field.
// If not set, builds will not have an automatic TTL set.
// This mirrors the semantics of Kubernetes Job's ttlSecondsAfterFinished.
// +optional
DefaultSuccessfulBuildTTLSeconds *int32 `json:"defaultSuccessfulBuildTTLSeconds,omitempty" protobuf:"varint,6,opt,name=defaultSuccessfulBuildTTLSeconds"`

// defaultFailedBuildTTLSeconds sets the default retention time (in seconds)
// for failed or errored builds created from this BuildConfig.
// Builds created from this BuildConfig will inherit this value unless overridden
// in the Build's own failedBuildTTLSeconds field.
// If not set, builds will not have an automatic TTL set.
// This mirrors the semantics of Kubernetes Job's ttlSecondsAfterFinished.
// +optional
DefaultFailedBuildTTLSeconds *int32 `json:"defaultFailedBuildTTLSeconds,omitempty" protobuf:"varint,7,opt,name=defaultFailedBuildTTLSeconds"`

Choose a reason for hiding this comment

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

Action required

3. No ttl integration validation tests 📘 Rule violation ⛯ Reliability

• The PR changes the build/v1 API schema but does not add integration validation tests under the
  repository’s /<group>/<version>/tests/<crd-name>/ structure.
• Without these tests, schema expectations for the new TTL fields (presence, optionality, gating
  expectations) are not enforced and regressions are more likely.
Agent Prompt
## Issue description
API schema was extended with TTL fields but no integration validation tests were added under the expected `/<group>/<version>/tests/<crd-name>/` structure.

## Issue Context
The repository uses YAML-based integration schema tests (see `operator/v1/tests/...`). Similar tests should be added/updated to ensure the new TTL fields are validated in generated schemas and remain stable over time.

## Fix Focus Areas
- build/v1/types.go[46-58]
- build/v1/types.go[1012-1028]
- operator/v1/tests/networks.operator.openshift.io/AAA_ungated.yaml[1-20]

ⓘ Copy this prompt and use it to remediate the issue with your preferred AI generation tools

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

needs-ok-to-test Indicates a PR that requires an org member to verify it is safe to test. size/M Denotes a PR that changes 30-99 lines, ignoring generated files.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Proposal: Add TTL fields to Build and BuildConfig (automatic cleanup similar to Kubernetes Jobs)

2 participants