Repository: jenkins-x/lighthouse
Pull request #1140 (2020-11-01 11:35:00)

docs: Fix Lighthouse lgtm link

jenkins-x-bot: Hi @randomnoise. Thanks for your PR.

I'm waiting for a [jenkins-x](https://github.com/orgs/jenkins-x/people) member to verify that this patch is reasonable to test. If it is, they should reply with `/ok-to-test` on its own line. Until that is done, I will not automatically test new commits in this PR, but the usual testing commands by org members will still work. Regular contributors should [join the org](https://github.com/orgs/jenkins-x/people) to skip this step.

Once the patch is verified, the new status will be reflected by the `ok-to-test` label.

I understand the commands that are listed [here](https://go.k8s.io/bot-commands?repo=jenkins-x%2Flighthouse).

<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.
</details>

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 **ccojocar**
You can assign the PR to them by writing `/assign @ccojocar` 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":["ccojocar"]} -->
randomnoise: /assign @ccojocar
abayer: /ok-to-test
/lgtm
jenkins-x-bot: [APPROVALNOTIFIER] This PR is **APPROVED**

This pull-request has been approved by: *[abayer](https://github.com/jenkins-x/lighthouse/pull/1140#issuecomment-720484396 "LGTM")*

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

The pull request process is described [here](https://git.k8s.io/community/contributors/guide/owners.md#the-code-review-process)

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

- ~~[OWNERS](https://github.com#issuecomment-720484396/jenkins-x/lighthouse/blob/master/OWNERS)~~ [abayer]

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":[]} -->

Patch:
diff --git a/README.md b/README.md
index fc81f9b8..8bab3f57 100644
--- a/README.md
+++ b/README.md
@@ -53,7 +53,7 @@ We've reused the prow plugin code and configuration code; so it is mostly a case
 Most of the GitHub structs map 1-1 to the [jenkins-x/go-scm](https://github.com/jenkins-x/go-scm) equivalents (e.g. Issue, Commit, PullRequest).
 However, the go-scm API does tend to return slices to pointers to resources by default.
 There are some naming differences in different parts of the API as well.
-For exmaple, compare the `githubClient` API for [Prow lgtm](https://github.com/kubernetes/test-infra/blob/344024d30165cda6f4691cc178f25b16f1a1f5af/prow/plugins/lgtm/lgtm.go#L134-L150) versus the [Lighthouse lgtm](https://github.com/jenkins-x/lighthouse/blob/master/pkg/prow/plugins/lgtm/lgtm.go#L135-L150).
+For example, compare the `githubClient` API for [Prow lgtm](https://github.com/kubernetes/test-infra/blob/344024d30165cda6f4691cc178f25b16f1a1f5af/prow/plugins/lgtm/lgtm.go#L134-L150) versus the [Lighthouse lgtm](https://github.com/jenkins-x/lighthouse/blob/master/pkg/plugins/lgtm/lgtm.go#L146-L163).
 
 ## Development
 
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())
+}