Repository: jenkins-x/lighthouse
Pull request #1184 (2020-12-21 18:43:47)

fix: remove unused error wrap

jenkins-x-bot: Hi @yelhouti. 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 **pmuir**
You can assign the PR to them by writing `/assign @pmuir` 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":["pmuir"]} -->
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/1184#issuecomment-749159307 "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-749159307/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":[]} -->
jenkins-x-bot: @yelhouti: The following test **failed**, say `/retest` to rerun them all:

Test name | Commit | Details | Rerun command
--- | --- | --- | ---
pr-build | c4aa401b88efe4d85b6e1759d552e5e740fd02d3 | [link](https://dashboard-jx.jenkins-x.live/teams/jx/projects/jenkins-x/lighthouse/PR-1184/2) | `/test pr-build`

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

<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/bdd/bbs/ci.sh b/bdd/bbs/ci.sh
index 48fc3c7b..56c1c545 100755
--- a/bdd/bbs/ci.sh
+++ b/bdd/bbs/ci.sh
@@ -16,6 +16,12 @@ export XDG_CONFIG_HOME=$JX_HOME
 
 mkdir -p $JX_HOME/git
 
+# TODO hack until we fix boot to do this too!
+helm init --client-only --skip-refresh
+helm repo rm stable
+helm repo add stable https://charts.helm.sh/stable
+helm repo add jenkins-x https://storage.googleapis.com/chartmuseum.jenkins-x.io
+
 jx install dependencies --all
 
 jx --version
@@ -72,10 +78,6 @@ export BDD_ENABLE_TEST_CHATOPS_COMMANDS="true"
 
 echo "Building lighthouse with version $VERSION"
 
-# TODO hack until we fix boot to do this too!
-helm init --client-only
-helm repo add jenkins-x https://storage.googleapis.com/chartmuseum.jenkins-x.io
-
 # Enable checking the commit status reporting URL
 export BDD_LIGHTHOUSE_BASE_REPORT_URL=https://example.com
 
diff --git a/bdd/ghe/ci.sh b/bdd/ghe/ci.sh
index f1062ae5..73ad0833 100755
--- a/bdd/ghe/ci.sh
+++ b/bdd/ghe/ci.sh
@@ -15,6 +15,12 @@ export XDG_CONFIG_HOME=$JX_HOME
 
 mkdir -p $JX_HOME/git
 
+# TODO hack until we fix boot to do this too!
+helm init --client-only --skip-refresh
+helm repo rm stable
+helm repo add stable https://charts.helm.sh/stable
+helm repo add jenkins-x https://storage.googleapis.com/chartmuseum.jenkins-x.io
+
 jx install dependencies --all
 
 jx --version
@@ -68,10 +74,6 @@ sed -e s/\$VERSION/${VERSION}/g ../bdd/helm-requirements.yaml.template > env/req
 
 echo "Building lighthouse with version $VERSION"
 
-# TODO hack until we fix boot to do this too!
-helm init --client-only
-helm repo add jenkins-x https://storage.googleapis.com/chartmuseum.jenkins-x.io
-
 export BDD_ENABLE_TEST_CHATOPS_COMMANDS="true"
 
 # Enable checking the commit status reporting URL
diff --git a/bdd/github/ci.sh b/bdd/github/ci.sh
index e4ddbb18..54012d3a 100755
--- a/bdd/github/ci.sh
+++ b/bdd/github/ci.sh
@@ -16,6 +16,12 @@ export XDG_CONFIG_HOME=$JX_HOME
 
 mkdir -p $JX_HOME/git
 
+# TODO hack until we fix boot to do this too!
+helm init --client-only --skip-refresh
+helm repo rm stable
+helm repo add stable https://charts.helm.sh/stable
+helm repo add jenkins-x https://storage.googleapis.com/chartmuseum.jenkins-x.io
+
 jx install dependencies --all
 
 jx --version
@@ -68,10 +74,6 @@ sed -e s/\$VERSION/${VERSION}/g ../bdd/helm-requirements.yaml.template > env/req
 
 echo "Building lighthouse with version $VERSION"
 
-# TODO hack until we fix boot to do this too!
-helm init --client-only
-helm repo add jenkins-x https://storage.googleapis.com/chartmuseum.jenkins-x.io
-
 export BDD_ENABLE_TEST_CHATOPS_COMMANDS="true"
 
 # Enable checking the commit status reporting URL
diff --git a/bdd/gitlab/ci.sh b/bdd/gitlab/ci.sh
index cb4b887c..2dfe2c9d 100755
--- a/bdd/gitlab/ci.sh
+++ b/bdd/gitlab/ci.sh
@@ -16,6 +16,12 @@ export XDG_CONFIG_HOME=$JX_HOME
 
 mkdir -p $JX_HOME/git
 
+# TODO hack until we fix boot to do this too!
+helm init --client-only --skip-refresh
+helm repo rm stable
+helm repo add stable https://charts.helm.sh/stable
+helm repo add jenkins-x https://storage.googleapis.com/chartmuseum.jenkins-x.io
+
 jx install dependencies --all
 
 jx --version
@@ -68,10 +74,6 @@ sed -e s/\$VERSION/${VERSION}/g ../bdd/helm-requirements.yaml.template > env/req
 
 echo "Building lighthouse with version $VERSION"
 
-# TODO hack until we fix boot to do this too!
-helm init --client-only
-helm repo add jenkins-x https://storage.googleapis.com/chartmuseum.jenkins-x.io
-
 export BDD_ENABLE_TEST_CHATOPS_COMMANDS="true"
 
 # Enable checking the commit status reporting URL
diff --git a/cmd/webhooks/main.go b/cmd/webhooks/main.go
index c564e992..a468d9fc 100644
--- a/cmd/webhooks/main.go
+++ b/cmd/webhooks/main.go
@@ -44,7 +44,7 @@ func gatherOptions(fs *flag.FlagSet, args ...string) options {
 	fs.StringVar(&o.path, "path", "/hook",
 		"The path to listen on for requests to trigger a pipeline run.")
 	fs.StringVar(&o.pluginFilename, "plugin-file", "", "Path to the plugins.yaml file. If not specified it is loaded from the 'plugins' ConfigMap")
-	fs.StringVar(&o.configFilename, "config-file", "", "7Path to the config.yaml file. If not specified it is loaded from the 'config' ConfigMap")
+	fs.StringVar(&o.configFilename, "config-file", "", "Path to the config.yaml file. If not specified it is loaded from the 'config' ConfigMap")
 	fs.StringVar(&o.botName, "bot-name", "", "The name of the bot user to run as. Defaults to $GIT_USER if not specified.")
 	fs.StringVar(&o.namespace, "namespace", "", "The namespace to listen in")
 
diff --git a/init-helm.sh b/init-helm.sh
new file mode 100755
index 00000000..2383836d
--- /dev/null
+++ b/init-helm.sh
@@ -0,0 +1,5 @@
+#!/bin/sh
+
+helm init --client-only --skip-refresh
+helm repo rm stable
+helm repo add stable https://charts.helm.sh/stable
diff --git a/jenkins-x.yml b/jenkins-x.yml
index bb87aa93..92036b55 100644
--- a/jenkins-x.yml
+++ b/jenkins-x.yml
@@ -27,10 +27,8 @@ pipelineConfig:
           steps:
           - name: init-helm
             image: alpine/helm:2.12.3
-            command: helm
-            args:
-              - init
-              - --client-only
+            command: ./init-helm.sh
+            dir: /workspace/source
 
           - name: helm-lint
             image: gcr.io/jenkinsxio/builder-go
diff --git a/pkg/triggerconfig/inrepo/calculate.go b/pkg/triggerconfig/inrepo/calculate.go
index 6c910b59..2d1a6c70 100644
--- a/pkg/triggerconfig/inrepo/calculate.go
+++ b/pkg/triggerconfig/inrepo/calculate.go
@@ -46,5 +46,5 @@ func Generate(fileBrowser filebrowser.Interface, sharedConfig *config.Config, sh
 			}
 		}
 	}
-	return &cfg, &pluginCfg, errors.Wrapf(err, "failed to create trigger config from local source for repo %s/%s ref %s", owner, repo, eventRef)
+	return &cfg, &pluginCfg, nil
 }
diff --git a/pkg/triggerconfig/merge/merge.go b/pkg/triggerconfig/merge/merge.go
index f84b59c2..6562d33e 100644
--- a/pkg/triggerconfig/merge/merge.go
+++ b/pkg/triggerconfig/merge/merge.go
@@ -80,6 +80,10 @@ func ConfigMerge(cfg *config.Config, pluginsCfg *plugins.Configuration, repoConf
 	if err != nil {
 		return errors.Wrapf(err, "failed to validate plugins")
 	}
+	err = cfg.Init(cfg.ProwConfig)
+	if err != nil {
+		return errors.Wrapf(err, "failed to initialize config")
+	}
 	err = cfg.Validate(cfg.ProwConfig)
 	if err != nil {
 		return errors.Wrapf(err, "failed to validate config")


Test patch:
diff --git a/pkg/triggerconfig/inrepo/test_data/myorg/branchtest/refs/master/.lighthouse/triggers/triggers.yaml b/pkg/triggerconfig/inrepo/test_data/myorg/branchtest/refs/master/.lighthouse/triggers/triggers.yaml
index 6930052a..386df5d9 100644
--- a/pkg/triggerconfig/inrepo/test_data/myorg/branchtest/refs/master/.lighthouse/triggers/triggers.yaml
+++ b/pkg/triggerconfig/inrepo/test_data/myorg/branchtest/refs/master/.lighthouse/triggers/triggers.yaml
@@ -4,10 +4,10 @@ spec:
   presubmits:
   - name: lint
     context: "lint"
-    alwaysRun: true
+    always_run: true
     optional: false
-    trigger: "/lint"
-    rerunCommand: "/relint"
+    trigger: "(?:/lint|/relint)"
+    rerun_command: "/relint"
     agent: tekton-pipeline
   postsubmits:
   - name: release
diff --git a/pkg/triggerconfig/inrepo/test_data/myorg/branchtest/refs/mybranch/.lighthouse/triggers/triggers.yaml b/pkg/triggerconfig/inrepo/test_data/myorg/branchtest/refs/mybranch/.lighthouse/triggers/triggers.yaml
index 6167aef2..dd85b09b 100644
--- a/pkg/triggerconfig/inrepo/test_data/myorg/branchtest/refs/mybranch/.lighthouse/triggers/triggers.yaml
+++ b/pkg/triggerconfig/inrepo/test_data/myorg/branchtest/refs/mybranch/.lighthouse/triggers/triggers.yaml
@@ -4,17 +4,17 @@ spec:
   presubmits:
   - name: lint
     context: "lint"
-    alwaysRun: true
+    always_run: true
     optional: false
-    trigger: "/lint"
-    rerunCommand: "/relint"
+    trigger: "(?:/lint|/relint)"
+    rerun_command: "/relint"
     agent: tekton-pipeline
   - name: newthingy
     context: "newthingy"
-    alwaysRun: true
+    always_run: true
     optional: false
-    trigger: "/newthingy"
-    rerunCommand: "/renewthingy"
+    trigger: "(?:/newthingy|/renewthingy)"
+    rerun_command: "/renewthingy"
     agent: tekton-pipeline
   postsubmits:
   - name: release
diff --git a/pkg/triggerconfig/inrepo/test_data/myorg/duplicate-postsubmit/.lighthouse/duplicate-lint/triggers.yaml b/pkg/triggerconfig/inrepo/test_data/myorg/duplicate-postsubmit/.lighthouse/duplicate-lint/triggers.yaml
index 16af2e57..0d53e4ce 100644
--- a/pkg/triggerconfig/inrepo/test_data/myorg/duplicate-postsubmit/.lighthouse/duplicate-lint/triggers.yaml
+++ b/pkg/triggerconfig/inrepo/test_data/myorg/duplicate-postsubmit/.lighthouse/duplicate-lint/triggers.yaml
@@ -4,10 +4,10 @@ spec:
   presubmits:
   - name: lint
     context: "test"
-    alwaysRun: true
+    always_run: true
     optional: false
-    trigger: "/test"
-    rerunCommand: "/retest"
+    trigger: "(?:/test|/retest)"
+    rerun_command: "/retest"
     agent: tekton-pipeline
   postsubmits:
   - name: release
diff --git a/pkg/triggerconfig/inrepo/test_data/myorg/duplicate-postsubmit/.lighthouse/linter/triggers.yaml b/pkg/triggerconfig/inrepo/test_data/myorg/duplicate-postsubmit/.lighthouse/linter/triggers.yaml
index a86284c4..0d1a47b2 100644
--- a/pkg/triggerconfig/inrepo/test_data/myorg/duplicate-postsubmit/.lighthouse/linter/triggers.yaml
+++ b/pkg/triggerconfig/inrepo/test_data/myorg/duplicate-postsubmit/.lighthouse/linter/triggers.yaml
@@ -4,12 +4,12 @@ spec:
   presubmits:
   - name: test
     context: "test"
-    alwaysRun: true
+    always_run: true
     optional: false
-    trigger: "/test"
-    rerunCommand: "/retest"
+    trigger: "(?:/test|/retest)"
+    rerun_command: "/retest"
     agent: tekton-pipeline
   postsubmits:
   - name: release
     context: "release"
-    agent: tekton-pipeline
\ No newline at end of file
+    agent: tekton-pipeline
diff --git a/pkg/triggerconfig/inrepo/test_data/myorg/duplicate-presubmit/.lighthouse/duplicate-lint/triggers.yaml b/pkg/triggerconfig/inrepo/test_data/myorg/duplicate-presubmit/.lighthouse/duplicate-lint/triggers.yaml
index 16af2e57..0d53e4ce 100644
--- a/pkg/triggerconfig/inrepo/test_data/myorg/duplicate-presubmit/.lighthouse/duplicate-lint/triggers.yaml
+++ b/pkg/triggerconfig/inrepo/test_data/myorg/duplicate-presubmit/.lighthouse/duplicate-lint/triggers.yaml
@@ -4,10 +4,10 @@ spec:
   presubmits:
   - name: lint
     context: "test"
-    alwaysRun: true
+    always_run: true
     optional: false
-    trigger: "/test"
-    rerunCommand: "/retest"
+    trigger: "(?:/test|/retest)"
+    rerun_command: "/retest"
     agent: tekton-pipeline
   postsubmits:
   - name: release
diff --git a/pkg/triggerconfig/inrepo/test_data/myorg/duplicate-presubmit/.lighthouse/linter/triggers.yaml b/pkg/triggerconfig/inrepo/test_data/myorg/duplicate-presubmit/.lighthouse/linter/triggers.yaml
index 372fea95..1cdb3e32 100644
--- a/pkg/triggerconfig/inrepo/test_data/myorg/duplicate-presubmit/.lighthouse/linter/triggers.yaml
+++ b/pkg/triggerconfig/inrepo/test_data/myorg/duplicate-presubmit/.lighthouse/linter/triggers.yaml
@@ -4,9 +4,9 @@ spec:
   presubmits:
   - name: lint
     context: "lint"
-    alwaysRun: true
+    always_run: true
     optional: false
-    trigger: "/lint"
-    rerunCommand: "/relint"
+    trigger: "(?:/lint|/relint)"
+    rerun_command: "/relint"
     agent: tekton-pipeline
 
diff --git a/pkg/triggerconfig/inrepo/test_data/myorg/loadtest/.lighthouse/jenkins-x/triggers.yaml b/pkg/triggerconfig/inrepo/test_data/myorg/loadtest/.lighthouse/jenkins-x/triggers.yaml
index e08bf03f..4a23d364 100644
--- a/pkg/triggerconfig/inrepo/test_data/myorg/loadtest/.lighthouse/jenkins-x/triggers.yaml
+++ b/pkg/triggerconfig/inrepo/test_data/myorg/loadtest/.lighthouse/jenkins-x/triggers.yaml
@@ -4,10 +4,10 @@ spec:
   presubmits:
   - name: test
     context: "test"
-    alwaysRun: true
+    always_run: true
     optional: false
-    trigger: "/test"
-    rerunCommand: "/retest"
+    trigger: "(?:/test|/retest)"
+    rerun_command: "/retest"
     agent: tekton-pipeline
   postsubmits:
   - name: release
diff --git a/pkg/triggerconfig/inrepo/test_data/myorg/loadtest/.lighthouse/linter/triggers.yaml b/pkg/triggerconfig/inrepo/test_data/myorg/loadtest/.lighthouse/linter/triggers.yaml
index 372fea95..1cdb3e32 100644
--- a/pkg/triggerconfig/inrepo/test_data/myorg/loadtest/.lighthouse/linter/triggers.yaml
+++ b/pkg/triggerconfig/inrepo/test_data/myorg/loadtest/.lighthouse/linter/triggers.yaml
@@ -4,9 +4,9 @@ spec:
   presubmits:
   - name: lint
     context: "lint"
-    alwaysRun: true
+    always_run: true
     optional: false
-    trigger: "/lint"
-    rerunCommand: "/relint"
+    trigger: "(?:/lint|/relint)"
+    rerun_command: "/relint"
     agent: tekton-pipeline
 
diff --git a/pkg/triggerconfig/inrepo/test_data/myorg/myrepo/.lighthouse/jenkins-x/triggers.yaml b/pkg/triggerconfig/inrepo/test_data/myorg/myrepo/.lighthouse/jenkins-x/triggers.yaml
index d5f8e659..d15685ce 100644
--- a/pkg/triggerconfig/inrepo/test_data/myorg/myrepo/.lighthouse/jenkins-x/triggers.yaml
+++ b/pkg/triggerconfig/inrepo/test_data/myorg/myrepo/.lighthouse/jenkins-x/triggers.yaml
@@ -6,7 +6,7 @@ spec:
     context: "test"
     always_run: true
     optional: false
-    trigger: "/test"
+    trigger: "(?:/test|/retest)"
     rerun_command: "/retest"
     source: "test.yaml"
     pipeline_run_params:
diff --git a/pkg/triggerconfig/inrepo/test_data/myorg/myrepo/.lighthouse/linter/triggers.yaml b/pkg/triggerconfig/inrepo/test_data/myorg/myrepo/.lighthouse/linter/triggers.yaml
index 6b0fdad2..9a1fe8d2 100644
--- a/pkg/triggerconfig/inrepo/test_data/myorg/myrepo/.lighthouse/linter/triggers.yaml
+++ b/pkg/triggerconfig/inrepo/test_data/myorg/myrepo/.lighthouse/linter/triggers.yaml
@@ -6,7 +6,7 @@ spec:
     context: "lint"
     always_run: true
     optional: false
-    trigger: "/lint"
+    trigger: "(?:/lint|/relint)"
     rerun_command: "/relint"
     source: "lint.yaml"
   branchProtection:
diff --git a/pkg/triggerconfig/merge/merge_test.go b/pkg/triggerconfig/merge/merge_test.go
index a74f6a7d..a2df0ce8 100644
--- a/pkg/triggerconfig/merge/merge_test.go
+++ b/pkg/triggerconfig/merge/merge_test.go
@@ -36,7 +36,7 @@ func TestMergeTriggerConfig(t *testing.T) {
 							},
 							AlwaysRun:    true,
 							Optional:     false,
-							Trigger:      "/lint",
+							Trigger:      "(?:/lint|/relint)",
 							RerunCommand: "/relint",
 							Reporter: job.Reporter{
 								Context: "lint",
diff --git a/pkg/triggerconfig/merge/test_data/simple/expected-config.yaml b/pkg/triggerconfig/merge/test_data/simple/expected-config.yaml
index 97d04f23..99d2861b 100644
--- a/pkg/triggerconfig/merge/test_data/simple/expected-config.yaml
+++ b/pkg/triggerconfig/merge/test_data/simple/expected-config.yaml
@@ -6,18 +6,22 @@ plank: {}
 postsubmits:
   myorg/myowner:
   - agent: tekton-pipeline
+    cluster: default
     context: release
     name: release
+    namespace: ""
 presubmits:
   myorg/myowner:
   - agent: tekton-pipeline
     always_run: true
+    cluster: default
     context: lint
     name: lint
+    namespace: ""
     rerun_command: /relint
-    trigger: /lint
+    trigger: (?:/lint|/relint)
 push_gateway:
   serve_metrics: false
 tide:
   context_options:
-    required-if-present-contexts: null
\ No newline at end of file
+    required-if-present-contexts: null
diff --git a/pkg/triggerconfig/merge/test_data/simple/triggers.yaml b/pkg/triggerconfig/merge/test_data/simple/triggers.yaml
index 8cd2c076..386df5d9 100644
--- a/pkg/triggerconfig/merge/test_data/simple/triggers.yaml
+++ b/pkg/triggerconfig/merge/test_data/simple/triggers.yaml
@@ -6,7 +6,7 @@ spec:
     context: "lint"
     always_run: true
     optional: false
-    trigger: "/lint"
+    trigger: "(?:/lint|/relint)"
     rerun_command: "/relint"
     agent: tekton-pipeline
   postsubmits: