Skip to content

Commit 8123d63

Browse files
chitrangpateltekton-robot
authored andcommitted
Introducing the StepAction CRD
This PR introduces the StepAction CRD in `v1alpha1`. This is not the complete CRD. As we add support for `params`, `results` etc. we will introduce in follow-up PRs. It is the first of many implementation PRs as described in issue: #7259
1 parent f0c7ed5 commit 8123d63

37 files changed

+3811
-3
lines changed

cmd/webhook/main.go

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -52,6 +52,7 @@ import (
5252
var types = map[schema.GroupVersionKind]resourcesemantics.GenericCRD{
5353
// v1alpha1
5454
v1alpha1.SchemeGroupVersion.WithKind("VerificationPolicy"): &v1alpha1.VerificationPolicy{},
55+
v1alpha1.SchemeGroupVersion.WithKind("StepAction"): &v1alpha1.StepAction{},
5556
// v1beta1
5657
v1beta1.SchemeGroupVersion.WithKind("Pipeline"): &v1beta1.Pipeline{},
5758
v1beta1.SchemeGroupVersion.WithKind("Task"): &v1beta1.Task{},
@@ -152,6 +153,7 @@ func newConfigValidationController(name string) func(context.Context, configmap.
152153

153154
func newConversionController(ctx context.Context, cmw configmap.Watcher) *controller.Impl {
154155
var (
156+
v1alpha1GroupVersion = v1alpha1.SchemeGroupVersion.Version
155157
v1beta1GroupVersion = v1beta1.SchemeGroupVersion.Version
156158
v1GroupVersion = v1.SchemeGroupVersion.Version
157159
resolutionv1alpha1GroupVersion = resolutionv1alpha1.SchemeGroupVersion.Version
@@ -169,6 +171,10 @@ func newConversionController(ctx context.Context, cmw configmap.Watcher) *contro
169171
// conversions to and from all types.
170172
// "Zygotes" are the supported versions.
171173
map[schema.GroupKind]conversion.GroupKindConversion{
174+
v1alpha1.Kind("StepAction"): {
175+
DefinitionName: pipeline.StepActionResource.String(),
176+
HubVersion: v1alpha1GroupVersion,
177+
},
172178
v1.Kind("Task"): {
173179
DefinitionName: pipeline.TaskResource.String(),
174180
HubVersion: v1beta1GroupVersion,

config/200-clusterrole.yaml

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ rules:
3232
# Controller needs cluster access to all of the CRDs that it is responsible for
3333
# managing.
3434
- apiGroups: ["tekton.dev"]
35-
resources: ["tasks", "clustertasks", "taskruns", "pipelines", "pipelineruns", "customruns"]
35+
resources: ["tasks", "clustertasks", "taskruns", "pipelines", "pipelineruns", "customruns", "stepactions"]
3636
verbs: ["get", "list", "create", "update", "delete", "patch", "watch"]
3737
- apiGroups: ["tekton.dev"]
3838
resources: ["verificationpolicies"]
@@ -41,7 +41,7 @@ rules:
4141
resources: ["taskruns/finalizers", "pipelineruns/finalizers", "customruns/finalizers"]
4242
verbs: ["get", "list", "create", "update", "delete", "patch", "watch"]
4343
- apiGroups: ["tekton.dev"]
44-
resources: ["tasks/status", "clustertasks/status", "taskruns/status", "pipelines/status", "pipelineruns/status", "customruns/status", "verificationpolicies/status"]
44+
resources: ["tasks/status", "clustertasks/status", "taskruns/status", "pipelines/status", "pipelineruns/status", "customruns/status", "verificationpolicies/status", "stepactions/status"]
4545
verbs: ["get", "list", "create", "update", "delete", "patch", "watch"]
4646
# resolution.tekton.dev
4747
- apiGroups: ["resolution.tekton.dev"]
@@ -98,6 +98,7 @@ rules:
9898
- resolutionrequests.resolution.tekton.dev
9999
- customruns.tekton.dev
100100
- verificationpolicies.tekton.dev
101+
- stepactions.tekton.dev
101102
# knative.dev/pkg needs list/watch permissions to set up informers for the webhook.
102103
- apiGroups: ["apiextensions.k8s.io"]
103104
resources: ["customresourcedefinitions"]

config/300-stepaction.yaml

Lines changed: 53 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,53 @@
1+
# Copyright 2023 The Tekton Authors
2+
#
3+
# Licensed under the Apache License, Version 2.0 (the "License");
4+
# you may not use this file except in compliance with the License.
5+
# You may obtain a copy of the License at
6+
#
7+
# https://www.apache.org/licenses/LICENSE-2.0
8+
#
9+
# Unless required by applicable law or agreed to in writing, software
10+
# distributed under the License is distributed on an "AS IS" BASIS,
11+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12+
# See the License for the specific language governing permissions and
13+
# limitations under the License.
14+
15+
apiVersion: apiextensions.k8s.io/v1
16+
kind: CustomResourceDefinition
17+
metadata:
18+
name: stepactions.tekton.dev
19+
labels:
20+
app.kubernetes.io/instance: default
21+
app.kubernetes.io/part-of: tekton-pipelines
22+
pipeline.tekton.dev/release: "devel"
23+
version: "devel"
24+
spec:
25+
group: tekton.dev
26+
preserveUnknownFields: false
27+
versions:
28+
- name: v1alpha1
29+
served: true
30+
storage: true
31+
schema:
32+
openAPIV3Schema:
33+
type: object
34+
# One can use x-kubernetes-preserve-unknown-fields: true
35+
# at the root of the schema (and inside any properties, additionalProperties)
36+
# to get the traditional CRD behaviour that nothing is pruned, despite
37+
# setting spec.preserveUnknownProperties: false.
38+
#
39+
# See https://kubernetes.io/blog/2019/06/20/crd-structural-schema/
40+
# See issue: https://github.com/knative/serving/issues/912
41+
x-kubernetes-preserve-unknown-fields: true
42+
# Opt into the status subresource so metadata.generation
43+
# starts to increment
44+
subresources:
45+
status: {}
46+
names:
47+
kind: StepAction
48+
plural: stepactions
49+
singular: stepaction
50+
categories:
51+
- tekton
52+
- tekton-pipelines
53+
scope: Namespaced

config/clusterrole-aggregate-edit.yaml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,7 @@ rules:
3131
- pipelineruns
3232
- runs
3333
- customruns
34+
- stepactions
3435
verbs:
3536
- create
3637
- delete

config/clusterrole-aggregate-view.yaml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,7 @@ rules:
3030
- pipelineruns
3131
- runs
3232
- customruns
33+
- stepactions
3334
verbs:
3435
- get
3536
- list

docs/pipeline-api.md

Lines changed: 249 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6134,6 +6134,8 @@ Resource Types:
61346134
<ul><li>
61356135
<a href="#tekton.dev/v1alpha1.Run">Run</a>
61366136
</li><li>
6137+
<a href="#tekton.dev/v1alpha1.StepAction">StepAction</a>
6138+
</li><li>
61376139
<a href="#tekton.dev/v1alpha1.VerificationPolicy">VerificationPolicy</a>
61386140
</li><li>
61396141
<a href="#tekton.dev/v1alpha1.PipelineResource">PipelineResource</a>
@@ -6353,6 +6355,151 @@ RunStatus
63536355
</tr>
63546356
</tbody>
63556357
</table>
6358+
<h3 id="tekton.dev/v1alpha1.StepAction">StepAction
6359+
</h3>
6360+
<div>
6361+
<p>StepAction represents the actionable components of Step.
6362+
The Step can only reference it from the cluster or using remote resolution.</p>
6363+
</div>
6364+
<table>
6365+
<thead>
6366+
<tr>
6367+
<th>Field</th>
6368+
<th>Description</th>
6369+
</tr>
6370+
</thead>
6371+
<tbody>
6372+
<tr>
6373+
<td>
6374+
<code>apiVersion</code><br/>
6375+
string</td>
6376+
<td>
6377+
<code>
6378+
tekton.dev/v1alpha1
6379+
</code>
6380+
</td>
6381+
</tr>
6382+
<tr>
6383+
<td>
6384+
<code>kind</code><br/>
6385+
string
6386+
</td>
6387+
<td><code>StepAction</code></td>
6388+
</tr>
6389+
<tr>
6390+
<td>
6391+
<code>metadata</code><br/>
6392+
<em>
6393+
<a href="https://kubernetes.io/docs/reference/generated/kubernetes-api/v1.24/#objectmeta-v1-meta">
6394+
Kubernetes meta/v1.ObjectMeta
6395+
</a>
6396+
</em>
6397+
</td>
6398+
<td>
6399+
<em>(Optional)</em>
6400+
Refer to the Kubernetes API documentation for the fields of the
6401+
<code>metadata</code> field.
6402+
</td>
6403+
</tr>
6404+
<tr>
6405+
<td>
6406+
<code>spec</code><br/>
6407+
<em>
6408+
<a href="#tekton.dev/v1alpha1.StepActionSpec">
6409+
StepActionSpec
6410+
</a>
6411+
</em>
6412+
</td>
6413+
<td>
6414+
<em>(Optional)</em>
6415+
<p>Spec holds the desired state of the Step from the client</p>
6416+
<br/>
6417+
<br/>
6418+
<table>
6419+
<tr>
6420+
<td>
6421+
<code>image</code><br/>
6422+
<em>
6423+
string
6424+
</em>
6425+
</td>
6426+
<td>
6427+
<em>(Optional)</em>
6428+
<p>Image reference name to run for this StepAction.
6429+
More info: <a href="https://kubernetes.io/docs/concepts/containers/images">https://kubernetes.io/docs/concepts/containers/images</a></p>
6430+
</td>
6431+
</tr>
6432+
<tr>
6433+
<td>
6434+
<code>command</code><br/>
6435+
<em>
6436+
[]string
6437+
</em>
6438+
</td>
6439+
<td>
6440+
<em>(Optional)</em>
6441+
<p>Entrypoint array. Not executed within a shell.
6442+
The image&rsquo;s ENTRYPOINT is used if this is not provided.
6443+
Variable references $(VAR_NAME) are expanded using the container&rsquo;s environment. If a variable
6444+
cannot be resolved, the reference in the input string will be unchanged. Double $$ are reduced
6445+
to a single $, which allows for escaping the $(VAR_NAME) syntax: i.e. &ldquo;$$(VAR_NAME)&rdquo; will
6446+
produce the string literal &ldquo;$(VAR_NAME)&rdquo;. Escaped references will never be expanded, regardless
6447+
of whether the variable exists or not. Cannot be updated.
6448+
More info: <a href="https://kubernetes.io/docs/tasks/inject-data-application/define-command-argument-container/#running-a-command-in-a-shell">https://kubernetes.io/docs/tasks/inject-data-application/define-command-argument-container/#running-a-command-in-a-shell</a></p>
6449+
</td>
6450+
</tr>
6451+
<tr>
6452+
<td>
6453+
<code>args</code><br/>
6454+
<em>
6455+
[]string
6456+
</em>
6457+
</td>
6458+
<td>
6459+
<em>(Optional)</em>
6460+
<p>Arguments to the entrypoint.
6461+
The image&rsquo;s CMD is used if this is not provided.
6462+
Variable references $(VAR_NAME) are expanded using the container&rsquo;s environment. If a variable
6463+
cannot be resolved, the reference in the input string will be unchanged. Double $$ are reduced
6464+
to a single $, which allows for escaping the $(VAR_NAME) syntax: i.e. &ldquo;$$(VAR_NAME)&rdquo; will
6465+
produce the string literal &ldquo;$(VAR_NAME)&rdquo;. Escaped references will never be expanded, regardless
6466+
of whether the variable exists or not. Cannot be updated.
6467+
More info: <a href="https://kubernetes.io/docs/tasks/inject-data-application/define-command-argument-container/#running-a-command-in-a-shell">https://kubernetes.io/docs/tasks/inject-data-application/define-command-argument-container/#running-a-command-in-a-shell</a></p>
6468+
</td>
6469+
</tr>
6470+
<tr>
6471+
<td>
6472+
<code>env</code><br/>
6473+
<em>
6474+
<a href="https://kubernetes.io/docs/reference/generated/kubernetes-api/v1.24/#envvar-v1-core">
6475+
[]Kubernetes core/v1.EnvVar
6476+
</a>
6477+
</em>
6478+
</td>
6479+
<td>
6480+
<em>(Optional)</em>
6481+
<p>List of environment variables to set in the container.
6482+
Cannot be updated.</p>
6483+
</td>
6484+
</tr>
6485+
<tr>
6486+
<td>
6487+
<code>script</code><br/>
6488+
<em>
6489+
string
6490+
</em>
6491+
</td>
6492+
<td>
6493+
<em>(Optional)</em>
6494+
<p>Script is the contents of an executable file to execute.</p>
6495+
<p>If Script is not empty, the Step cannot have an Command and the Args will be passed to the Script.</p>
6496+
</td>
6497+
</tr>
6498+
</table>
6499+
</td>
6500+
</tr>
6501+
</tbody>
6502+
</table>
63566503
<h3 id="tekton.dev/v1alpha1.VerificationPolicy">VerificationPolicy
63576504
</h3>
63586505
<div>
@@ -7008,6 +7155,108 @@ Refer Go&rsquo;s ParseDuration documentation for expected format: <a href="https
70087155
<div>
70097156
<p>RunSpecStatusMessage defines human readable status messages for the TaskRun.</p>
70107157
</div>
7158+
<h3 id="tekton.dev/v1alpha1.StepActionObject">StepActionObject
7159+
</h3>
7160+
<div>
7161+
<p>StepActionObject is implemented by StepAction</p>
7162+
</div>
7163+
<h3 id="tekton.dev/v1alpha1.StepActionSpec">StepActionSpec
7164+
</h3>
7165+
<p>
7166+
(<em>Appears on:</em><a href="#tekton.dev/v1alpha1.StepAction">StepAction</a>)
7167+
</p>
7168+
<div>
7169+
<p>StepActionSpec contains the actionable components of a step.</p>
7170+
</div>
7171+
<table>
7172+
<thead>
7173+
<tr>
7174+
<th>Field</th>
7175+
<th>Description</th>
7176+
</tr>
7177+
</thead>
7178+
<tbody>
7179+
<tr>
7180+
<td>
7181+
<code>image</code><br/>
7182+
<em>
7183+
string
7184+
</em>
7185+
</td>
7186+
<td>
7187+
<em>(Optional)</em>
7188+
<p>Image reference name to run for this StepAction.
7189+
More info: <a href="https://kubernetes.io/docs/concepts/containers/images">https://kubernetes.io/docs/concepts/containers/images</a></p>
7190+
</td>
7191+
</tr>
7192+
<tr>
7193+
<td>
7194+
<code>command</code><br/>
7195+
<em>
7196+
[]string
7197+
</em>
7198+
</td>
7199+
<td>
7200+
<em>(Optional)</em>
7201+
<p>Entrypoint array. Not executed within a shell.
7202+
The image&rsquo;s ENTRYPOINT is used if this is not provided.
7203+
Variable references $(VAR_NAME) are expanded using the container&rsquo;s environment. If a variable
7204+
cannot be resolved, the reference in the input string will be unchanged. Double $$ are reduced
7205+
to a single $, which allows for escaping the $(VAR_NAME) syntax: i.e. &ldquo;$$(VAR_NAME)&rdquo; will
7206+
produce the string literal &ldquo;$(VAR_NAME)&rdquo;. Escaped references will never be expanded, regardless
7207+
of whether the variable exists or not. Cannot be updated.
7208+
More info: <a href="https://kubernetes.io/docs/tasks/inject-data-application/define-command-argument-container/#running-a-command-in-a-shell">https://kubernetes.io/docs/tasks/inject-data-application/define-command-argument-container/#running-a-command-in-a-shell</a></p>
7209+
</td>
7210+
</tr>
7211+
<tr>
7212+
<td>
7213+
<code>args</code><br/>
7214+
<em>
7215+
[]string
7216+
</em>
7217+
</td>
7218+
<td>
7219+
<em>(Optional)</em>
7220+
<p>Arguments to the entrypoint.
7221+
The image&rsquo;s CMD is used if this is not provided.
7222+
Variable references $(VAR_NAME) are expanded using the container&rsquo;s environment. If a variable
7223+
cannot be resolved, the reference in the input string will be unchanged. Double $$ are reduced
7224+
to a single $, which allows for escaping the $(VAR_NAME) syntax: i.e. &ldquo;$$(VAR_NAME)&rdquo; will
7225+
produce the string literal &ldquo;$(VAR_NAME)&rdquo;. Escaped references will never be expanded, regardless
7226+
of whether the variable exists or not. Cannot be updated.
7227+
More info: <a href="https://kubernetes.io/docs/tasks/inject-data-application/define-command-argument-container/#running-a-command-in-a-shell">https://kubernetes.io/docs/tasks/inject-data-application/define-command-argument-container/#running-a-command-in-a-shell</a></p>
7228+
</td>
7229+
</tr>
7230+
<tr>
7231+
<td>
7232+
<code>env</code><br/>
7233+
<em>
7234+
<a href="https://kubernetes.io/docs/reference/generated/kubernetes-api/v1.24/#envvar-v1-core">
7235+
[]Kubernetes core/v1.EnvVar
7236+
</a>
7237+
</em>
7238+
</td>
7239+
<td>
7240+
<em>(Optional)</em>
7241+
<p>List of environment variables to set in the container.
7242+
Cannot be updated.</p>
7243+
</td>
7244+
</tr>
7245+
<tr>
7246+
<td>
7247+
<code>script</code><br/>
7248+
<em>
7249+
string
7250+
</em>
7251+
</td>
7252+
<td>
7253+
<em>(Optional)</em>
7254+
<p>Script is the contents of an executable file to execute.</p>
7255+
<p>If Script is not empty, the Step cannot have an Command and the Args will be passed to the Script.</p>
7256+
</td>
7257+
</tr>
7258+
</tbody>
7259+
</table>
70117260
<h3 id="tekton.dev/v1alpha1.VerificationPolicySpec">VerificationPolicySpec
70127261
</h3>
70137262
<p>

0 commit comments

Comments
 (0)