-
Notifications
You must be signed in to change notification settings - Fork 9
add Tekton Chains type hints and osbuild manifest attestation #197
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
9205005
964cfb3
1f9bf9f
df7d5a3
41725aa
5302530
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -32,3 +32,4 @@ pull-secret* | |
|
|
||
| catalog/automotive-dev-operator.yaml | ||
| bundle/ | ||
| _output/ | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -64,6 +64,18 @@ type ImageBuildSpec struct { | |
| // on completion so subsequent builds can reuse it. | ||
| // +optional | ||
| Workspace string `json:"workspace,omitempty"` | ||
|
|
||
| // SecureBuild enables supply chain security for this build. | ||
| // When true, pipeline tasks are resolved from the signed Tekton Bundle | ||
| // specified in TaskBundleRef instead of cluster-installed tasks. | ||
| // +optional | ||
| SecureBuild bool `json:"secureBuild,omitempty"` | ||
|
|
||
| // TaskBundleRef is the digest-pinned OCI reference to the Tekton Bundle | ||
| // used for this build. Set automatically by the Build API from the | ||
| // OperatorConfig at request time to prevent TOCTOU races. | ||
| // +optional | ||
| TaskBundleRef string `json:"taskBundleRef,omitempty"` | ||
| } | ||
|
Comment on lines
+68
to
79
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 🧩 Analysis chain🏁 Script executed: #!/bin/bash
set -euo pipefail
echo "== Check api type fields =="
rg -n --type go 'SecureBuild|TaskBundleRef' api/v1alpha1
echo "== Check generated deepcopy code =="
fd 'zz_generated.deepcopy.go' api/v1alpha1 --exec rg -n 'SecureBuild|TaskBundleRef' {}
echo "== Check CRD schemas include new fields =="
fd '.+\.ya?ml$' config/crd/bases --exec rg -n 'secureBuild|taskBundleRef' {}Repository: centos-automotive-suite/automotive-dev-operator Length of output: 1000 🏁 Script executed: #!/bin/bash
set -euo pipefail
echo "== Check .gitignore for generated files patterns =="
rg -n 'zz_generated\.deepcopy|config/crd/bases' .gitignore
echo "== Verify if zz_generated.deepcopy.go exists =="
find api/v1alpha1 -name 'zz_generated.deepcopy.go' -type f 2>/dev/null | head -5
echo "== Verify if config/crd/bases exists =="
find config/crd/bases -type f 2>/dev/null | head -5
echo "== Check if config/crd/bases directory exists =="
test -d config/crd/bases && echo "Directory exists" || echo "Directory does not exist"Repository: centos-automotive-suite/automotive-dev-operator Length of output: 142 🏁 Script executed: #!/bin/bash
set -euo pipefail
echo "== View .gitignore content =="
cat .gitignore
echo ""
echo "== Check git status for generated files =="
git ls-files api/v1alpha1/zz_generated.deepcopy.go 2>/dev/null || echo "File not tracked in git"
echo ""
echo "== List files in config/crd/bases if it exists =="
ls -la config/crd/bases/ 2>/dev/null || echo "Directory does not exist"
echo ""
echo "== Check if files exist in filesystem =="
test -f api/v1alpha1/zz_generated.deepcopy.go && echo "zz_generated.deepcopy.go EXISTS" || echo "zz_generated.deepcopy.go DOES NOT EXIST"Repository: centos-automotive-suite/automotive-dev-operator Length of output: 1691 🏁 Script executed: #!/bin/bash
set -euo pipefail
echo "== Check if SecureBuild/TaskBundleRef in zz_generated.deepcopy.go =="
rg -n 'SecureBuild|TaskBundleRef' api/v1alpha1/zz_generated.deepcopy.go 2>/dev/null || echo "Fields NOT found in deepcopy file"
echo ""
echo "== Check ImageBuild CRD for secureBuild/taskBundleRef =="
rg -n 'secureBuild|taskBundleRef' config/crd/bases/automotive.sdv.cloud.redhat.com_imagebuilds.yaml 2>/dev/null || echo "Fields NOT found in CRD"
echo ""
echo "== Show context around ImageBuildSpec in CRD =="
grep -A 200 'ImageBuildSpec' config/crd/bases/automotive.sdv.cloud.redhat.com_imagebuilds.yaml | head -100Repository: centos-automotive-suite/automotive-dev-operator Length of output: 5074 DeepCopy generation is missing the new fields—run The CRD includes 🤖 Prompt for AI Agents
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. these are strings There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
✏️ Learnings added
🧠 Learnings used |
||
|
|
||
| // FlashSpec defines configuration for flashing images to hardware via Jumpstarter | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -535,6 +535,14 @@ type OSBuildsConfig struct { | |
| // Certificates defines trusted certificate configuration for build tasks. | ||
| // +optional | ||
| Certificates *BuildCertificatesConfig `json:"certificates,omitempty"` | ||
|
|
||
| // TaskBundleRef is the OCI reference to a signed Tekton Bundle containing task definitions. | ||
| // When set, builds created with SecureBuild=true will resolve tasks from this bundle | ||
| // instead of the cluster-installed tasks. The bundle should be signed with cosign | ||
| // and contain the same tasks as the operator deploys. | ||
| // Example: "quay.io/rh-sdv-cloud/automotive-dev-tekton-tasks:v0.1.0@sha256:abc123..." | ||
| // +optional | ||
| TaskBundleRef string `json:"taskBundleRef,omitempty"` | ||
|
Comment on lines
+539
to
+545
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Require digest-pinned bundle refs for secure builds.
🤖 Prompt for AI Agents |
||
| } | ||
|
|
||
| // CertificateSourceRef references a Secret or ConfigMap that contains trusted CA certificates. | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,80 @@ | ||
| /* | ||
| Copyright 2025. | ||
|
|
||
| Licensed under the Apache License, Version 2.0 (the "License"); | ||
| you may not use this file except in compliance with the License. | ||
| You may obtain a copy of the License at | ||
|
|
||
| http://www.apache.org/licenses/LICENSE-2.0 | ||
|
|
||
| Unless required by applicable law or agreed to in writing, software | ||
| distributed under the License is distributed on an "AS IS" BASIS, | ||
| WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
| See the License for the specific language governing permissions and | ||
| limitations under the License. | ||
| */ | ||
|
|
||
| // Package main exports Tekton Task definitions as YAML files for Tekton Bundle packaging. | ||
| // Tasks are generated from the same Go code used by the operator, ensuring the bundle | ||
| // contains the exact same task definitions as cluster-installed ones. | ||
| package main | ||
|
|
||
| import ( | ||
| "flag" | ||
| "fmt" | ||
| "os" | ||
| "path/filepath" | ||
|
|
||
| tektonv1 "github.com/tektoncd/pipeline/pkg/apis/pipeline/v1" | ||
| "sigs.k8s.io/yaml" | ||
|
|
||
| "github.com/centos-automotive-suite/automotive-dev-operator/internal/common/tasks" | ||
| ) | ||
|
|
||
| func main() { | ||
| outputDir := flag.String("output-dir", "", "Directory to write task YAML files (writes to stdout if empty)") | ||
| flag.Parse() | ||
|
|
||
| // Use nil buildConfig for defaults — bundle tasks should not bake in | ||
| // cluster-specific settings like memory volumes or custom timeouts. | ||
| taskList := []*tektonv1.Task{ | ||
| tasks.GenerateBuildAutomotiveImageTask("", nil, ""), | ||
| tasks.GeneratePushArtifactRegistryTask("", nil), | ||
| tasks.GeneratePrepareBuilderTask("", nil), | ||
| tasks.GenerateFlashTask("", nil), | ||
| } | ||
| taskList = append(taskList, tasks.GenerateSealedTasks("")...) | ||
|
Comment on lines
+38
to
+46
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Bundle export diverges from the operator’s actual task specs. These tasks are exported with Based on learnings, 🤖 Prompt for AI Agents |
||
|
|
||
| if *outputDir != "" { | ||
| if err := os.MkdirAll(*outputDir, 0o755); err != nil { | ||
| fmt.Fprintf(os.Stderr, "error creating output directory: %v\n", err) | ||
| os.Exit(1) | ||
| } | ||
| } | ||
|
|
||
| for _, task := range taskList { | ||
| // Strip namespace and runtime metadata — these are cluster concerns, not bundle content. | ||
| task.Namespace = "" | ||
| task.ManagedFields = nil | ||
| task.ResourceVersion = "" | ||
| task.UID = "" | ||
| task.CreationTimestamp.Reset() | ||
|
|
||
| data, err := yaml.Marshal(task) | ||
| if err != nil { | ||
| fmt.Fprintf(os.Stderr, "error marshaling task %s: %v\n", task.Name, err) | ||
| os.Exit(1) | ||
| } | ||
|
|
||
| if *outputDir == "" { | ||
| fmt.Printf("---\n%s", data) | ||
| } else { | ||
| path := filepath.Join(*outputDir, task.Name+".yaml") | ||
| if err := os.WriteFile(path, data, 0o644); err != nil { | ||
| fmt.Fprintf(os.Stderr, "error writing %s: %v\n", path, err) | ||
| os.Exit(1) | ||
| } | ||
| fmt.Printf("wrote %s\n", path) | ||
| } | ||
| } | ||
| } | ||
Uh oh!
There was an error while loading. Please reload this page.