Skip to content

Commit

Permalink
fix: Define default values for the contextPath or ModuleDirName when …
Browse files Browse the repository at this point in the history
…not defined by BuilConfig. #147
  • Loading branch information
cmoulliard committed Sep 11, 2019
1 parent daa48a5 commit 88998cf
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 2 deletions.
18 changes: 18 additions & 0 deletions pkg/controller/component/helpers.go
Original file line number Diff line number Diff line change
Expand Up @@ -98,6 +98,24 @@ func (r *ReconcileComponent) baseImage(c *controller.Component) string {
}
}

func (r *ReconcileComponent) contextPath(c *controller.Component) string {
if c.Spec.BuildConfig.ContextPath != "" {
return c.Spec.BuildConfig.ContextPath
} else {
// We return the default value as defined within the Task
return "."
}
}

func (r *ReconcileComponent) moduleDirName(c *controller.Component) string {
if c.Spec.BuildConfig.ModuleDirName != "" {
return c.Spec.BuildConfig.ModuleDirName
} else {
// We return the default value as defined within the Task
return "."
}
}

func (r *ReconcileComponent) gitRevision(c *controller.Component) string {
if c.Spec.BuildConfig.Ref == "" {
return "master"
Expand Down
4 changes: 2 additions & 2 deletions pkg/controller/component/taskruns.go
Original file line number Diff line number Diff line change
Expand Up @@ -49,8 +49,8 @@ func (res taskRun) Build() (runtime.Object, error) {
// See description of the parameters within the Tasks
// We only override parameters here. Defaults are defined within the Tasks
{Name: "baseImage", Value: res.reconciler.baseImage(c)},
{Name: "moduleDirName", Value: c.Spec.BuildConfig.ModuleDirName},
{Name: "contextPath", Value: c.Spec.BuildConfig.ContextPath},
{Name: "moduleDirName", Value: res.reconciler.moduleDirName(c)},
{Name: "contextPath", Value: res.reconciler.contextPath(c)},
},
Resources: []v1alpha1.TaskResourceBinding{
{
Expand Down

0 comments on commit 88998cf

Please sign in to comment.