Repository: jenkins-x/lighthouse
Pull request #1142 (2020-11-02 10:18:50)

fix: add comment on PR if we cannot create Agent
as its probably caused by a bad `triggers.yaml` file in the Pull Request

jenkins-x-bot: [APPROVALNOTIFIER] This PR is **NOT APPROVED**

This pull-request has been approved by:
To complete the [pull request process](https://git.k8s.io/community/contributors/guide/owners.md#the-code-review-process), please assign **jstrachan**
You can assign the PR to them by writing `/assign @jstrachan` in a comment when ready.

The full list of commands accepted by this bot can be found [here](https://go.k8s.io/bot-commands?repo=jenkins-x%2Flighthouse).

<details open>
Needs approval from an approver in each of these files:

- **[OWNERS](https://github.com/jenkins-x/lighthouse/blob/master/OWNERS)**

Approvers can indicate their approval by writing `/approve` in a comment
Approvers can cancel approval by writing `/approve cancel` in a comment
</details>
<!-- META={"approvers":["jstrachan"]} -->
jenkins-x-bot: @jstrachan: The following test **failed**, say `/retest` to rerun them all:

Test name | Commit | Details | Rerun command
--- | --- | --- | ---
jenkins | 6dfd210e893bb69fa2ba38625115bcfb097443b9 | [link](https://dashboard-jx.jenkins-x.live/teams/jx/projects/jenkins-x/lighthouse/PR-1142/4) | `/test jenkins`

[View all Builds for this Pull Request](https://dashboard-jx.jenkins-x.live/teams/jx/projects/jenkins-x/lighthouse/PR-1142) 

<details>

Instructions for interacting with me using PR comments are available [here](https://git.k8s.io/community/contributors/guide/pull-requests.md).  If you have questions or suggestions related to my behavior, please file an issue against the [jenkins-x/lighthouse](https://github.com/jenkins-x/lighthouse/issues/new?title=Command%20issue:) repository. I understand the commands that are listed [here](https://go.k8s.io/bot-commands).
</details>
<!-- test report -->
jenkins-x-bot: @jstrachan: The following test **failed**, say `/retest` to rerun them all:

Test name | Commit | Details | Rerun command
--- | --- | --- | ---
ghe | 850ae39f7ca7bbaa78065ebc958901576e6fc622 | [link](https://dashboard-jx.jenkins-x.live/teams/jx/projects/jenkins-x/lighthouse/PR-1142/7) | `/test ghe`

[View all Builds for this Pull Request](https://dashboard-jx.jenkins-x.live/teams/jx/projects/jenkins-x/lighthouse/PR-1142) 

<details>

Instructions for interacting with me using PR comments are available [here](https://git.k8s.io/community/contributors/guide/pull-requests.md).  If you have questions or suggestions related to my behavior, please file an issue against the [jenkins-x/lighthouse](https://github.com/jenkins-x/lighthouse/issues/new?title=Command%20issue:) repository. I understand the commands that are listed [here](https://go.k8s.io/bot-commands).
</details>
<!-- test report -->
jenkins-x-bot: @jstrachan: The following tests **failed**, say `/retest` to rerun them all:

Test name | Commit | Details | Rerun command
--- | --- | --- | ---
ghe | 850ae39f7ca7bbaa78065ebc958901576e6fc622 | [link](https://dashboard-jx.jenkins-x.live/teams/jx/projects/jenkins-x/lighthouse/PR-1142/7) | `/test ghe`
jenkins | 52175e3645e3e5263557ded7c5c72d5471681e25 | [link](https://dashboard-jx.jenkins-x.live/teams/jx/projects/jenkins-x/lighthouse/PR-1142/14) | `/test jenkins`

[View all Builds for this Pull Request](https://dashboard-jx.jenkins-x.live/teams/jx/projects/jenkins-x/lighthouse/PR-1142) 

<details>

Instructions for interacting with me using PR comments are available [here](https://git.k8s.io/community/contributors/guide/pull-requests.md).  If you have questions or suggestions related to my behavior, please file an issue against the [jenkins-x/lighthouse](https://github.com/jenkins-x/lighthouse/issues/new?title=Command%20issue:) repository. I understand the commands that are listed [here](https://go.k8s.io/bot-commands).
</details>
<!-- test report -->
jenkins-x-bot: @jstrachan: The following test **failed**, say `/retest` to rerun them all:

Test name | Commit | Details | Rerun command
--- | --- | --- | ---
jenkins | dea40ac97ed9d4c59c84416748e5d9bc23ea8a1b | [link](https://dashboard-jx.jenkins-x.live/teams/jx/projects/jenkins-x/lighthouse/PR-1142/19) | `/test jenkins`

[View all Builds for this Pull Request](https://dashboard-jx.jenkins-x.live/teams/jx/projects/jenkins-x/lighthouse/PR-1142) 

<details>

Instructions for interacting with me using PR comments are available [here](https://git.k8s.io/community/contributors/guide/pull-requests.md).  If you have questions or suggestions related to my behavior, please file an issue against the [jenkins-x/lighthouse](https://github.com/jenkins-x/lighthouse/issues/new?title=Command%20issue:) repository. I understand the commands that are listed [here](https://go.k8s.io/bot-commands).
</details>
<!-- test report -->
jenkins-x-bot: @jstrachan: The following tests **failed**, say `/retest` to rerun them all:

Test name | Commit | Details | Rerun command
--- | --- | --- | ---
jenkins | dea40ac97ed9d4c59c84416748e5d9bc23ea8a1b | [link](https://dashboard-jx.jenkins-x.live/teams/jx/projects/jenkins-x/lighthouse/PR-1142/19) | `/test jenkins`
bbs | 850ae39f7ca7bbaa78065ebc958901576e6fc622 | [link](https://dashboard-jx.jenkins-x.live/teams/jx/projects/jenkins-x/lighthouse/PR-1142/8) | `/test bbs`

[View all Builds for this Pull Request](https://dashboard-jx.jenkins-x.live/teams/jx/projects/jenkins-x/lighthouse/PR-1142) 

<details>

Instructions for interacting with me using PR comments are available [here](https://git.k8s.io/community/contributors/guide/pull-requests.md).  If you have questions or suggestions related to my behavior, please file an issue against the [jenkins-x/lighthouse](https://github.com/jenkins-x/lighthouse/issues/new?title=Command%20issue:) repository. I understand the commands that are listed [here](https://go.k8s.io/bot-commands).
</details>
<!-- test report -->
jenkins-x-bot: @jstrachan: The following tests **failed**, say `/retest` to rerun them all:

Test name | Commit | Details | Rerun command
--- | --- | --- | ---
jenkins | dea40ac97ed9d4c59c84416748e5d9bc23ea8a1b | [link](https://dashboard-jx.jenkins-x.live/teams/jx/projects/jenkins-x/lighthouse/PR-1142/19) | `/test jenkins`
bbs | 52175e3645e3e5263557ded7c5c72d5471681e25 | [link](https://dashboard-jx.jenkins-x.live/teams/jx/projects/jenkins-x/lighthouse/PR-1142/13) | `/test bbs`

[View all Builds for this Pull Request](https://dashboard-jx.jenkins-x.live/teams/jx/projects/jenkins-x/lighthouse/PR-1142) 

<details>

Instructions for interacting with me using PR comments are available [here](https://git.k8s.io/community/contributors/guide/pull-requests.md).  If you have questions or suggestions related to my behavior, please file an issue against the [jenkins-x/lighthouse](https://github.com/jenkins-x/lighthouse/issues/new?title=Command%20issue:) repository. I understand the commands that are listed [here](https://go.k8s.io/bot-commands).
</details>
<!-- test report -->
jenkins-x-bot: @jstrachan: The following tests **failed**, say `/retest` to rerun them all:

Test name | Commit | Details | Rerun command
--- | --- | --- | ---
jenkins | dea40ac97ed9d4c59c84416748e5d9bc23ea8a1b | [link](https://dashboard-jx.jenkins-x.live/teams/jx/projects/jenkins-x/lighthouse/PR-1142/19) | `/test jenkins`
bbs | dea40ac97ed9d4c59c84416748e5d9bc23ea8a1b | [link](https://dashboard-jx.jenkins-x.live/teams/jx/projects/jenkins-x/lighthouse/PR-1142/18) | `/test bbs`

[View all Builds for this Pull Request](https://dashboard-jx.jenkins-x.live/teams/jx/projects/jenkins-x/lighthouse/PR-1142) 

<details>

Instructions for interacting with me using PR comments are available [here](https://git.k8s.io/community/contributors/guide/pull-requests.md).  If you have questions or suggestions related to my behavior, please file an issue against the [jenkins-x/lighthouse](https://github.com/jenkins-x/lighthouse/issues/new?title=Command%20issue:) repository. I understand the commands that are listed [here](https://go.k8s.io/bot-commands).
</details>
<!-- test report -->
jenkins-x-bot: @jstrachan: The following tests **failed**, say `/retest` to rerun them all:

Test name | Commit | Details | Rerun command
--- | --- | --- | ---
bbs | dea40ac97ed9d4c59c84416748e5d9bc23ea8a1b | [link](https://dashboard-jx.jenkins-x.live/teams/jx/projects/jenkins-x/lighthouse/PR-1142/18) | `/test bbs`
jenkins | 28f31d057b73b5a7a88046db1a5bb1b4312d3177 | [link](https://dashboard-jx.jenkins-x.live/teams/jx/projects/jenkins-x/lighthouse/PR-1142/24) | `/test jenkins`

[View all Builds for this Pull Request](https://dashboard-jx.jenkins-x.live/teams/jx/projects/jenkins-x/lighthouse/PR-1142) 

<details>

Instructions for interacting with me using PR comments are available [here](https://git.k8s.io/community/contributors/guide/pull-requests.md).  If you have questions or suggestions related to my behavior, please file an issue against the [jenkins-x/lighthouse](https://github.com/jenkins-x/lighthouse/issues/new?title=Command%20issue:) repository. I understand the commands that are listed [here](https://go.k8s.io/bot-commands).
</details>
<!-- test report -->
jenkins-x-bot: @jstrachan: The following tests **failed**, say `/retest` to rerun them all:

Test name | Commit | Details | Rerun command
--- | --- | --- | ---
bbs | dea40ac97ed9d4c59c84416748e5d9bc23ea8a1b | [link](https://dashboard-jx.jenkins-x.live/teams/jx/projects/jenkins-x/lighthouse/PR-1142/18) | `/test bbs`
jenkins | 28f31d057b73b5a7a88046db1a5bb1b4312d3177 | [link](https://dashboard-jx.jenkins-x.live/teams/jx/projects/jenkins-x/lighthouse/PR-1142/24) | `/test jenkins`
tekton | dea40ac97ed9d4c59c84416748e5d9bc23ea8a1b | [link](https://dashboard-jx.jenkins-x.live/teams/jx/projects/jenkins-x/lighthouse/PR-1142/20) | `/test tekton`

[View all Builds for this Pull Request](https://dashboard-jx.jenkins-x.live/teams/jx/projects/jenkins-x/lighthouse/PR-1142) 

<details>

Instructions for interacting with me using PR comments are available [here](https://git.k8s.io/community/contributors/guide/pull-requests.md).  If you have questions or suggestions related to my behavior, please file an issue against the [jenkins-x/lighthouse](https://github.com/jenkins-x/lighthouse/issues/new?title=Command%20issue:) repository. I understand the commands that are listed [here](https://go.k8s.io/bot-commands).
</details>
<!-- test report -->
jenkins-x-bot: @jstrachan: The following tests **failed**, say `/retest` to rerun them all:

Test name | Commit | Details | Rerun command
--- | --- | --- | ---
bbs | dea40ac97ed9d4c59c84416748e5d9bc23ea8a1b | [link](https://dashboard-jx.jenkins-x.live/teams/jx/projects/jenkins-x/lighthouse/PR-1142/18) | `/test bbs`
jenkins | 28f31d057b73b5a7a88046db1a5bb1b4312d3177 | [link](https://dashboard-jx.jenkins-x.live/teams/jx/projects/jenkins-x/lighthouse/PR-1142/24) | `/test jenkins`
tekton | dea40ac97ed9d4c59c84416748e5d9bc23ea8a1b | [link](https://dashboard-jx.jenkins-x.live/teams/jx/projects/jenkins-x/lighthouse/PR-1142/20) | `/test tekton`
ghe | dea40ac97ed9d4c59c84416748e5d9bc23ea8a1b | [link](https://dashboard-jx.jenkins-x.live/teams/jx/projects/jenkins-x/lighthouse/PR-1142/17) | `/test ghe`

[View all Builds for this Pull Request](https://dashboard-jx.jenkins-x.live/teams/jx/projects/jenkins-x/lighthouse/PR-1142) 

<details>

Instructions for interacting with me using PR comments are available [here](https://git.k8s.io/community/contributors/guide/pull-requests.md).  If you have questions or suggestions related to my behavior, please file an issue against the [jenkins-x/lighthouse](https://github.com/jenkins-x/lighthouse/issues/new?title=Command%20issue:) repository. I understand the commands that are listed [here](https://go.k8s.io/bot-commands).
</details>
<!-- test report -->
jenkins-x-bot: @jstrachan: The following tests **failed**, say `/retest` to rerun them all:

Test name | Commit | Details | Rerun command
--- | --- | --- | ---
jenkins | 28f31d057b73b5a7a88046db1a5bb1b4312d3177 | [link](https://dashboard-jx.jenkins-x.live/teams/jx/projects/jenkins-x/lighthouse/PR-1142/24) | `/test jenkins`
tekton | dea40ac97ed9d4c59c84416748e5d9bc23ea8a1b | [link](https://dashboard-jx.jenkins-x.live/teams/jx/projects/jenkins-x/lighthouse/PR-1142/20) | `/test tekton`
ghe | dea40ac97ed9d4c59c84416748e5d9bc23ea8a1b | [link](https://dashboard-jx.jenkins-x.live/teams/jx/projects/jenkins-x/lighthouse/PR-1142/17) | `/test ghe`
bbs | 28f31d057b73b5a7a88046db1a5bb1b4312d3177 | [link](https://dashboard-jx.jenkins-x.live/teams/jx/projects/jenkins-x/lighthouse/PR-1142/23) | `/test bbs`

[View all Builds for this Pull Request](https://dashboard-jx.jenkins-x.live/teams/jx/projects/jenkins-x/lighthouse/PR-1142) 

<details>

Instructions for interacting with me using PR comments are available [here](https://git.k8s.io/community/contributors/guide/pull-requests.md).  If you have questions or suggestions related to my behavior, please file an issue against the [jenkins-x/lighthouse](https://github.com/jenkins-x/lighthouse/issues/new?title=Command%20issue:) repository. I understand the commands that are listed [here](https://go.k8s.io/bot-commands).
</details>
<!-- test report -->
jenkins-x-bot: @jstrachan: The following test **failed**, say `/retest` to rerun them all:

Test name | Commit | Details | Rerun command
--- | --- | --- | ---
ghe | 28f31d057b73b5a7a88046db1a5bb1b4312d3177 | [link](https://dashboard-jx.jenkins-x.live/teams/jx/projects/jenkins-x/lighthouse/PR-1142/22) | `/test ghe`

[View all Builds for this Pull Request](https://dashboard-jx.jenkins-x.live/teams/jx/projects/jenkins-x/lighthouse/PR-1142) 

<details>

Instructions for interacting with me using PR comments are available [here](https://git.k8s.io/community/contributors/guide/pull-requests.md).  If you have questions or suggestions related to my behavior, please file an issue against the [jenkins-x/lighthouse](https://github.com/jenkins-x/lighthouse/issues/new?title=Command%20issue:) repository. I understand the commands that are listed [here](https://go.k8s.io/bot-commands).
</details>
<!-- test report -->

Patch:
diff --git a/pkg/triggerconfig/inrepo/default_parameters.go b/pkg/triggerconfig/inrepo/default_parameters.go
index 1356763b..5956397e 100644
--- a/pkg/triggerconfig/inrepo/default_parameters.go
+++ b/pkg/triggerconfig/inrepo/default_parameters.go
@@ -45,16 +45,28 @@ var (
 			Description: "git pull request number",
 			Name:        "PULL_NUMBER",
 			Type:        "string",
+			Default: &v1beta1.ArrayOrString{
+				Type:      v1beta1.ParamTypeString,
+				StringVal: "",
+			},
 		},
 		{
 			Description: "git pull request ref in the form 'refs/pull/$PULL_NUMBER/head'",
 			Name:        "PULL_PULL_REF",
 			Type:        "string",
+			Default: &v1beta1.ArrayOrString{
+				Type:      v1beta1.ParamTypeString,
+				StringVal: "",
+			},
 		},
 		{
 			Description: "git revision to checkout (branch, tag, sha, ref…)",
 			Name:        "PULL_PULL_SHA",
 			Type:        "string",
+			Default: &v1beta1.ArrayOrString{
+				Type:      v1beta1.ParamTypeString,
+				StringVal: "",
+			},
 		},
 		{
 			Description: "git pull reference strings of base and latest in the form 'master:$PULL_BASE_SHA,$PULL_NUMBER:$PULL_PULL_SHA:refs/pull/$PULL_NUMBER/head'",
diff --git a/pkg/triggerconfig/inrepo/load_triggers.go b/pkg/triggerconfig/inrepo/load_triggers.go
index 0d297972..8515e5e8 100644
--- a/pkg/triggerconfig/inrepo/load_triggers.go
+++ b/pkg/triggerconfig/inrepo/load_triggers.go
@@ -117,7 +117,7 @@ func loadConfigFile(client scmProviderClient, ownerName, repoName, path, sha str
 		if r.SourcePath != "" {
 			err = loadJobBaseFromSourcePath(client, &r.Base, ownerName, repoName, filepath.Join(dir, r.SourcePath), sha)
 			if err != nil {
-				return nil, errors.Wrapf(err, "failed to load Source for Presubmit %d", i)
+				return nil, errors.Wrapf(err, "failed to load source for presubmit %s", r.Name)
 			}
 
 		}
@@ -130,7 +130,7 @@ func loadConfigFile(client scmProviderClient, ownerName, repoName, path, sha str
 		if r.SourcePath != "" {
 			err = loadJobBaseFromSourcePath(client, &r.Base, ownerName, repoName, filepath.Join(dir, r.SourcePath), sha)
 			if err != nil {
-				return nil, errors.Wrapf(err, "failed to load Source for Presubmit %d", i)
+				return nil, errors.Wrapf(err, "failed to load source for postsubmit %s", r.Name)
 			}
 		}
 		if r.Agent == "" && r.PipelineRunSpec != nil {
diff --git a/pkg/util/error_markdown.go b/pkg/util/error_markdown.go
new file mode 100644
index 00000000..21888161
--- /dev/null
+++ b/pkg/util/error_markdown.go
@@ -0,0 +1,35 @@
+package util
+
+import (
+	"strings"
+)
+
+const loadFilePrefix = "failed to load file "
+
+// ErrorToMarkdown converts an error to markdown text so we can include it on a Pull Request comment
+func ErrorToMarkdown(err error, fileLink string) string {
+	lines := strings.Split(err.Error(), ": ")
+
+	// lets convert files to links
+	if fileLink != "" {
+		for i := range lines {
+			line := lines[i]
+			if strings.HasPrefix(line, loadFilePrefix) {
+				remain := line[len(loadFilePrefix):]
+				if remain == "" {
+					continue
+				}
+				words := strings.Split(remain, " ")
+				fileName := words[0]
+				if len(fileName) == 0 {
+					continue
+				}
+				rest := remain[len(fileName):]
+				lines[i] = loadFilePrefix + "[" + fileName + "](" + fileLink + fileName + ")" + rest
+			}
+		}
+	}
+
+	// now lets convert them all to markdown
+	return "* " + strings.Join(lines, "\n* ") + "\n"
+}
diff --git a/pkg/webhook/events.go b/pkg/webhook/events.go
index e3adc125..01b353d9 100644
--- a/pkg/webhook/events.go
+++ b/pkg/webhook/events.go
@@ -27,6 +27,7 @@ import (
 	"github.com/jenkins-x/lighthouse/pkg/config"
 	"github.com/jenkins-x/lighthouse/pkg/plugins"
 	"github.com/jenkins-x/lighthouse/pkg/scmprovider"
+	"github.com/jenkins-x/lighthouse/pkg/util"
 	"github.com/sirupsen/logrus"
 )
 
@@ -220,6 +221,9 @@ func (s *Server) handlePullRequestEvent(l *logrus.Entry, pr *scm.PullRequestHook
 				agent, err := s.CreateAgent(l, p, repo.Namespace, repo.Name, pr.PullRequest.Sha)
 				if err != nil {
 					agent.Logger.WithError(err).Error("Error creating agent for PullRequestEvent.")
+
+					// the error could be related to a bad local triggers.yaml change so lets comment on the Pull Request
+					s.reportErrorToPullRequest(l, agent, repo, pr, err)
 					return
 				}
 				agent.InitializeCommentPruner(
@@ -323,6 +327,16 @@ func (s *Server) handleReviewEvent(l *logrus.Entry, re scm.ReviewHook) {
 	)
 }
 
+func (s *Server) reportErrorToPullRequest(l *logrus.Entry, agent plugins.Agent, repo scm.Repository, pr *scm.PullRequestHook, err error) {
+	fileLink := repo.Link + "/blob/" + pr.PullRequest.Sha + "/"
+	message := "failed to trigger Pull Request pipeline\n" + util.ErrorToMarkdown(err, fileLink)
+
+	err = agent.SCMProviderClient.CreateComment(repo.Namespace, repo.Name, pr.PullRequest.Number, true, message)
+	if err != nil {
+		l.WithError(err).Errorf("failed to comment the failure on Pull Request")
+	}
+}
+
 func actionRelatesToPullRequestComment(action scm.Action, l *logrus.Entry) bool {
 	switch action {
 


Test patch:
diff --git a/pkg/triggerconfig/inrepo/test_data/load_pipelinerun/pipeline-load-refs-sub-dir/expected.yaml b/pkg/triggerconfig/inrepo/test_data/load_pipelinerun/pipeline-load-refs-sub-dir/expected.yaml
index c92898a9..092cc04c 100644
--- a/pkg/triggerconfig/inrepo/test_data/load_pipelinerun/pipeline-load-refs-sub-dir/expected.yaml
+++ b/pkg/triggerconfig/inrepo/test_data/load_pipelinerun/pipeline-load-refs-sub-dir/expected.yaml
@@ -28,13 +28,16 @@ spec:
     - description: the git sha of the base of the pull request
       name: PULL_BASE_SHA
       type: string
-    - description: git pull request number
+    - default: ""
+      description: git pull request number
       name: PULL_NUMBER
       type: string
-    - description: git pull request ref in the form 'refs/pull/$PULL_NUMBER/head'
+    - default: ""
+      description: git pull request ref in the form 'refs/pull/$PULL_NUMBER/head'
       name: PULL_PULL_REF
       type: string
-    - description: git revision to checkout (branch, tag, sha, ref…)
+    - default: ""
+      description: git revision to checkout (branch, tag, sha, ref…)
       name: PULL_PULL_SHA
       type: string
     - description: git pull reference strings of base and latest in the form 'master:$PULL_BASE_SHA,$PULL_NUMBER:$PULL_PULL_SHA:refs/pull/$PULL_NUMBER/head'
@@ -129,13 +132,16 @@ spec:
         - description: the git sha of the base of the pull request
           name: PULL_BASE_SHA
           type: string
-        - description: git pull request number
+        - default: ""
+          description: git pull request number
           name: PULL_NUMBER
           type: string
-        - description: git pull request ref in the form 'refs/pull/$PULL_NUMBER/head'
+        - default: ""
+          description: git pull request ref in the form 'refs/pull/$PULL_NUMBER/head'
           name: PULL_PULL_REF
           type: string
-        - description: git revision to checkout (branch, tag, sha, ref…)
+        - default: ""
+          description: git revision to checkout (branch, tag, sha, ref…)
           name: PULL_PULL_SHA
           type: string
         - description: git pull reference strings of base and latest in the form 'master:$PULL_BASE_SHA,$PULL_NUMBER:$PULL_PULL_SHA:refs/pull/$PULL_NUMBER/head'
@@ -278,13 +284,16 @@ spec:
         - description: the git sha of the base of the pull request
           name: PULL_BASE_SHA
           type: string
-        - description: git pull request number
+        - default: ""
+          description: git pull request number
           name: PULL_NUMBER
           type: string
-        - description: git pull request ref in the form 'refs/pull/$PULL_NUMBER/head'
+        - default: ""
+          description: git pull request ref in the form 'refs/pull/$PULL_NUMBER/head'
           name: PULL_PULL_REF
           type: string
-        - description: git revision to checkout (branch, tag, sha, ref…)
+        - default: ""
+          description: git revision to checkout (branch, tag, sha, ref…)
           name: PULL_PULL_SHA
           type: string
         - description: git pull reference strings of base and latest in the form 'master:$PULL_BASE_SHA,$PULL_NUMBER:$PULL_PULL_SHA:refs/pull/$PULL_NUMBER/head'
@@ -418,13 +427,16 @@ spec:
         - description: the git sha of the base of the pull request
           name: PULL_BASE_SHA
           type: string
-        - description: git pull request number
+        - default: ""
+          description: git pull request number
           name: PULL_NUMBER
           type: string
-        - description: git pull request ref in the form 'refs/pull/$PULL_NUMBER/head'
+        - default: ""
+          description: git pull request ref in the form 'refs/pull/$PULL_NUMBER/head'
           name: PULL_PULL_REF
           type: string
-        - description: git revision to checkout (branch, tag, sha, ref…)
+        - default: ""
+          description: git revision to checkout (branch, tag, sha, ref…)
           name: PULL_PULL_SHA
           type: string
         - description: git pull reference strings of base and latest in the form 'master:$PULL_BASE_SHA,$PULL_NUMBER:$PULL_PULL_SHA:refs/pull/$PULL_NUMBER/head'
@@ -579,13 +591,16 @@ spec:
         - description: the git sha of the base of the pull request
           name: PULL_BASE_SHA
           type: string
-        - description: git pull request number
+        - default: ""
+          description: git pull request number
           name: PULL_NUMBER
           type: string
-        - description: git pull request ref in the form 'refs/pull/$PULL_NUMBER/head'
+        - default: ""
+          description: git pull request ref in the form 'refs/pull/$PULL_NUMBER/head'
           name: PULL_PULL_REF
           type: string
-        - description: git revision to checkout (branch, tag, sha, ref…)
+        - default: ""
+          description: git revision to checkout (branch, tag, sha, ref…)
           name: PULL_PULL_SHA
           type: string
         - description: git pull reference strings of base and latest in the form 'master:$PULL_BASE_SHA,$PULL_NUMBER:$PULL_PULL_SHA:refs/pull/$PULL_NUMBER/head'
@@ -735,13 +750,16 @@ spec:
         - description: the git sha of the base of the pull request
           name: PULL_BASE_SHA
           type: string
-        - description: git pull request number
+        - default: ""
+          description: git pull request number
           name: PULL_NUMBER
           type: string
-        - description: git pull request ref in the form 'refs/pull/$PULL_NUMBER/head'
+        - default: ""
+          description: git pull request ref in the form 'refs/pull/$PULL_NUMBER/head'
           name: PULL_PULL_REF
           type: string
-        - description: git revision to checkout (branch, tag, sha, ref…)
+        - default: ""
+          description: git revision to checkout (branch, tag, sha, ref…)
           name: PULL_PULL_SHA
           type: string
         - description: git pull reference strings of base and latest in the form 'master:$PULL_BASE_SHA,$PULL_NUMBER:$PULL_PULL_SHA:refs/pull/$PULL_NUMBER/head'
@@ -877,13 +895,16 @@ spec:
         - description: the git sha of the base of the pull request
           name: PULL_BASE_SHA
           type: string
-        - description: git pull request number
+        - default: ""
+          description: git pull request number
           name: PULL_NUMBER
           type: string
-        - description: git pull request ref in the form 'refs/pull/$PULL_NUMBER/head'
+        - default: ""
+          description: git pull request ref in the form 'refs/pull/$PULL_NUMBER/head'
           name: PULL_PULL_REF
           type: string
-        - description: git revision to checkout (branch, tag, sha, ref…)
+        - default: ""
+          description: git revision to checkout (branch, tag, sha, ref…)
           name: PULL_PULL_SHA
           type: string
         - description: git pull reference strings of base and latest in the form 'master:$PULL_BASE_SHA,$PULL_NUMBER:$PULL_PULL_SHA:refs/pull/$PULL_NUMBER/head'
diff --git a/pkg/triggerconfig/inrepo/test_data/load_pipelinerun/pipeline-load-refs/expected.yaml b/pkg/triggerconfig/inrepo/test_data/load_pipelinerun/pipeline-load-refs/expected.yaml
index c92898a9..092cc04c 100644
--- a/pkg/triggerconfig/inrepo/test_data/load_pipelinerun/pipeline-load-refs/expected.yaml
+++ b/pkg/triggerconfig/inrepo/test_data/load_pipelinerun/pipeline-load-refs/expected.yaml
@@ -28,13 +28,16 @@ spec:
     - description: the git sha of the base of the pull request
       name: PULL_BASE_SHA
       type: string
-    - description: git pull request number
+    - default: ""
+      description: git pull request number
       name: PULL_NUMBER
       type: string
-    - description: git pull request ref in the form 'refs/pull/$PULL_NUMBER/head'
+    - default: ""
+      description: git pull request ref in the form 'refs/pull/$PULL_NUMBER/head'
       name: PULL_PULL_REF
       type: string
-    - description: git revision to checkout (branch, tag, sha, ref…)
+    - default: ""
+      description: git revision to checkout (branch, tag, sha, ref…)
       name: PULL_PULL_SHA
       type: string
     - description: git pull reference strings of base and latest in the form 'master:$PULL_BASE_SHA,$PULL_NUMBER:$PULL_PULL_SHA:refs/pull/$PULL_NUMBER/head'
@@ -129,13 +132,16 @@ spec:
         - description: the git sha of the base of the pull request
           name: PULL_BASE_SHA
           type: string
-        - description: git pull request number
+        - default: ""
+          description: git pull request number
           name: PULL_NUMBER
           type: string
-        - description: git pull request ref in the form 'refs/pull/$PULL_NUMBER/head'
+        - default: ""
+          description: git pull request ref in the form 'refs/pull/$PULL_NUMBER/head'
           name: PULL_PULL_REF
           type: string
-        - description: git revision to checkout (branch, tag, sha, ref…)
+        - default: ""
+          description: git revision to checkout (branch, tag, sha, ref…)
           name: PULL_PULL_SHA
           type: string
         - description: git pull reference strings of base and latest in the form 'master:$PULL_BASE_SHA,$PULL_NUMBER:$PULL_PULL_SHA:refs/pull/$PULL_NUMBER/head'
@@ -278,13 +284,16 @@ spec:
         - description: the git sha of the base of the pull request
           name: PULL_BASE_SHA
           type: string
-        - description: git pull request number
+        - default: ""
+          description: git pull request number
           name: PULL_NUMBER
           type: string
-        - description: git pull request ref in the form 'refs/pull/$PULL_NUMBER/head'
+        - default: ""
+          description: git pull request ref in the form 'refs/pull/$PULL_NUMBER/head'
           name: PULL_PULL_REF
           type: string
-        - description: git revision to checkout (branch, tag, sha, ref…)
+        - default: ""
+          description: git revision to checkout (branch, tag, sha, ref…)
           name: PULL_PULL_SHA
           type: string
         - description: git pull reference strings of base and latest in the form 'master:$PULL_BASE_SHA,$PULL_NUMBER:$PULL_PULL_SHA:refs/pull/$PULL_NUMBER/head'
@@ -418,13 +427,16 @@ spec:
         - description: the git sha of the base of the pull request
           name: PULL_BASE_SHA
           type: string
-        - description: git pull request number
+        - default: ""
+          description: git pull request number
           name: PULL_NUMBER
           type: string
-        - description: git pull request ref in the form 'refs/pull/$PULL_NUMBER/head'
+        - default: ""
+          description: git pull request ref in the form 'refs/pull/$PULL_NUMBER/head'
           name: PULL_PULL_REF
           type: string
-        - description: git revision to checkout (branch, tag, sha, ref…)
+        - default: ""
+          description: git revision to checkout (branch, tag, sha, ref…)
           name: PULL_PULL_SHA
           type: string
         - description: git pull reference strings of base and latest in the form 'master:$PULL_BASE_SHA,$PULL_NUMBER:$PULL_PULL_SHA:refs/pull/$PULL_NUMBER/head'
@@ -579,13 +591,16 @@ spec:
         - description: the git sha of the base of the pull request
           name: PULL_BASE_SHA
           type: string
-        - description: git pull request number
+        - default: ""
+          description: git pull request number
           name: PULL_NUMBER
           type: string
-        - description: git pull request ref in the form 'refs/pull/$PULL_NUMBER/head'
+        - default: ""
+          description: git pull request ref in the form 'refs/pull/$PULL_NUMBER/head'
           name: PULL_PULL_REF
           type: string
-        - description: git revision to checkout (branch, tag, sha, ref…)
+        - default: ""
+          description: git revision to checkout (branch, tag, sha, ref…)
           name: PULL_PULL_SHA
           type: string
         - description: git pull reference strings of base and latest in the form 'master:$PULL_BASE_SHA,$PULL_NUMBER:$PULL_PULL_SHA:refs/pull/$PULL_NUMBER/head'
@@ -735,13 +750,16 @@ spec:
         - description: the git sha of the base of the pull request
           name: PULL_BASE_SHA
           type: string
-        - description: git pull request number
+        - default: ""
+          description: git pull request number
           name: PULL_NUMBER
           type: string
-        - description: git pull request ref in the form 'refs/pull/$PULL_NUMBER/head'
+        - default: ""
+          description: git pull request ref in the form 'refs/pull/$PULL_NUMBER/head'
           name: PULL_PULL_REF
           type: string
-        - description: git revision to checkout (branch, tag, sha, ref…)
+        - default: ""
+          description: git revision to checkout (branch, tag, sha, ref…)
           name: PULL_PULL_SHA
           type: string
         - description: git pull reference strings of base and latest in the form 'master:$PULL_BASE_SHA,$PULL_NUMBER:$PULL_PULL_SHA:refs/pull/$PULL_NUMBER/head'
@@ -877,13 +895,16 @@ spec:
         - description: the git sha of the base of the pull request
           name: PULL_BASE_SHA
           type: string
-        - description: git pull request number
+        - default: ""
+          description: git pull request number
           name: PULL_NUMBER
           type: string
-        - description: git pull request ref in the form 'refs/pull/$PULL_NUMBER/head'
+        - default: ""
+          description: git pull request ref in the form 'refs/pull/$PULL_NUMBER/head'
           name: PULL_PULL_REF
           type: string
-        - description: git revision to checkout (branch, tag, sha, ref…)
+        - default: ""
+          description: git revision to checkout (branch, tag, sha, ref…)
           name: PULL_PULL_SHA
           type: string
         - description: git pull reference strings of base and latest in the form 'master:$PULL_BASE_SHA,$PULL_NUMBER:$PULL_PULL_SHA:refs/pull/$PULL_NUMBER/head'
diff --git a/pkg/triggerconfig/inrepo/test_data/load_pipelinerun/pipeline/expected.yaml b/pkg/triggerconfig/inrepo/test_data/load_pipelinerun/pipeline/expected.yaml
index 986e9aae..16fcf50f 100644
--- a/pkg/triggerconfig/inrepo/test_data/load_pipelinerun/pipeline/expected.yaml
+++ b/pkg/triggerconfig/inrepo/test_data/load_pipelinerun/pipeline/expected.yaml
@@ -26,13 +26,16 @@ spec:
     - description: the git sha of the base of the pull request
       name: PULL_BASE_SHA
       type: string
-    - description: git pull request number
+    - default: ""
+      description: git pull request number
       name: PULL_NUMBER
       type: string
-    - description: git pull request ref in the form 'refs/pull/$PULL_NUMBER/head'
+    - default: ""
+      description: git pull request ref in the form 'refs/pull/$PULL_NUMBER/head'
       name: PULL_PULL_REF
       type: string
-    - description: git revision to checkout (branch, tag, sha, ref…)
+    - default: ""
+      description: git revision to checkout (branch, tag, sha, ref…)
       name: PULL_PULL_SHA
       type: string
     - description: git pull reference strings of base and latest in the form 'master:$PULL_BASE_SHA,$PULL_NUMBER:$PULL_PULL_SHA:refs/pull/$PULL_NUMBER/head'
diff --git a/pkg/triggerconfig/inrepo/test_data/load_pipelinerun/pr-load-refs/expected.yaml b/pkg/triggerconfig/inrepo/test_data/load_pipelinerun/pr-load-refs/expected.yaml
index d0e490cd..5cba6315 100644
--- a/pkg/triggerconfig/inrepo/test_data/load_pipelinerun/pr-load-refs/expected.yaml
+++ b/pkg/triggerconfig/inrepo/test_data/load_pipelinerun/pr-load-refs/expected.yaml
@@ -37,13 +37,16 @@ spec:
     - description: the git sha of the base of the pull request
       name: PULL_BASE_SHA
       type: string
-    - description: git pull request number
+    - default: ""
+      description: git pull request number
       name: PULL_NUMBER
       type: string
-    - description: git pull request ref in the form 'refs/pull/$PULL_NUMBER/head'
+    - default: ""
+      description: git pull request ref in the form 'refs/pull/$PULL_NUMBER/head'
       name: PULL_PULL_REF
       type: string
-    - description: git revision to checkout (branch, tag, sha, ref…)
+    - default: ""
+      description: git revision to checkout (branch, tag, sha, ref…)
       name: PULL_PULL_SHA
       type: string
     - description: git pull reference strings of base and latest in the form 'master:$PULL_BASE_SHA,$PULL_NUMBER:$PULL_PULL_SHA:refs/pull/$PULL_NUMBER/head'
@@ -117,13 +120,16 @@ spec:
         - description: the git sha of the base of the pull request
           name: PULL_BASE_SHA
           type: string
-        - description: git pull request number
+        - default: ""
+          description: git pull request number
           name: PULL_NUMBER
           type: string
-        - description: git pull request ref in the form 'refs/pull/$PULL_NUMBER/head'
+        - default: ""
+          description: git pull request ref in the form 'refs/pull/$PULL_NUMBER/head'
           name: PULL_PULL_REF
           type: string
-        - description: git revision to checkout (branch, tag, sha, ref…)
+        - default: ""
+          description: git revision to checkout (branch, tag, sha, ref…)
           name: PULL_PULL_SHA
           type: string
         - description: git pull reference strings of base and latest in the form 'master:$PULL_BASE_SHA,$PULL_NUMBER:$PULL_PULL_SHA:refs/pull/$PULL_NUMBER/head'
diff --git a/pkg/triggerconfig/inrepo/test_data/load_pipelinerun/task-append-steps/expected.yaml b/pkg/triggerconfig/inrepo/test_data/load_pipelinerun/task-append-steps/expected.yaml
index 4283c96d..8ca32c92 100644
--- a/pkg/triggerconfig/inrepo/test_data/load_pipelinerun/task-append-steps/expected.yaml
+++ b/pkg/triggerconfig/inrepo/test_data/load_pipelinerun/task-append-steps/expected.yaml
@@ -26,13 +26,16 @@ spec:
     - description: the git sha of the base of the pull request
       name: PULL_BASE_SHA
       type: string
-    - description: git pull request number
+    - default: ""
+      description: git pull request number
       name: PULL_NUMBER
       type: string
-    - description: git pull request ref in the form 'refs/pull/$PULL_NUMBER/head'
+    - default: ""
+      description: git pull request ref in the form 'refs/pull/$PULL_NUMBER/head'
       name: PULL_PULL_REF
       type: string
-    - description: git revision to checkout (branch, tag, sha, ref…)
+    - default: ""
+      description: git revision to checkout (branch, tag, sha, ref…)
       name: PULL_PULL_SHA
       type: string
     - description: git pull reference strings of base and latest in the form 'master:$PULL_BASE_SHA,$PULL_NUMBER:$PULL_PULL_SHA:refs/pull/$PULL_NUMBER/head'
@@ -96,13 +99,16 @@ spec:
         - description: the git sha of the base of the pull request
           name: PULL_BASE_SHA
           type: string
-        - description: git pull request number
+        - default: ""
+          description: git pull request number
           name: PULL_NUMBER
           type: string
-        - description: git pull request ref in the form 'refs/pull/$PULL_NUMBER/head'
+        - default: ""
+          description: git pull request ref in the form 'refs/pull/$PULL_NUMBER/head'
           name: PULL_PULL_REF
           type: string
-        - description: git revision to checkout (branch, tag, sha, ref…)
+        - default: ""
+          description: git revision to checkout (branch, tag, sha, ref…)
           name: PULL_PULL_SHA
           type: string
         - description: git pull reference strings of base and latest in the form 'master:$PULL_BASE_SHA,$PULL_NUMBER:$PULL_PULL_SHA:refs/pull/$PULL_NUMBER/head'
diff --git a/pkg/triggerconfig/inrepo/test_data/load_pipelinerun/task-prepend-steps/expected.yaml b/pkg/triggerconfig/inrepo/test_data/load_pipelinerun/task-prepend-steps/expected.yaml
index e70f20c6..da437256 100644
--- a/pkg/triggerconfig/inrepo/test_data/load_pipelinerun/task-prepend-steps/expected.yaml
+++ b/pkg/triggerconfig/inrepo/test_data/load_pipelinerun/task-prepend-steps/expected.yaml
@@ -26,13 +26,16 @@ spec:
     - description: the git sha of the base of the pull request
       name: PULL_BASE_SHA
       type: string
-    - description: git pull request number
+    - default: ""
+      description: git pull request number
       name: PULL_NUMBER
       type: string
-    - description: git pull request ref in the form 'refs/pull/$PULL_NUMBER/head'
+    - default: ""
+      description: git pull request ref in the form 'refs/pull/$PULL_NUMBER/head'
       name: PULL_PULL_REF
       type: string
-    - description: git revision to checkout (branch, tag, sha, ref…)
+    - default: ""
+      description: git revision to checkout (branch, tag, sha, ref…)
       name: PULL_PULL_SHA
       type: string
     - description: git pull reference strings of base and latest in the form 'master:$PULL_BASE_SHA,$PULL_NUMBER:$PULL_PULL_SHA:refs/pull/$PULL_NUMBER/head'
@@ -96,13 +99,16 @@ spec:
         - description: the git sha of the base of the pull request
           name: PULL_BASE_SHA
           type: string
-        - description: git pull request number
+        - default: ""
+          description: git pull request number
           name: PULL_NUMBER
           type: string
-        - description: git pull request ref in the form 'refs/pull/$PULL_NUMBER/head'
+        - default: ""
+          description: git pull request ref in the form 'refs/pull/$PULL_NUMBER/head'
           name: PULL_PULL_REF
           type: string
-        - description: git revision to checkout (branch, tag, sha, ref…)
+        - default: ""
+          description: git revision to checkout (branch, tag, sha, ref…)
           name: PULL_PULL_SHA
           type: string
         - description: git pull reference strings of base and latest in the form 'master:$PULL_BASE_SHA,$PULL_NUMBER:$PULL_PULL_SHA:refs/pull/$PULL_NUMBER/head'
diff --git a/pkg/triggerconfig/inrepo/test_data/load_pipelinerun/task-without-params/expected.yaml b/pkg/triggerconfig/inrepo/test_data/load_pipelinerun/task-without-params/expected.yaml
index cdeaa122..d151fb4c 100644
--- a/pkg/triggerconfig/inrepo/test_data/load_pipelinerun/task-without-params/expected.yaml
+++ b/pkg/triggerconfig/inrepo/test_data/load_pipelinerun/task-without-params/expected.yaml
@@ -24,13 +24,16 @@ spec:
     - description: the git sha of the base of the pull request
       name: PULL_BASE_SHA
       type: string
-    - description: git pull request number
+    - default: ""
+      description: git pull request number
       name: PULL_NUMBER
       type: string
-    - description: git pull request ref in the form 'refs/pull/$PULL_NUMBER/head'
+    - default: ""
+      description: git pull request ref in the form 'refs/pull/$PULL_NUMBER/head'
       name: PULL_PULL_REF
       type: string
-    - description: git revision to checkout (branch, tag, sha, ref…)
+    - default: ""
+      description: git revision to checkout (branch, tag, sha, ref…)
       name: PULL_PULL_SHA
       type: string
     - description: git pull reference strings of base and latest in the form 'master:$PULL_BASE_SHA,$PULL_NUMBER:$PULL_PULL_SHA:refs/pull/$PULL_NUMBER/head'
@@ -94,13 +97,16 @@ spec:
         - description: the git sha of the base of the pull request
           name: PULL_BASE_SHA
           type: string
-        - description: git pull request number
+        - default: ""
+          description: git pull request number
           name: PULL_NUMBER
           type: string
-        - description: git pull request ref in the form 'refs/pull/$PULL_NUMBER/head'
+        - default: ""
+          description: git pull request ref in the form 'refs/pull/$PULL_NUMBER/head'
           name: PULL_PULL_REF
           type: string
-        - description: git revision to checkout (branch, tag, sha, ref…)
+        - default: ""
+          description: git revision to checkout (branch, tag, sha, ref…)
           name: PULL_PULL_SHA
           type: string
         - description: git pull reference strings of base and latest in the form 'master:$PULL_BASE_SHA,$PULL_NUMBER:$PULL_PULL_SHA:refs/pull/$PULL_NUMBER/head'
diff --git a/pkg/triggerconfig/inrepo/test_data/load_pipelinerun/taskrun/expected.yaml b/pkg/triggerconfig/inrepo/test_data/load_pipelinerun/taskrun/expected.yaml
index 6efa952f..a0cc663d 100644
--- a/pkg/triggerconfig/inrepo/test_data/load_pipelinerun/taskrun/expected.yaml
+++ b/pkg/triggerconfig/inrepo/test_data/load_pipelinerun/taskrun/expected.yaml
@@ -25,13 +25,16 @@ spec:
     - description: the git sha of the base of the pull request
       name: PULL_BASE_SHA
       type: string
-    - description: git pull request number
+    - default: ""
+      description: git pull request number
       name: PULL_NUMBER
       type: string
-    - description: git pull request ref in the form 'refs/pull/$PULL_NUMBER/head'
+    - default: ""
+      description: git pull request ref in the form 'refs/pull/$PULL_NUMBER/head'
       name: PULL_PULL_REF
       type: string
-    - description: git revision to checkout (branch, tag, sha, ref…)
+    - default: ""
+      description: git revision to checkout (branch, tag, sha, ref…)
       name: PULL_PULL_SHA
       type: string
     - description: git pull reference strings of base and latest in the form 'master:$PULL_BASE_SHA,$PULL_NUMBER:$PULL_PULL_SHA:refs/pull/$PULL_NUMBER/head'
@@ -98,13 +101,16 @@ spec:
         - description: the git sha of the base of the pull request
           name: PULL_BASE_SHA
           type: string
-        - description: git pull request number
+        - default: ""
+          description: git pull request number
           name: PULL_NUMBER
           type: string
-        - description: git pull request ref in the form 'refs/pull/$PULL_NUMBER/head'
+        - default: ""
+          description: git pull request ref in the form 'refs/pull/$PULL_NUMBER/head'
           name: PULL_PULL_REF
           type: string
-        - description: git revision to checkout (branch, tag, sha, ref…)
+        - default: ""
+          description: git revision to checkout (branch, tag, sha, ref…)
           name: PULL_PULL_SHA
           type: string
         - description: git pull reference strings of base and latest in the form 'master:$PULL_BASE_SHA,$PULL_NUMBER:$PULL_PULL_SHA:refs/pull/$PULL_NUMBER/head'
diff --git a/pkg/util/error_markdown_test.go b/pkg/util/error_markdown_test.go
new file mode 100644
index 00000000..27cdf451
--- /dev/null
+++ b/pkg/util/error_markdown_test.go
@@ -0,0 +1,29 @@
+package util_test
+
+import (
+	"testing"
+
+	"github.com/jenkins-x/lighthouse/pkg/util"
+	"github.com/pkg/errors"
+	"github.com/stretchr/testify/assert"
+)
+
+var fileLink = "https://github.com/cb-kubecd/bdd-gh-1602679032/blob/master/"
+
+func TestErrorToMarkdown(t *testing.T) {
+	err := errors.Errorf("failed to do something")
+	actual := util.ErrorToMarkdown(err, fileLink)
+	assert.Equal(t, "* failed to do something\n", actual, "for %s", err.Error())
+
+	err = errors.Wrapf(err, "top level error")
+	actual = util.ErrorToMarkdown(err, fileLink)
+	assert.Equal(t, "* top level error\n* failed to do something\n", actual, "for %s", err.Error())
+}
+
+func TestErrorToMarkdownWithfileLink(t *testing.T) {
+	err := errors.Errorf("failed to load file .lighthouse/lint/triggers.yaml")
+
+	err = errors.Wrapf(err, "top level error")
+	actual := util.ErrorToMarkdown(err, fileLink)
+	assert.Equal(t, "* top level error\n* failed to load file [.lighthouse/lint/triggers.yaml](https://github.com/cb-kubecd/bdd-gh-1602679032/blob/master/.lighthouse/lint/triggers.yaml)\n", actual, "for %s", err.Error())
+}