diff --git a/CHANGELOG.md b/CHANGELOG.md
index d045deb4803..852f91c6316 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -12,11 +12,13 @@
* Fix #2046: OpenshiftClient getVersion returns null for Openshift ContainerPlatform v4
#### Improvements
+* Fix #1987: Added an example for Task and TaskRun with updated model
* Fix #2019: Added CustomResourceCrudTest
* Fix #2054: JobExample doesn't work
#### Dependency Upgrade
* Updated Knative model to v0.13.0
+* Updated Tekton Model to v0.11.0
#### New Features
diff --git a/extensions/tekton/examples/src/main/java/io/fabric8/tekton/api/examples/PipelineResourceCreate.java b/extensions/tekton/examples/src/main/java/io/fabric8/tekton/api/examples/PipelineResourceCreate.java
index 1042eeeebe8..4db4956140f 100644
--- a/extensions/tekton/examples/src/main/java/io/fabric8/tekton/api/examples/PipelineResourceCreate.java
+++ b/extensions/tekton/examples/src/main/java/io/fabric8/tekton/api/examples/PipelineResourceCreate.java
@@ -23,6 +23,7 @@ public class PipelineResourceCreate {
public static void main(String[] args) {
try ( TektonClient client = ClientFactory.newClient(args)) {
+ String namespace = "default";
PipelineResource resource = new PipelineResourceBuilder()
.withNewMetadata()
.withName("client-repo")
@@ -40,7 +41,7 @@ public static void main(String[] args) {
.endSpec()
.build();
- System.out.println("Created:" + client.pipelineResources().create(resource).getMetadata().getName());
+ System.out.println("Created:" + client.pipelineResources().inNamespace(namespace).create(resource).getMetadata().getName());
}
System.exit(0);
}
diff --git a/extensions/tekton/examples/src/main/java/io/fabric8/tekton/api/examples/TaskCreate.java b/extensions/tekton/examples/src/main/java/io/fabric8/tekton/api/examples/TaskCreate.java
new file mode 100644
index 00000000000..efec05096e2
--- /dev/null
+++ b/extensions/tekton/examples/src/main/java/io/fabric8/tekton/api/examples/TaskCreate.java
@@ -0,0 +1,51 @@
+/**
+ * Copyright (C) 2015 Red Hat, Inc.
+ *
+ * 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 io.fabric8.tekton.api.examples;
+
+import io.fabric8.tekton.client.DefaultTektonClient;
+import io.fabric8.tekton.client.TektonClient;
+import io.fabric8.tekton.pipeline.v1beta1.Task;
+import io.fabric8.tekton.pipeline.v1beta1.TaskBuilder;
+import io.fabric8.tekton.pipeline.v1beta1.TaskList;
+
+public class TaskCreate {
+ public static void main(String[] args) {
+ try (TektonClient tektonClient = new DefaultTektonClient()) {
+ String namespace = "default";
+ Task task = new TaskBuilder()
+ .withNewMetadata().withName("read-task").endMetadata()
+ .withNewSpec()
+ .withNewResources()
+ .addNewInput()
+ .withName("workspace").withType("git")
+ .endInput()
+ .endResources()
+ .addNewStep()
+ .withName("readme").withImage("ubuntu").withScript("cat workspace/README.md")
+ .endStep()
+ .endSpec()
+ .build();
+
+ // Create Task
+ task = tektonClient.tasks().inNamespace(namespace).create(task);
+ System.out.println("Created: " + task.getMetadata().getName());
+
+ // List Task
+ TaskList taskList = tektonClient.tasks().inNamespace(namespace).list();
+ System.out.println("There are " + taskList.getItems().size() + " Tasks in " + namespace);
+ }
+ }
+}
diff --git a/extensions/tekton/examples/src/main/java/io/fabric8/tekton/api/examples/TaskRunCreate.java b/extensions/tekton/examples/src/main/java/io/fabric8/tekton/api/examples/TaskRunCreate.java
new file mode 100644
index 00000000000..64ffc0213cf
--- /dev/null
+++ b/extensions/tekton/examples/src/main/java/io/fabric8/tekton/api/examples/TaskRunCreate.java
@@ -0,0 +1,60 @@
+/**
+ * Copyright (C) 2015 Red Hat, Inc.
+ *
+ * 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 io.fabric8.tekton.api.examples;
+
+import io.fabric8.tekton.client.DefaultTektonClient;
+import io.fabric8.tekton.client.TektonClient;
+import io.fabric8.tekton.pipeline.v1beta1.TaskRun;
+import io.fabric8.tekton.pipeline.v1beta1.TaskRunBuilder;
+import io.fabric8.tekton.pipeline.v1beta1.TaskRunList;
+
+public class TaskRunCreate {
+ public static void main(String[] args) {
+ try (TektonClient tektonClient = new DefaultTektonClient()) {
+ String namespace = "default";
+ TaskRun taskRun = new TaskRunBuilder()
+ .withNewMetadata().withGenerateName("build-gcs-targz-").endMetadata()
+ .withNewSpec()
+ .withNewTaskSpec()
+ .withNewResources()
+ .addNewInput().withName("source").withType("storage").endInput()
+ .endResources()
+ .addNewStep().withImage("ubuntu").withScript("cat source/file.txt").endStep()
+ .endTaskSpec()
+ .withNewResources()
+ .addNewInput()
+ .withName("source")
+ .withNewResourceSpec()
+ .withType("storage")
+ .addNewParam().withName("location").withValue("gs://build-crd-tests/archive.tar.gz").endParam()
+ .addNewParam().withName("artifactType").withValue("TarGzArchive").endParam()
+ .addNewParam().withName("type").withValue("build-gcs").endParam()
+ .endResourceSpec()
+ .endInput()
+ .endResources()
+ .endSpec()
+ .build();
+
+ // Create TaskRun
+ taskRun = tektonClient.taskRuns().inNamespace(namespace).create(taskRun);
+ System.out.println("Created: " + taskRun.getMetadata().getName());
+
+ // List TaskRun
+ TaskRunList taskRunList = tektonClient.taskRuns().inNamespace(namespace).list();
+ System.out.println("There are " + taskRunList.getItems().size() + " TaskRun objects in " + namespace);
+ }
+ }
+}
diff --git a/extensions/tekton/generator/generate b/extensions/tekton/generator/generate
index 9caba4cf581..a30083d3288 100755
Binary files a/extensions/tekton/generator/generate and b/extensions/tekton/generator/generate differ
diff --git a/extensions/tekton/generator/go.mod b/extensions/tekton/generator/go.mod
index cd8ad7cbd6b..57d5d7fbd1b 100644
--- a/extensions/tekton/generator/go.mod
+++ b/extensions/tekton/generator/go.mod
@@ -7,7 +7,7 @@ require (
github.com/knative/pkg v0.0.0-20190617142447-13b093adc272 // indirect
github.com/knative/serving v0.6.0
github.com/knative/test-infra v0.0.0-20190702025031-91d37e4abc30 // indirect
- github.com/tektoncd/pipeline v0.11.0-rc2
+ github.com/tektoncd/pipeline v0.11.0
k8s.io/cli-runtime v0.0.0-20190325194458-f2b4781c3ae1 // indirect
)
diff --git a/extensions/tekton/generator/go.sum b/extensions/tekton/generator/go.sum
index 4da314f1973..e9c903f0ad0 100644
--- a/extensions/tekton/generator/go.sum
+++ b/extensions/tekton/generator/go.sum
@@ -427,6 +427,8 @@ github.com/tektoncd/pipeline v0.10.1 h1:pDsYK2b70o/Ze/CE1nisELwKVVE54FxwyfLznsW1
github.com/tektoncd/pipeline v0.10.1/go.mod h1:D2X0exT46zYx95BU7ByM8+erpjoN7thmUBvlKThOszU=
github.com/tektoncd/pipeline v0.11.0-rc2 h1:dMdrmxGt5J+BpDf6uv1QyvfnJBmjd/7X5fEQLcCmu+Q=
github.com/tektoncd/pipeline v0.11.0-rc2/go.mod h1:QL3YmLzeKBdKk1THeQ6zmq2UXoPN+KdxeiU/7ynPtqY=
+github.com/tektoncd/pipeline v0.11.0 h1:kGeWm53R5ggajD/L2KU8kcsZ2lVd4ruN3kdqK1A/NwQ=
+github.com/tektoncd/pipeline v0.11.0/go.mod h1:hlkH32S92+/UODROH0dmxzyuMxfRFp/Nc3e29MewLn8=
github.com/tektoncd/plumbing v0.0.0-20191216083742-847dcf196de9/go.mod h1:QZHgU07PRBTRF6N57w4+ApRu8OgfYLFNqCDlfEZaD9Y=
github.com/tektoncd/plumbing v0.0.0-20200217163359-cd0db6e567d2/go.mod h1:QZHgU07PRBTRF6N57w4+ApRu8OgfYLFNqCDlfEZaD9Y=
github.com/tektoncd/plumbing/pipelinerun-logs v0.0.0-20191206114338-712d544c2c21/go.mod h1:S62EUWtqmejjJgUMOGB1CCCHRp6C706laH06BoALkzU=
@@ -625,6 +627,7 @@ golang.org/x/xerrors v0.0.0-20190717185122-a985d3407aa7 h1:9zdDQZ7Thm29KFXgAX/+y
golang.org/x/xerrors v0.0.0-20190717185122-a985d3407aa7/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0=
golang.org/x/xerrors v0.0.0-20191011141410-1b5146add898/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0=
golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0=
+gomodules.xyz/jsonpatch/v2 v2.1.0/go.mod h1:IhYNNY4jnS53ZnfE4PAmpKtDpTCj1JFXc+3mwe7XcUU=
gonum.org/v1/gonum v0.0.0-20190331200053-3d26580ed485/go.mod h1:2ltnJ7xHfj0zHS40VVPYEAAMTa3ZGguvHGBSJeRWqE0=
gonum.org/v1/netlib v0.0.0-20190313105609-8cb42192e0e0/go.mod h1:wa6Ws7BG/ESfp6dHfk7C6KdzKA7wR7u/rKwOGE66zvw=
gonum.org/v1/netlib v0.0.0-20190331212654-76723241ea4e/go.mod h1:kS+toOQn6AQKjmKJ7gzohV1XkqsFehRA2FbsbkopSuQ=
diff --git a/extensions/tekton/model/src/main/resources/schema/validation-schema.json b/extensions/tekton/model/src/main/resources/schema/validation-schema.json
index 8a9189a6b11..55eb69b9eae 100644
--- a/extensions/tekton/model/src/main/resources/schema/validation-schema.json
+++ b/extensions/tekton/model/src/main/resources/schema/validation-schema.json
@@ -5626,25 +5626,29 @@
},
"condition": {
"properties": {
- "apiVersion": {
+ "lastTransitionTime": {
+ "$ref": "#/definitions/knative_VolatileTime",
+ "javaType": "io.fabric8.knative.v1.VolatileTime"
+ },
+ "message": {
"type": "string",
- "description": "",
- "default": "tekton.dev/v1alpha1",
- "required": true
+ "description": "human-readable message indicating details about last transition"
},
- "kind": {
+ "reason": {
"type": "string",
- "description": "",
- "default": "Condition",
- "required": true
+ "description": "one-word CamelCase reason for the condition's last transition"
},
- "metadata": {
- "$ref": "#/definitions/kubernetes_meta_ObjectMeta",
- "javaType": "io.fabric8.kubernetes.api.model.ObjectMeta"
+ "severity": {
+ "type": "string",
+ "description": "how to interpret failures of this condition"
},
- "spec": {
- "$ref": "#/definitions/tekton_v1alpha1_ConditionSpec",
- "javaType": "io.fabric8.tekton.pipeline.v1alpha1.ConditionSpec"
+ "status": {
+ "type": "string",
+ "description": "status of the condition"
+ },
+ "type": {
+ "type": "string",
+ "description": "type of status condition"
}
},
"additionalProperties": true
diff --git a/pom.xml b/pom.xml
index 7d2c4c7f3b4..cea3f0931fc 100644
--- a/pom.xml
+++ b/pom.xml
@@ -773,7 +773,7 @@
sonar
fabric8io_kubernetes-client
- ${artifactId}
+ ${project.artifactId}
fabric8io
https://sonarcloud.io
${env.SONAR_LOGIN_TOKEN}