Skip to content

Commit

Permalink
Merge pull request #2160 from Fabian-K/separate-model-schema
Browse files Browse the repository at this point in the history
  • Loading branch information
fusesource-ci committed May 3, 2020
2 parents deddbaa + 24720d5 commit 8f0ecd9
Show file tree
Hide file tree
Showing 38 changed files with 3,755 additions and 1,562 deletions.
4 changes: 4 additions & 0 deletions .editorconfig
Original file line number Diff line number Diff line change
Expand Up @@ -5,3 +5,7 @@ end_of_line = lf
insert_final_newline = true
indent_style = space
indent_size = 2

[{Makefile,**.mk}]
# Use tabs for indentation (Makefiles require tabs)
indent_style = tab

This file was deleted.

6 changes: 5 additions & 1 deletion extensions/tekton/client/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,11 @@
</dependency>
<dependency>
<groupId>io.fabric8</groupId>
<artifactId>tekton-model</artifactId>
<artifactId>tekton-model-v1alpha1</artifactId>
</dependency>
<dependency>
<groupId>io.fabric8</groupId>
<artifactId>tekton-model-v1beta1</artifactId>
</dependency>
<dependency>
<groupId>io.fabric8</groupId>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,9 +26,9 @@
@VelocityTransformation(value = "/resource-handler-services.vm", gather = true, outputPath = "META-INF/services/io.fabric8.kubernetes.client.ResourceHandler")
},
resources = {
@ResourceSelector("tekton.properties")
@ResourceSelector("tekton-v1alpha1.properties"),
@ResourceSelector("tekton-v1beta1.properties")
}

)
public class CodeGen {
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,61 @@
/**
* 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.v1alpha1;

import io.fabric8.tekton.client.DefaultTektonClient;
import io.fabric8.tekton.client.TektonClient;
import io.fabric8.tekton.pipeline.v1alpha1.TaskRun;
import io.fabric8.tekton.pipeline.v1alpha1.TaskRunBuilder;
import io.fabric8.tekton.pipeline.v1alpha1.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()
.withNewInputs()
.addNewResource().withName("source").withType("storage").endResource()
.endInputs()
.addNewStep().withImage("ubuntu").withScript("cat source/file.txt").endStep()
.endTaskSpec()
.withNewInputs()
.addNewResource()
.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()
.endResource()
.endInputs()
.endSpec()
.build();

// Create TaskRun
taskRun = tektonClient.v1alpha1().taskRuns().inNamespace(namespace).create(taskRun);
System.out.println("Created: " + taskRun.getMetadata().getName());

// List TaskRun
TaskRunList taskRunList = tektonClient.v1alpha1().taskRuns().inNamespace(namespace).list();
System.out.println("There are " + taskRunList.getItems().size() + " TaskRun objects in " + namespace);
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package io.fabric8.tekton.api.examples;
package io.fabric8.tekton.api.examples.v1beta1;

import io.fabric8.tekton.client.DefaultTektonClient;
import io.fabric8.tekton.client.TektonClient;
Expand Down
1 change: 1 addition & 0 deletions extensions/tekton/generator-v1alpha1/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
/vendor/
28 changes: 28 additions & 0 deletions extensions/tekton/generator-v1alpha1/Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
#
# 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.
#

SHELL := /bin/bash

all: build

build: gobuild
pushd ../model-v1alpha1 && \
mvn clean install -o && \
popd

gobuild:
go mod vendor
CGO_ENABLED=0 GO111MODULE=on GO15VENDOREXPERIMENT=1 go run -mod=vendor -a ./cmd/generate/generate.go > ../model-v1alpha1/src/main/resources/schema/tekton-schema-v1alpha1.json

0 comments on commit 8f0ecd9

Please sign in to comment.