Skip to content

Commit

Permalink
Upgrade Tekton Model to v0.46.0
Browse files Browse the repository at this point in the history
- Upgrade Tekton Pipelines to v0.46.0
- Upgrade Tekton Triggers to v0.23.0
- Add the new `v1` Tekton Pipelines API Group
- Merge generator code into single package per module (to avoid
  duplicating boilerplate + version drifts between API groups)
  and remove obsolete Golang setup (e.g. vendoring)
- Rename `ArrayOrString` to `ParamValue` (has been renamed upstream)
- Fix various tests, delete obsolete ones
  • Loading branch information
dziemba committed Mar 23, 2023
1 parent b44cf33 commit 32c8c96
Show file tree
Hide file tree
Showing 171 changed files with 12,657 additions and 11,748 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@

#### Improvements
* Fix #4477 exposing LeaderElector.release to force an elector to give up the lease
* Upgrade Tekton Model to v0.46.0

#### Dependency Upgrade

Expand Down
4 changes: 4 additions & 0 deletions extensions/tekton/client/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,10 @@
<groupId>io.sundr</groupId>
<artifactId>transform-annotations</artifactId>
</dependency>
<dependency>
<groupId>io.fabric8</groupId>
<artifactId>tekton-model-v1</artifactId>
</dependency>
<dependency>
<groupId>io.fabric8</groupId>
<artifactId>tekton-model-v1alpha1</artifactId>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@
import io.fabric8.kubernetes.client.dsl.FunctionCallable;
import io.fabric8.kubernetes.client.extension.ExtensionRootClientAdapter;
import io.fabric8.kubernetes.client.extension.SupportTestingClient;
import io.fabric8.tekton.client.dsl.V1APIGroupDSL;
import io.fabric8.tekton.client.dsl.V1alpha1APIGroupDSL;
import io.fabric8.tekton.client.dsl.V1beta1APIGroupDSL;

Expand Down Expand Up @@ -50,6 +51,11 @@ public FunctionCallable<NamespacedTektonClient> withRequestConfig(RequestConfig
return new WithRequestCallable<>(this, requestConfig);
}

@Override
public V1APIGroupDSL v1() {
return adapt(V1APIGroupClient.class);
}

@Override
public V1beta1APIGroupDSL v1beta1() {
return adapt(V1beta1APIGroupClient.class);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,13 +16,21 @@
package io.fabric8.tekton.client;

import io.fabric8.kubernetes.client.Client;
import io.fabric8.tekton.client.dsl.V1APIGroupDSL;
import io.fabric8.tekton.client.dsl.V1alpha1APIGroupDSL;
import io.fabric8.tekton.client.dsl.V1beta1APIGroupDSL;

/**
* Main interface for Tekton client library.
*/
public interface TektonClient extends Client {
/**
* API entrypoint for tekton.dev/v1 API group resources
*
* @return {@link V1APIGroupDSL} for Tekton resource operations in this API group.
*/
V1APIGroupDSL v1();

/**
* API entrypoint for tekton.dev/v1beta1 API group resources
*
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@

import io.fabric8.kubernetes.client.Client;
import io.fabric8.kubernetes.client.extension.ExtensionAdapter;
import io.fabric8.tekton.client.dsl.V1APIGroupDSL;
import io.fabric8.tekton.client.dsl.V1alpha1APIGroupDSL;
import io.fabric8.tekton.client.dsl.V1beta1APIGroupDSL;

Expand All @@ -34,6 +35,7 @@ public TektonClient adapt(Client client) {

@Override
public void registerClients(ClientFactory factory) {
factory.register(V1APIGroupDSL.class, new V1APIGroupClient());
factory.register(V1beta1APIGroupDSL.class, new V1beta1APIGroupClient());
factory.register(V1alpha1APIGroupDSL.class, new V1alpha1APIGroupClient());
}
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,57 @@
/**
* 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.client;

import io.fabric8.kubernetes.client.dsl.MixedOperation;
import io.fabric8.kubernetes.client.dsl.Resource;
import io.fabric8.kubernetes.client.extension.ClientAdapter;
import io.fabric8.tekton.client.dsl.V1APIGroupDSL;
import io.fabric8.tekton.pipeline.v1.Pipeline;
import io.fabric8.tekton.pipeline.v1.PipelineList;
import io.fabric8.tekton.pipeline.v1.PipelineRun;
import io.fabric8.tekton.pipeline.v1.PipelineRunList;
import io.fabric8.tekton.pipeline.v1.Task;
import io.fabric8.tekton.pipeline.v1.TaskList;
import io.fabric8.tekton.pipeline.v1.TaskRun;
import io.fabric8.tekton.pipeline.v1.TaskRunList;

public class V1APIGroupClient extends ClientAdapter<V1APIGroupClient> implements V1APIGroupDSL {

@Override
public V1APIGroupClient newInstance() {
return new V1APIGroupClient();
}

@Override
public MixedOperation<Pipeline, PipelineList, Resource<Pipeline>> pipelines() {
return resources(Pipeline.class, PipelineList.class);
}

@Override
public MixedOperation<PipelineRun, PipelineRunList, Resource<PipelineRun>> pipelineRuns() {
return resources(PipelineRun.class, PipelineRunList.class);
}

@Override
public MixedOperation<Task, TaskList, Resource<Task>> tasks() {
return resources(Task.class, TaskList.class);
}

@Override
public MixedOperation<TaskRun, TaskRunList, Resource<TaskRun>> taskRuns() {
return resources(TaskRun.class, TaskRunList.class);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -20,20 +20,6 @@
import io.fabric8.kubernetes.client.dsl.Resource;
import io.fabric8.kubernetes.client.extension.ClientAdapter;
import io.fabric8.tekton.client.dsl.V1alpha1APIGroupDSL;
import io.fabric8.tekton.pipeline.v1alpha1.ClusterTask;
import io.fabric8.tekton.pipeline.v1alpha1.ClusterTaskList;
import io.fabric8.tekton.pipeline.v1alpha1.Condition;
import io.fabric8.tekton.pipeline.v1alpha1.ConditionList;
import io.fabric8.tekton.pipeline.v1alpha1.Pipeline;
import io.fabric8.tekton.pipeline.v1alpha1.PipelineList;
import io.fabric8.tekton.pipeline.v1alpha1.PipelineRun;
import io.fabric8.tekton.pipeline.v1alpha1.PipelineRunList;
import io.fabric8.tekton.pipeline.v1alpha1.Task;
import io.fabric8.tekton.pipeline.v1alpha1.TaskList;
import io.fabric8.tekton.pipeline.v1alpha1.TaskRun;
import io.fabric8.tekton.pipeline.v1alpha1.TaskRunList;
import io.fabric8.tekton.resource.v1alpha1.PipelineResource;
import io.fabric8.tekton.resource.v1alpha1.PipelineResourceList;
import io.fabric8.tekton.triggers.v1alpha1.ClusterInterceptor;
import io.fabric8.tekton.triggers.v1alpha1.ClusterInterceptorList;
import io.fabric8.tekton.triggers.v1alpha1.ClusterTriggerBinding;
Expand All @@ -54,36 +40,6 @@ public V1alpha1APIGroupClient newInstance() {
return new V1alpha1APIGroupClient();
}

@Override
public MixedOperation<Pipeline, PipelineList, Resource<Pipeline>> pipelines() {
return resources(Pipeline.class, PipelineList.class);
}

@Override
public MixedOperation<PipelineRun, PipelineRunList, Resource<PipelineRun>> pipelineRuns() {
return resources(PipelineRun.class, PipelineRunList.class);
}

@Override
public MixedOperation<PipelineResource, PipelineResourceList, Resource<PipelineResource>> pipelineResources() {
return resources(PipelineResource.class, PipelineResourceList.class);
}

@Override
public MixedOperation<Task, TaskList, Resource<Task>> tasks() {
return resources(Task.class, TaskList.class);
}

@Override
public MixedOperation<TaskRun, TaskRunList, Resource<TaskRun>> taskRuns() {
return resources(TaskRun.class, TaskRunList.class);
}

@Override
public MixedOperation<Condition, ConditionList, Resource<Condition>> conditions() {
return resources(Condition.class, ConditionList.class);
}

@Override
public MixedOperation<TriggerTemplate, TriggerTemplateList, Resource<TriggerTemplate>> triggerTemplates() {
return resources(TriggerTemplate.class, TriggerTemplateList.class);
Expand All @@ -104,11 +60,6 @@ public MixedOperation<EventListener, EventListenerList, Resource<EventListener>>
return resources(EventListener.class, EventListenerList.class);
}

@Override
public NonNamespaceOperation<ClusterTask, ClusterTaskList, Resource<ClusterTask>> clusterTasks() {
return resources(ClusterTask.class, ClusterTaskList.class);
}

@Override
public NonNamespaceOperation<ClusterTriggerBinding, ClusterTriggerBindingList, Resource<ClusterTriggerBinding>> clusterTriggerBindings() {
return resources(ClusterTriggerBinding.class, ClusterTriggerBindingList.class);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,8 @@
import io.fabric8.tekton.client.dsl.V1beta1APIGroupDSL;
import io.fabric8.tekton.pipeline.v1beta1.ClusterTask;
import io.fabric8.tekton.pipeline.v1beta1.ClusterTaskList;
import io.fabric8.tekton.pipeline.v1beta1.CustomRun;
import io.fabric8.tekton.pipeline.v1beta1.CustomRunList;
import io.fabric8.tekton.pipeline.v1beta1.Pipeline;
import io.fabric8.tekton.pipeline.v1beta1.PipelineList;
import io.fabric8.tekton.pipeline.v1beta1.PipelineRun;
Expand Down Expand Up @@ -68,6 +70,11 @@ public MixedOperation<TaskRun, TaskRunList, Resource<TaskRun>> taskRuns() {
return resources(TaskRun.class, TaskRunList.class);
}

@Override
public MixedOperation<CustomRun, CustomRunList, Resource<CustomRun>> customRuns() {
return resources(CustomRun.class, CustomRunList.class);
}

@Override
public NonNamespaceOperation<ClusterTask, ClusterTaskList, Resource<ClusterTask>> clusterTasks() {
return resources(ClusterTask.class, ClusterTaskList.class);
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,58 @@
/**
* 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.client.dsl;

import io.fabric8.kubernetes.client.Client;
import io.fabric8.kubernetes.client.dsl.MixedOperation;
import io.fabric8.kubernetes.client.dsl.Resource;
import io.fabric8.tekton.pipeline.v1.Pipeline;
import io.fabric8.tekton.pipeline.v1.PipelineList;
import io.fabric8.tekton.pipeline.v1.PipelineRun;
import io.fabric8.tekton.pipeline.v1.PipelineRunList;
import io.fabric8.tekton.pipeline.v1.Task;
import io.fabric8.tekton.pipeline.v1.TaskList;
import io.fabric8.tekton.pipeline.v1.TaskRun;
import io.fabric8.tekton.pipeline.v1.TaskRunList;

public interface V1APIGroupDSL extends Client {
/**
* API entrypoint for Pipeline(tekton.dev/v1)
*
* @return MixedOperation for Pipeline class
*/
MixedOperation<Pipeline, PipelineList, Resource<Pipeline>> pipelines();

/**
* API entrypoint for PipelineRun(tekton.dev/v1)
*
* @return MixedOperation for PipelineRun class
*/
MixedOperation<PipelineRun, PipelineRunList, Resource<PipelineRun>> pipelineRuns();

/**
* API entrypoint for Task(tekton.dev/v1)
*
* @return MixedOperation for Task class
*/
MixedOperation<Task, TaskList, Resource<Task>> tasks();

/**
* API entrypoint for TaskRun(tekton.dev/v1)
*
* @return MixedOperation for TaskRun class
*/
MixedOperation<TaskRun, TaskRunList, Resource<TaskRun>> taskRuns();
}
Original file line number Diff line number Diff line change
Expand Up @@ -19,65 +19,9 @@
import io.fabric8.kubernetes.client.dsl.MixedOperation;
import io.fabric8.kubernetes.client.dsl.NonNamespaceOperation;
import io.fabric8.kubernetes.client.dsl.Resource;
import io.fabric8.tekton.pipeline.v1alpha1.ClusterTask;
import io.fabric8.tekton.pipeline.v1alpha1.ClusterTaskList;
import io.fabric8.tekton.pipeline.v1alpha1.Condition;
import io.fabric8.tekton.pipeline.v1alpha1.ConditionList;
import io.fabric8.tekton.pipeline.v1alpha1.Pipeline;
import io.fabric8.tekton.pipeline.v1alpha1.PipelineList;
import io.fabric8.tekton.pipeline.v1alpha1.PipelineRun;
import io.fabric8.tekton.pipeline.v1alpha1.PipelineRunList;
import io.fabric8.tekton.pipeline.v1alpha1.Task;
import io.fabric8.tekton.pipeline.v1alpha1.TaskList;
import io.fabric8.tekton.pipeline.v1alpha1.TaskRun;
import io.fabric8.tekton.pipeline.v1alpha1.TaskRunList;
import io.fabric8.tekton.resource.v1alpha1.PipelineResource;
import io.fabric8.tekton.resource.v1alpha1.PipelineResourceList;
import io.fabric8.tekton.triggers.v1alpha1.*;

public interface V1alpha1APIGroupDSL extends Client {
/**
* API entrypoint for Pipeline(tekton.dev/v1alpha1)
*
* @return MixedOperation for Pipeline class
*/
MixedOperation<Pipeline, PipelineList, Resource<Pipeline>> pipelines();

/**
* API entrypoint for PipelineRun(tekton.dev/v1alpha1)
*
* @return MixedOperation for PipelineRun class
*/
MixedOperation<PipelineRun, PipelineRunList, Resource<PipelineRun>> pipelineRuns();

/**
* API entrypoint for PipelineResource(tekton.dev/v1alpha1)
*
* @return MixedOperation for PipelineResource class
*/
MixedOperation<PipelineResource, PipelineResourceList, Resource<PipelineResource>> pipelineResources();

/**
* API entrypoint for Task(tekton.dev/v1alpha1)
*
* @return MixedOperation for Task class
*/
MixedOperation<Task, TaskList, Resource<Task>> tasks();

/**
* API entrypoint for TaskRun(tekton.dev/v1alpha1)
*
* @return MixedOperation for TaskRun class
*/
MixedOperation<TaskRun, TaskRunList, Resource<TaskRun>> taskRuns();

/**
* API entrypoint for Condition(tekton.dev/v1alpha1)
*
* @return MixedOperation for Condition class
*/
MixedOperation<Condition, ConditionList, Resource<Condition>> conditions();

/**
* API entrypoint for TriggerTemplate(triggers.tekton.dev/v1alpha1)
*
Expand Down Expand Up @@ -106,13 +50,6 @@ public interface V1alpha1APIGroupDSL extends Client {
*/
MixedOperation<EventListener, EventListenerList, Resource<EventListener>> eventListeners();

/**
* API entrypoint for ClusterTask(tekton.dev/v1alpha1)
*
* @return MixedOperation for ClusterTask class
*/
NonNamespaceOperation<ClusterTask, ClusterTaskList, Resource<ClusterTask>> clusterTasks();

/**
* API entrypoint for ClusterTriggerBinding(triggers.tekton.dev/v1alpha1)
*
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,8 @@
import io.fabric8.kubernetes.client.dsl.Resource;
import io.fabric8.tekton.pipeline.v1beta1.ClusterTask;
import io.fabric8.tekton.pipeline.v1beta1.ClusterTaskList;
import io.fabric8.tekton.pipeline.v1beta1.CustomRun;
import io.fabric8.tekton.pipeline.v1beta1.CustomRunList;
import io.fabric8.tekton.pipeline.v1beta1.Pipeline;
import io.fabric8.tekton.pipeline.v1beta1.PipelineList;
import io.fabric8.tekton.pipeline.v1beta1.PipelineRun;
Expand Down Expand Up @@ -69,6 +71,13 @@ public interface V1beta1APIGroupDSL extends Client {
*/
MixedOperation<TaskRun, TaskRunList, Resource<TaskRun>> taskRuns();

/**
* API entrypoint for CustomRun(tekton.dev/v1beta1)
*
* @return MixedOperation for CustomRun class
*/
MixedOperation<CustomRun, CustomRunList, Resource<CustomRun>> customRuns();

/**
* API entrypoint for ClusterTask(tekton.dev/v1beta1)
*
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ public class PipelineList {
public static void main(String[] args) {
try (TektonClient client = ClientFactory.newClient(args)) {
System.out.println("Pipelines:");
client.v1beta1().pipelines().list().getItems().forEach(System.out::println);
client.v1().pipelines().list().getItems().forEach(System.out::println);
System.out.println("done.");
}
System.exit(0);
Expand Down
Loading

0 comments on commit 32c8c96

Please sign in to comment.