Matt Rutkowski, IBM
CycloneDX 1.5 Conceptual Formulation
Mapping Tekton-based CI/CD Pipelines, Tasks, Resources and Triggers
Goals
2
© 2023 IBM Corporation
3
Tekton Background
Tekton�CI/CD Pipelines for Kubernetes
Kubernetes
Pipeline
Task
step
I
O
Task
step
step
I
O
Task
step
O
I
Task
step
step
O
I
Pipeline
Resource
Pipeline
Resource
Pipeline
Resource
Task
step
I
O
PipelineRun
4
Tekton resources – How it Works!
5
Pipeline
PipelineRun
(parameters)
TaskRun
TaskRun
TaskRun
TaskRun
(parameters)
Pipelines declare PipelineResources and a Directed Acyclic Graph (DAG) of conditional Tasks comprised of sequential steps
PipelineResource
PipelineResource
PipelineResource
PipelineRuns run Pipelines by binding PipelineResource instances and running TaskRun instances
Binds
Task
step
I
O
Task
step
step
I
O
Task
step
O
I
Task
step
step
O
I
Pipeline
Resource
Pipeline
Resource
Pipeline
Resource
Task
step
I
O
Runs
Runs
Creates
Creates
Workspace
(dedicated)
Workspace
(shareable)
Trigger
Event
Sources
Event
”Jobs” (create/run instances)
Tekton Pipeline Example - Generalized Microservice Build Pipeline
6
e.g., NodeJS, Python, Java Containers
finalize-runtime-with-function
clone-runtime-repo-to-workspace
build-microservice
Pipeline
clone-app-repo-to-workspace
<language-specific-tasks>
Task GitHub
Configured Via parameters
task-build-archive
Condition
Task runtime env.
Configured Via parameters
OCI Container
Task build params
Configured via params.
OCI Container
Artifactory
Base Runtime
images / versions
Microservice
Application or Function
Task artifact and catalog repo. Service
Configured via parameters
Task that can dynamically
“switch” between different
task language “branches”
Git Trigger
Even Single-Language Pipelines are not sequences - Java Pipeline
7
Tasks customized for Java packages and Maven / Gradle tooling
APP_JAVA_VERSION
clone-java-app-source
Task
clone-app-repo-to-workspace
Task
clone-runtime-repo-to-workspace
clone-java-runtime-source
Task
task-install-npm-packages
install-java-packages
Task
task-set-env-vars
finalize-runtime-with-function
DOCKERFILE
Condition
is-java-runtime
detect-runtimes
Task
create-jar-with-maven
create-jar-with-maven
Task
build-runtime-with-gradle
build-runtime-with-gradle
MAVEN_BUILD_OUTPUT_PATH
BUILD_CONFIG_PATH
Task
build-shared-class-cache
build-shared-class-cache
shared-workspace
Workspace
PersistentVolumeClaim
OW_RUNTIME_DEBUG
OW_RUNTIME_PLATFORM
OW_ACTION_NAME
OW_ACTION_CODE
OW_ACTION_MAIN
OW_ACTION_BINARY
OW_HTTP_METHODS
OW_ACTION_RAW
Pipeline
Polyglot CI/CD pipeline workflows easily become a directed graph
8
clone-nodejs-runtime-source
Task
install-npm-packages
Task
build-archive-node
Task
clone-nodejs-app-source
Task
build--app-image-node
Task
build-app-image-java
Task
clone-java-app-source
Task
clone-java-runtime-source
Task
create-jar-with-maven
Task
build-runtime-with-gradle
Task
build-shared-class-cache
Task
finalize-image-with-function
Task
runtime-git
Pipeline
Resource
git
app-image
Pipeline
Resource
image
build-polyglot-app
Pipeline
clone-java-app-source
Task
clone-app-repos-to-workspace
Task
dependency-git
Pipeline
Resource
git
clone-app-dependent-repos-to-workspace
Task
has-nodej
clone-XXX-language
Task
all-languages-built
has-java
Pipeline/Task Runtime Environment - Capturing the Tekton Stack
9
Cluster
Cluster
tekton-pipeline
Observes
spire
tekton-chains
Compute Infrastructure (Hardware, Bare Metal, Virtual Machines, etc.)
Includes Tekton “Chains” & OpenSSF Frsca Spire components that would need to be captured for SLSA3 BOMs
Groups/Users�(Identities)
(Pods)
© 2023 IBM Corporation
10
v1.5 Formulation Proposal
Proposal: Adopt Patterns for Referential Resource Types in Formula
11
Goals
Proposal: `workflow` captures a graph of `tasks` using workflow-specific components/services
12
Workflow is a specialized Task that serves as the entry point for all coordinated tasks
Parallels existing CycloneDX component compositions (i.e., `metadata.component` == `formula.workflow`)
[formulas]
[formulas]
formula
workflow: task
// the graph of tasks
dependency
dependency
dependency: object
dependency
dependency
task: object
“workflow” represents the “root” or “orchestration” task (singular).
Note: the term “workflow” is generic and applies to not only CI/CD, but also any other process we may want to capture in xBOMs in the future.
[bom] (root)
Note: the “tasks” / “taskDependencies” design mirrors existing CycloneDX “component” / “service” arrays (listings) and dependency declarations
Note: we SHOULD constrain the workflow “taskDependencies” schema to only permit “task” type as valid “refType” (i.e., task-only graph composition)
Note: For “array” types, by default, JSON Schema behaves as if the `additionalItems` parameter is set to `true` (link).
TODO: Adjust existing CDX schema
Complete list of transient “components” and “services” (concrete, reusable) resources that host, run, execute or used by workflows or tasks including source code, inputs, outputs and tools.
Effectively anything that partivpates in the workflow
Note: “tasks” are NOT required (may be empty) since a ”workflow” is a specialized task, it can represent a simple, single-task CI/CD/build stage.
v1.5: Proposal: New `component` -> `type` enum values
[formulas]
[formulas]
formula
Note: “component” should support new “type” enum. values.
Proposed minimum adds:
Note: workflows are specialized, orchestration “task” types and all “tasks” have a “bom-ref” so that they can be defined once and reused.
Workflows and tasks will use or interact with component types that are familiar to Cloud Native and CI/CD and Cloud Native domain concepts
Note: (TBD): “externalReference” MAY need to mirror some of these “type” enum. values
14
event
task
component
component
step
Proposal: Task as the granular, reusable modeling unit for workflow
trigger
[output]:
[output]:
output:
[output]:
[output]:
input:
Note: The task’s “types” enum indicates what functions are being performed. Current values indicate CI/CD terms:
"enum": [ "lint", "scan",
"merge", "build", "test", "deliver", "deploy", "release", "clean", "other” ]
component
component
workspaces
component
component
runtimeTopology
Note: inherited fields from “resourceInstance” object
I
O
15
event
// uuid from source domain
// e.g., ”encoding": ["base64"]
// ”contentType": [”cloud-event"
task
Proposal: Event Model: `event`-`trigger`-`task`
trigger
Multiple events can map to same trigger, multiple triggers can map to same task
Event
Sources
Note: “timestamp” indicates time the event was received by the workflow runtime.
The “raw” event data itself likely has its “generated” timestamp which SHOULD NOT be created or tampered with by the receiver.
Note: The trigger’s “type” enum. with values:
\�- “manual”, ”api", ”webhook", ”cron", "other”
Note: event “timestamp”, trigger “timeActivated” and task “startTime” and “endtime” values should correlate and represent a time sequence
condition
16
Proposal: `inputType` schema:
Note: the workflow runtime can automatically bring in input resources <or> the task can be allowed to connect to external services and do so as part of its “steps”
input: inputType
// e.g., a “configuration” which can be declared as a local “component” or “externalReference”
// e.g., env. vars.
task
Note: Each input is constrained to be on type of input:
"oneOf": [
{"required": ["resource"]},
{"required": ["parameters"]},
{"required": ["environmentVars"]},
{"required": ["data"]}],
Represents dynamic resources brought into a task at runtime by executor or task commands
Example: “output” target could be a task workspace that the task can read from.
Example: “output” source could be a GitHub repository (with the source code as data
Note: “output” target could be a task operating system where env. vars. are created or modified.
17
Proposal: `outputType` schema:
task
output: outputType
// from resource (e.g., a database)
// to resource e.g., (a workspace)
// e.g., a “log” described by an
// “externalReference” within its target domain
Represents dynamic resources output from a task at runtime by executor or task commands
Note: “output” has a “type” enum. with values:
Note: Each input is constrained to be on type of input:
"oneOf": [
{"required": ["resource"]},
{"required": ["parameters"]},
{"required": ["environmentVars"]},
{"required": ["data"]}],
Example: “output” target could be a a NoSQL database or artifactory
Example: “output” source could be “workspace” the task wrote a file or data to…
Note: the workflow runtime could automatically write output data <or> the task can be allowed to connect to external services and do so as part of its “steps”
TBD: “externalReference” SHOULD mirror these “type” values to ref. their final location.
18
task
[output]:
Proposal: Concrete resource definitions vs. workflow references
trigger
tool
tool
tool:
runtimeTopology
[formula]
input:
Concrete resource definitions
Workflows/Tasks reference resources
workflow: task
// the graph of tasks
Note: Use “components” and “services” lists of resources can also identify CVEs in workflows (as is done today in the same properties in the top-level BOM)
Reference to the Task’s component or service definition
v1.5: Abstract `resourceReferenceChoice`
19
"resourceReferenceChoice": {
"type": "object",
"properties": {
"bom-ref": { "$ref": "#/definitions/refType"},
"externalReference": {"$ref": "#/definitions/externalReference"}
},
"oneOf":[
{"required": ["bom-ref"]},
{"required": ["externalReference"]}
]
}
Enables description of a task’s “runtimeTopology” using dependency graphs constructed from references to existing resource definitions
It can also be used to reference source, target resources that interact with task via “inputs” and “outputs”
20
Proposal: Use a `runtimeTopology` to capture task execution environments
Leverage “externalReferences” to runtime platforms/stack components as well as CycloneDX BOMLink to point to their respective BOMs: https://cyclonedx.org/capabilities/bomlink/
Note: BOMLinks are encoded using the `externalReferences` schema object; a second “externalReference”
would link to the component canonical repository/artifactory/catalog (including corporate/private software )
{
"bomFormat": "CycloneDX",
”specVersion": "1.4”,
"serialNumber": "urn:uuid:3e671687-395b-41f5-a30f-a58921a69b79",
"version": 1,
"components": [{
"type": "library",� "group": "org.example",
"name": "persistence",
“version": "5.2.0",
"externalReferences": [{
"type": "bom",
"url": "urn:cdx:bdd819e6-ee8f-42d7-a4d0-166ff44d51e8/5",
"comment": ”Link to specified BOM, version 5 and bom-ref.",
"hashes": [{
"alg": "SHA-512",
"content": "45c6e3d03ec4207234...”
}]
}]
}]
}
urn:cdx:serialNumber/version#bom-ref
Syntax:
TBD: Perhaps consider adding types that match Cloud Native (CN) and Open Container Initiative (OCI) runtime components? v1.6?
For example:
Example:
v1.5: Reuse: Referencing resources `resourceReferenceChoice`
21
"resourceReferenceChoice": {
"type": "object",
"properties": {
"bom-ref": { "$ref": "#/definitions/refType"},
"externalReference": {"$ref": "#/definitions/externalReference"}
},
"oneOf":[
{"required": ["bom-ref"]},
{"required": ["externalReference"]}
]
}
Purpose: Encourage dependency graphs to be constructed from references to existing resource definitions
Formulation Use Case: Compose Runtime Topologies (for Workflows/Tasks)
© 2023 IBM Corporation
22
Examples:
Formulation: Tekton workflow
with Single “Build” Task
v1.5: Usage Example: `input` (TODO)
23
{
"input": {
"resource": {
"bom-ref": "mytask",
"name": "build-config",
"description": "Input for build task",
"type": "configuration",
},
...
}
Schema: for “input” type
{
"$schema": "http://json-schema.org/draft-07/schema#",
"$id": "https://test-polymorphic",
"type": "object",
"required": ["input"],
"properties": {
"input": {
"type": "object",
"properties": {
"resource": {"$ref": "#/definitions/resourceReferenceChoice"},
},
"required": ["resource"]
}
},
...
}
Usage: of “input” type
”type” enum uses new value “configuration"
24
Example: `runtimeTopology` for a Tekton Container runtime on K8s
TBD
© 2023 IBM Corporation
25
(Future)
v1.6 Proposal for using an abstractResourceType
to reduce field duplication
v1.6: Future-Proofing Resources: `abstractResourceType` (proposl)
26
{ "$schema": "http://json-schema.org/draft-07/schema#",
"$id": "https://test-polymorphic",
"type": "object",
"required": ["input"],
"properties": {
...
},
"definitions": {
"abstractResourceType": {
"type": "object",
"properties": {
"bom-ref": {"type": "string"},
"name": {"type": "string"},
"version": {"type": "string"},
"description": {"type": "string"},
"externalReferences": {"type": "string"}
},
"required": ["bom-ref", "name"]
},
"component": {
"allOf": [ {"$ref": "#/definitions/abstractResourceType"}],
"properties": {
"type": {"type": "string",
"enum": ["application", "library", "container",
"operating-system","file", "configuration", ”log”, “tool”]},
"cpe": {"type": "string"},
"bom-ref": {},
"name": {},
"version": {},
"description": {},
"externalReferences": {}
},
"additionalProperties": false
} }
}
“additionalProperties”:false makes “componentType” a concrete type
reusable (abstract) resource base type (extensible) with common `required` fields
Able to declare additional properties (and `required`) for specific concrete type (e.g., `type`, `cpe`, etc.)
Export properties from abstract type (e.g., “name”, “version”, etc.)
“type“ enum SHOULD have additional values for formulation resources
(e.g., “configuration” (input), “log” (output))
concrete `abstractResourceType` for “component” resource types
“type“ enum MAY need to add a “tool” (or “utility”) value.
v1.6: Abstract `resourceChoice`
27
{
"service": {
"allOf": [ {"$ref": "#/definitions/abstractResourceType"}],
"properties": {
"endpoints": {"type": ”object"},
"bom-ref": {},
"name": {},
"version": {},
"description": {},
"externalReferences": {}
},
"additionalProperties": false
},
"machineLearningModel": {
"allOf": [ {"$ref": "#/definitions/abstractResourceType"}],
"properties": {
"modelCard": {"type": "object"},
"bom-ref": {},
"name": {},
"version": {},
"description": {},
"externalReferences": {}
},
"additionalProperties": false
},
}
}
`resourceChoice` allows any one of the concrete types
"resourceChoice": {
"type": "object",
"oneOf": [
{"$ref": "#/definitions/component" },
{"$ref": "#/definitions/service"},
{"$ref": "#/definitions/machineLearningModel"},
( ... }
]
}
Create more concrete resource types each with unique properties:
Note: different properties that are of type `resourceChoice` can further constrain (limit) the valid concrete types for that usage context
Additional properties unique to the concrete type (e.g., `endpoints` for services, `modelCard` for Machine Learning (ML) models, etc.)
Note: A Machine Learning (ML) model type here is just to illustrate what is possible. It may well be that ML models can simply be represented by the existing “component” type with an additional “type” enum. value of “ml-model” or similar.
© 2023 IBM Corporation
28
Early Formulation Example (JSON)
Current Draft Formulation High-Level Model
29
Based upon “example1.json”
[sequence]
[sequence]
[sequence]
[bom] (root)
[event]
[input]
[task]
[executor]
[formulas]
[formulas]
[formula]
component
component
component
component
component
service
[output]
component
component
step
[dependency]
[configuration]
[configuration]
[configuration]
executed_by ???
tool
component
component
component
component
component
service
Current Draft Formulation Model Details
30
Based upon “example1.json”
[formula]: object
[sequence]: object
[event]: object
// array, plural
// to-task, SHOULD be a component with its own BOM/graph and per-workflow, or per-task
[input]: object
[output]: object
[task]: object
[executor]: object
[bom] (root)
[configuration]: object
[dependency]: object
© 2023 IBM Corporation
31
Frsca Background
featuring Tekton Chains and Spire Usage
Tekton Chains – Single Task Demo
32
33
Zero-Trust Supply Chains (Frsca + Spire)
34
Road to SLSA3: Non-falsifiable Provenance in Tekton with SPIFFE/SPIRE
Containers Approach - ”Build your own Docker image with everything”
35
Runtime (Container image)
Server Framework or HTTP Server
Output
Framework Context
Fx
“App” Libraries
Environment Vars.
Input
CaaS Platform
Language Runtime
“Profile” Libraries
(Provider dependent)
“System” Libraries
1
2
3
4
5
6
7
Developers Create a “Full Stack” Runtime image with Function and dependencies “baked in”
Handle Granular logging or monitoring
6
Select base language runtime image
1
Install ”Profile” libraries
2
Installing Service Framework or Http Server
3
Install “function” + Dependencies into Service Framework
4
Configure your own Context
5
Manage Concurrency
7
Serverless Platform Invokes Endpoint and Scales Container