-
Notifications
You must be signed in to change notification settings - Fork 1.8k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
This modify how `TaskRunSpec` looks from v1alpha1: - params is now directly under spec - no more inputs and outputs, get replaced by resources - resource has input and output resource declaration fields, similar to how it is used in Pipeline The next step are : - Add more types (Pipeline, PipelineRun, Condition) - Refactor v1alpha1 to embedded v1alpha2 (for storage purpose) - Auto-conversion from v1alpha1 Signed-off-by: Vincent Demeester <[email protected]>
- Loading branch information
1 parent
eb26f85
commit 99fbc71
Showing
28 changed files
with
2,632 additions
and
37 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
/* | ||
Copyright 2019 The Tekton Authors | ||
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 v1alpha2 | ||
|
||
import "github.com/tektoncd/pipeline/pkg/apis/pipeline/pod" | ||
|
||
// PodTemplate holds pod specific configuration | ||
type PodTemplate = pod.Template |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
/* | ||
Copyright 2019 The Tekton Authors | ||
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 v1alpha2_test |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,63 @@ | ||
/* | ||
Copyright 2019 The Tekton Authors | ||
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 v1alpha2 | ||
|
||
import ( | ||
"context" | ||
"time" | ||
|
||
"github.com/tektoncd/pipeline/pkg/apis/config" | ||
"github.com/tektoncd/pipeline/pkg/contexts" | ||
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" | ||
"knative.dev/pkg/apis" | ||
) | ||
|
||
var _ apis.Defaultable = (*TaskRun)(nil) | ||
|
||
func (tr *TaskRun) SetDefaults(ctx context.Context) { | ||
tr.Spec.SetDefaults(ctx) | ||
} | ||
|
||
func (trs *TaskRunSpec) SetDefaults(ctx context.Context) { | ||
cfg := config.FromContextOrDefaults(ctx) | ||
if trs.TaskRef != nil && trs.TaskRef.Kind == "" { | ||
trs.TaskRef.Kind = NamespacedTaskKind | ||
} | ||
|
||
if trs.Timeout == nil { | ||
var timeout *metav1.Duration | ||
if contexts.IsUpgradeViaDefaulting(ctx) { | ||
// This case is for preexisting `TaskRun` before 0.5.0, so let's | ||
// add the old default timeout. | ||
// Most likely those TaskRun passing here are already done and/or already running | ||
timeout = &metav1.Duration{Duration: config.DefaultTimeoutMinutes * time.Minute} | ||
} else { | ||
timeout = &metav1.Duration{Duration: time.Duration(cfg.Defaults.DefaultTimeoutMinutes) * time.Minute} | ||
} | ||
trs.Timeout = timeout | ||
} | ||
|
||
defaultSA := cfg.Defaults.DefaultServiceAccount | ||
if trs.ServiceAccountName == "" && defaultSA != "" { | ||
trs.ServiceAccountName = defaultSA | ||
} | ||
|
||
// If this taskrun has an embedded task, apply the usual task defaults | ||
if trs.TaskSpec != nil { | ||
trs.TaskSpec.SetDefaults(ctx) | ||
} | ||
} |
Oops, something went wrong.