Skip to content

Commit

Permalink
Ensure taskRef is non nil before setting defaults as this is an optio…
Browse files Browse the repository at this point in the history
…nal parameter
  • Loading branch information
takirala authored and tekton-robot committed Jan 29, 2020
1 parent 2f60a9d commit 9d40d32
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 4 deletions.
6 changes: 4 additions & 2 deletions pkg/apis/pipeline/v1alpha1/pipeline_defaults.go
Original file line number Diff line number Diff line change
Expand Up @@ -30,8 +30,10 @@ func (p *Pipeline) SetDefaults(ctx context.Context) {

func (ps *PipelineSpec) SetDefaults(ctx context.Context) {
for _, pt := range ps.Tasks {
if pt.TaskRef.Kind == "" {
pt.TaskRef.Kind = NamespacedTaskKind
if pt.TaskRef != nil {
if pt.TaskRef.Kind == "" {
pt.TaskRef.Kind = NamespacedTaskKind
}
}
}
for i := range ps.Params {
Expand Down
6 changes: 4 additions & 2 deletions pkg/apis/pipeline/v1alpha2/pipeline_defaults.go
Original file line number Diff line number Diff line change
Expand Up @@ -30,8 +30,10 @@ func (p *Pipeline) SetDefaults(ctx context.Context) {

func (ps *PipelineSpec) SetDefaults(ctx context.Context) {
for _, pt := range ps.Tasks {
if pt.TaskRef.Kind == "" {
pt.TaskRef.Kind = NamespacedTaskKind
if pt.TaskRef != nil {
if pt.TaskRef.Kind == "" {
pt.TaskRef.Kind = NamespacedTaskKind
}
}
}
for i := range ps.Params {
Expand Down

0 comments on commit 9d40d32

Please sign in to comment.