Skip to content

Commit

Permalink
WIP:
Browse files Browse the repository at this point in the history
  • Loading branch information
dibyom committed Jul 1, 2019
1 parent e2b5f96 commit af090f0
Show file tree
Hide file tree
Showing 4 changed files with 40 additions and 8 deletions.
3 changes: 1 addition & 2 deletions examples/pipelineruns/pipelinerun-conditional-setup.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -39,8 +39,7 @@ spec:
taskRef:
name: list-files
conditions:
- name:
conditionRef: stringsEqual
- conditionRef: stringsEqual
params:
- name: expected
value: master
Expand Down
4 changes: 2 additions & 2 deletions examples/pipelineruns/pipelinerun.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ spec:
type: image
params:
- name: url
value: gcr.io/christiewilson-catfactory/leeroy-app
value: gcr.io/dibyo-spinnaker-dev/leeroy-app
---
# This demo modifies the cluster (deploys to it) you must use a service
# account with permission to admin the cluster (or make your default user an admin
Expand All @@ -34,7 +34,7 @@ spec:
type: image
params:
- name: url
value: gcr.io/christiewilson-catfactory/leeroy-web
value: gcr.io/dibyo-spinnaker-dev/leeroy-web
---
apiVersion: tekton.dev/v1alpha1
kind: PipelineResource
Expand Down
37 changes: 35 additions & 2 deletions pkg/apis/pipeline/v1alpha1/condition_types.go
Original file line number Diff line number Diff line change
@@ -1,17 +1,50 @@
package v1alpha1

import(
"github.com/knative/pkg/apis"
corev1 "k8s.io/api/core/v1"
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
)

// Add validation for TaskConditions?
type TaskCondition struct {
Name string `json:"name"`
// TODO: ref should probably be its own type with kind + version
ConditionRef string `json:"conditionRef"`
// +optional
Params []Param `json:"params,omitempty"`
}

// Check that Task may be validated and defaulted.
var _ apis.Validatable = (*Task)(nil)
var _ apis.Defaultable = (*Task)(nil)


// Task represents a collection of sequential steps that are run as part of a
// Pipeline using a set of inputs and producing a set of outputs. Tasks execute
// when TaskRuns are created that provide the input parameters and resources and
// output resources the Task requires.
//
// +k8s:openapi-gen=true
type Condition struct {
metav1.TypeMeta `json:",inline"`
// +optional
metav1.ObjectMeta `json:"metadata"`

// Spec holds the desired state of the Condition from the client
// +optional
Spec ConditionSpec `json:"spec"`
// +optional
Status TaskRunStatus `json:"status,omitempty"`
}

type ConditionSpec struct {
// +optional
Params []Param `json:"params,omitempty"`
// Check is a container whose exit code determines where a condition is true or false
Check *corev1.Container `json:"check,omitempty"`
}

type ConditionState struct {
corev1.ContainerState
Name string `json:"name,omitempty"`
}

4 changes: 2 additions & 2 deletions pkg/reconciler/v1alpha1/pipelinerun/pipelinerun.go
Original file line number Diff line number Diff line change
Expand Up @@ -514,8 +514,8 @@ func (c *Reconciler) createTaskRun(logger *zap.SugaredLogger, rprt *resources.Re
NodeSelector: pr.Spec.NodeSelector,
Tolerations: pr.Spec.Tolerations,
Affinity: pr.Spec.Affinity,
},
}
Conditions: rprt.PipelineTask.Conditions, // TODO: Validate + Resolve conditionRef
}}

resources.WrapSteps(&tr.Spec, rprt.PipelineTask, rprt.ResolvedTaskResources.Inputs, rprt.ResolvedTaskResources.Outputs, storageBasePath)

Expand Down

0 comments on commit af090f0

Please sign in to comment.