Repository: jenkins-x/lighthouse
Pull request #1004 (2020-09-03 11:24:43)

fix: support in repo configuration of triggers (presubmit/postsubmits)
so this works kinda like github actions where the pipelines (PipelineRun)
and Presubmit/Postsubmits are all defined in the underlying git repository
and we use that data to trigger pipelines

here's an example source git repository layout:
https://github.com/jstrachan/lighthouse/tree/local-config-plugin/pkg/webhook/test_data/myorg/myrepo

so the `.lighthouse/*/triggers.yaml` files can define presubmit/post submits locally like this [.lighthouse/linter/triggers.yaml](https://github.com/jstrachan/lighthouse/blob/local-config-plugin/pkg/webhook/test_data/myorg/myrepo/.lighthouse/linter/triggers.yaml) which can reference local `sourcePath` files like this [lint.yaml](https://github.com/jstrachan/lighthouse/blob/local-config-plugin/pkg/webhook/test_data/myorg/myrepo/.lighthouse/linter/lint.yaml)

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
--- | --- | --- | ---
pr-build | 252f28b6049e2d80bd7029810bd7a37ebb7dc135 | [link](https://dashboard-jx.jenkins-x.live/teams/jx/projects/jenkins-x/lighthouse/PR-1004/1) | `/test pr-build`

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

<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
--- | --- | --- | ---
pr-build | 252f28b6049e2d80bd7029810bd7a37ebb7dc135 | [link](https://dashboard-jx.jenkins-x.live/teams/jx/projects/jenkins-x/lighthouse/PR-1004/1) | `/test pr-build`
ghe | 252f28b6049e2d80bd7029810bd7a37ebb7dc135 | [link](https://dashboard-jx.jenkins-x.live/teams/jx/projects/jenkins-x/lighthouse/PR-1004/2) | `/test ghe`

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

<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
--- | --- | --- | ---
pr-build | 252f28b6049e2d80bd7029810bd7a37ebb7dc135 | [link](https://dashboard-jx.jenkins-x.live/teams/jx/projects/jenkins-x/lighthouse/PR-1004/1) | `/test pr-build`
ghe | 252f28b6049e2d80bd7029810bd7a37ebb7dc135 | [link](https://dashboard-jx.jenkins-x.live/teams/jx/projects/jenkins-x/lighthouse/PR-1004/2) | `/test ghe`
bbs | 252f28b6049e2d80bd7029810bd7a37ebb7dc135 | [link](https://dashboard-jx.jenkins-x.live/teams/jx/projects/jenkins-x/lighthouse/PR-1004/4) | `/test bbs`

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

<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 | 252f28b6049e2d80bd7029810bd7a37ebb7dc135 | [link](https://dashboard-jx.jenkins-x.live/teams/jx/projects/jenkins-x/lighthouse/PR-1004/2) | `/test ghe`
bbs | 252f28b6049e2d80bd7029810bd7a37ebb7dc135 | [link](https://dashboard-jx.jenkins-x.live/teams/jx/projects/jenkins-x/lighthouse/PR-1004/4) | `/test bbs`
tekton | 252f28b6049e2d80bd7029810bd7a37ebb7dc135 | [link](https://dashboard-jx.jenkins-x.live/teams/jx/projects/jenkins-x/lighthouse/PR-1004/6) | `/test tekton`
gitlab | 252f28b6049e2d80bd7029810bd7a37ebb7dc135 | [link](https://dashboard-jx.jenkins-x.live/teams/jx/projects/jenkins-x/lighthouse/PR-1004/5) | `/test gitlab`
github | 252f28b6049e2d80bd7029810bd7a37ebb7dc135 | [link](https://dashboard-jx.jenkins-x.live/teams/jx/projects/jenkins-x/lighthouse/PR-1004/3) | `/test github`

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

<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 -->
abayer: /assign @hferentschik 
/assign @eddycharly 
eddycharly: Thanks @jstrachan for working on this !

Why the plugin ? The in repo jobs are not started by the `trigger` plugin ?

For opt-in, did you consider something like what Prow did ? Make the opt-in part of the config instead ?

Also, how does the config different than `presubmits` or `postsubmits` apply here ?
For example `branchProtection` (https://github.com/jstrachan/lighthouse/blob/cc8a10914152dd04795429d3a3fa54868feb05d6/pkg/plugins/local-config-trigger/test_data/myorg/myrepo/.lighthouse/linter/lighthouse.yaml#L12-L15) ?
jstrachan: @eddycharly currently lighthouse loads the entire config for every git repository + the presubmit/postsubmits from a global location (e.g. a single ConfigMap). What this plugin does is allow the presubmit/postsubmits to be loaded from the actual git repository. So folks can pick which repositories own their 'lighthouse configuration' - rather like how github actions works, you put the github actions configuration files inside each git repository - not in some monster huge YAML file in a central place.

BTW `presubmit/postsubmit` are configurations for the `trigger` plugin to decide when/how to trigger pipelines which is different from branch protection. e.g. you can define 3 pipelines on a `presubmit` to run 3 different tests - just like this `lighthouse` git repository and this PR has all those separate pipelines for `bbs / ghe / github / gitlab` - those are separate presubmits with separate pipelines.  

So the `.lighthouse/config/lighthouse.yaml` for this git repo could define 6 presubmits there along with (say) 1 templated PipelineRun YAML to implement all the CI/CD for this git repository all in this repository - all in vanilla tekton YAML- rather than in some totally separate Jenkins X git repository using jenkins x pipeline stuff



jstrachan: maybe another way to think of this PR is - look at how github actions work; folks put into git all the configuration for all the github actions. There's no central magic place in git somewhere that influences how CI/CD works for a repository - its all self contained. This plugin introduces the same idea - for folks using lighthouse with tekton pipelines
jstrachan: BTW by opt in - I meant - the global configuration of lighthouse + prow defines what plugins are associated with what repositories. So by default noone will use this new plugin. However folks can then configure their global lighthouse configuration to pick which repositories use the `local-config-trigger` plugin - which then means that the presubmit/postsubmit + other configurations are all defined inside the actual git repository (rather than maintained centrally in a huge monster ConfigMap)
eddycharly: Also, Prow also offers opt-in but not in the form of a plugin, and honestly i dunno if a plugin for that is the best approach.

I mean the logic should be the same in both case, that's just sometimes jobs come from the central repository and sometimes they come from both the central repository and the repo itself (at this point, job config might need to be merged, validated, ensure it's consistent).

Except for the differences in job sources, i don't really see the reasons why the rest of the code should be changed.
eddycharly: Have you read the prow docs for in repo config ? https://github.com/kubernetes/test-infra/blob/master/prow/inrepoconfig.md
jstrachan: @eddycharly gotcha. TBH when I created the repo config code I was thinking more broadly about the problem of how to separate the configuration of all of lighthouse into a more decentralised approach - but hadn't started to address integrating that code cleanly into all of lighthouse.

This PR only really tackles the trigger plugin really + handling presubmit/postsubmits nicely - it doesn't try to address keeper or branch protection or anything yet.

To truly make the configuration of all of lighthouse decentralised so we can store the configuration inside each git repository we'll ned a bit more refactoring of the core of lighthouse itself (e.g. to allow post processing the config + plugins structs for each git repository before passing them into the plugins). Then being able to locally configure keeper/branch protection in a local repo config makes more sense.

However from a priorities perspective - being able to define presubmits/postsubmits locally inside a git repository is the most important decentralisation for me; its _very_ common for repositories to want to define its own custom presubmit contexts + pipelines (e.g. this repo). It's much less common to need massively different keeper / branch protection configurations & for them to change much - whereas changing pipelines/contexts is pretty frequent which tends itself to decentralising. After years of working with prow/lighthouse I can't remember configuring one repository differently for keeper for example - yet its very common to want to define different presubmits. e.g. to modify a presubmit pipeline on a PR, just modify the git repository on the PR and you get very fast feedback. Doing it the centralised way is way harder

eddycharly: But i agree, i can't stand the huge `ConfigMap`s anymore and i am taking a similar approach myself with a `RepoConfig` CRD =)
But that's another story.
jstrachan: @eddycharly totally agreed with all of that. This PR is the smallest change to start the move for lighthouse to a decentralised approach - tackling the most important things first (presubmit/postsubmits). 

Eventually we could get all configuration decentralised and globally configure what is/isn't centralised and how global + local changes merge together. If we get that far we could make the `local-config-trigger` plugin a noop/alias for `trigger`? But I figured doing all those changes could take a fair amount of time so this is a quick win via an optional plugin while we figure out the full decentralised configuration issues? The plugin is actually pretty tiny so its not a biggie if long term it gets removed once all the other decentralised configuration changes are working?
eddycharly: I agree 100% for pre/post submit jobs. Not only on the technical side, it's absolutely necessary to enable ownership.

So i don't discuss the need for it at all, i discuss the implementation, IMO only pre/post submits should be configurable in the repo, at least until we find an argument for letting the user configure other things like keeper.

So i guess you could remove all the things that are not related to pre/post submits ?
jstrachan: I was hoping to get the decentralised code working incrementally too btw; so would be nice to keep that code that can merge the local config into the global config (as we'll need it sometime)

I wonder whats a good middle ground. e.g. maybe the `local-config-trigger` plugin could verify the local configuration and fail if there's anything other than `presubmit/postsubmits` inside? Then folks can accidentally configure - say - keeper? 

Or maybe introduce 2 kinds; `RepositoryConfig` which we don't use yet and `RepositorySubmits` (not sure the name ;) - which is only presubmit/postsubmits? eventually folks could just use `RepositoryConfig` - but for now the `local-config-trigger` plugin would only submit` RepositorySubmits` files?


eddycharly: Enabling the `local-config-trigger` is going to happen on the centralized side, so it's not better than what prow did https://github.com/kubernetes/test-infra/blob/master/prow/inrepoconfig.md.

Their implementation is simpler too, i still don't see the point in having a separate plugin. In the end trigger doesn't care where the jobs come from.
jstrachan: ok - it wouldn't be that hard to refactor the webhooks code to allow inrepoconfig I guess?
jstrachan: yeah - the config/plugins are passed from the webhooks code to the plugins to do stuff via the agent in code like this line:
https://github.com/jenkins-x/lighthouse/blob/9e23a27d8a266db92271a4b9f395936df60bacb3/pkg/webhook/events.go#L157

so we could just have a simple strategy method for creating the agent which if a repository is enabled for `inRepoConfig` we use the repository specify config/plugins structs
https://github.com/jenkins-x/lighthouse/blob/9e23a27d8a266db92271a4b9f395936df60bacb3/pkg/webhook/events.go#L157

Then we'll just need the `inRepoConfig` flag globally + then no need for a custom plugin 
hferentschik: > Have you read the prow docs for in repo config ? https://github.com/kubernetes/test-infra/blob/master/prow/inrepoconfig.md

Would it not make more sense to port the prow inrepoconfig?
abayer: I'm wondering if it makes sense to _start_ with the Prow repo config approach as the basis for a Lighthouse approach - not just porting it over unchanged, but using that as the starting point?
jstrachan: @hferentschik we should support something like `inrepoconfig` in the current LH configuration yeah.

The format of the config file for lighthouse inside the repository is less of a concern (e.g. jx / tekton support will differ). The current [RepositoryConfig](https://github.com/jstrachan/lighthouse/blob/local-config-plugin/pkg/plugins/local-config-trigger/test_data/myorg/myrepo/.lighthouse/jenkins-x/lighthouse.yaml) in LH explicitly uses a k8s style layout + versioning so its gonna be easier to work with other k8s technologies and feel similar e.g. tekton / skaffold et al). Plus there's an increasing number of k8s tools (e.g. kpt / Anthos Config Management) that expect `kind` in yaml files) - so using a more k8s native config file format inside the git repositories is a nice idea. 
jstrachan: having backwards compatibility with prow central configuration is useful. However I'm not sure how many folks are fans of the prow configuration file format; I'd personally prefer a nicer more tekton/skaffold style versioned YAML notation using k8s YAML style syntax
abayer: Oh, I don't care _at all_ about backwards compat with Prow's in-repo config. Preserving backwards compat support for the central config is critical since otherwise we have some hoops to jump through for Jenkins X to keep working, but anything that jx doesn't already care about doesn't have to be Prow-compatible, IMO.
jstrachan: @abayer totally agreed. So how about we use prow compatible `inrepoconfig` ASAP - then we can keep the current local repository config? 

I might have some time to try a PR tomorrow unless anyone else fancies it?
eddycharly: I think we should try to be consistent. For example i'm not sure we need different types for in repo config than central config.

Why not stick with the `Presubmit` and `Postsubmit` structs ?
jstrachan: we're using the same structs for global configuration. its more a question of what the YAML should look like for in repo configurations
eddycharly: @jstrachan i find it suspicious that you don't have to change anything in keeper too (does keeper needs to know. about the jobs coming from the repo ?).

I am not completely sure but that should be worth double checking. Maybe @abayer can confirm if keeper has to be adapted or not.
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 **eddycharly**
You can assign the PR to them by writing `/assign @eddycharly` 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":["eddycharly"]} -->
jstrachan: OK I've just pushed a different approach of just adding in-repo configuration. Its using the InRepoConfig from Prow so that the global configuration is prow compatible. There's now no need for a new plugin at all + we just optionally use custom in-repo configuration versions of the config + plugins that are passed into the plugins. 

It turned out to be a pretty simple change to webhooks/event.go - with hindsight I probably should have tried this approach first rather than the plugin ;) 

Here's a little test which verifies that a mostly empty global config (apart from the `InRepoConfig`) manages to find presubmits/postsubmits and triggers etc
https://github.com/jstrachan/lighthouse/blob/local-config-plugin/pkg/webhook/webhook_test.go#L291
jenkins-x-bot: @jstrachan: The following tests **failed**, say `/retest` to rerun them all:

Test name | Commit | Details | Rerun command
--- | --- | --- | ---
pr-build | b3cdf238f2571cbdff1f7b41c36ee18922bd3191 | [link](https://dashboard-jx.jenkins-x.live/teams/jx/projects/jenkins-x/lighthouse/PR-1004/13) | `/test pr-build`
ghe | b3cdf238f2571cbdff1f7b41c36ee18922bd3191 | [link](https://dashboard-jx.jenkins-x.live/teams/jx/projects/jenkins-x/lighthouse/PR-1004/14) | `/test ghe`

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

<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
--- | --- | --- | ---
pr-build | b3cdf238f2571cbdff1f7b41c36ee18922bd3191 | [link](https://dashboard-jx.jenkins-x.live/teams/jx/projects/jenkins-x/lighthouse/PR-1004/13) | `/test pr-build`
ghe | b3cdf238f2571cbdff1f7b41c36ee18922bd3191 | [link](https://dashboard-jx.jenkins-x.live/teams/jx/projects/jenkins-x/lighthouse/PR-1004/14) | `/test ghe`
bbs | b3cdf238f2571cbdff1f7b41c36ee18922bd3191 | [link](https://dashboard-jx.jenkins-x.live/teams/jx/projects/jenkins-x/lighthouse/PR-1004/16) | `/test bbs`

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

<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
--- | --- | --- | ---
pr-build | b3cdf238f2571cbdff1f7b41c36ee18922bd3191 | [link](https://dashboard-jx.jenkins-x.live/teams/jx/projects/jenkins-x/lighthouse/PR-1004/13) | `/test pr-build`
ghe | b3cdf238f2571cbdff1f7b41c36ee18922bd3191 | [link](https://dashboard-jx.jenkins-x.live/teams/jx/projects/jenkins-x/lighthouse/PR-1004/14) | `/test ghe`
bbs | b3cdf238f2571cbdff1f7b41c36ee18922bd3191 | [link](https://dashboard-jx.jenkins-x.live/teams/jx/projects/jenkins-x/lighthouse/PR-1004/16) | `/test bbs`
gitlab | b3cdf238f2571cbdff1f7b41c36ee18922bd3191 | [link](https://dashboard-jx.jenkins-x.live/teams/jx/projects/jenkins-x/lighthouse/PR-1004/17) | `/test gitlab`

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

<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
--- | --- | --- | ---
pr-build | b3cdf238f2571cbdff1f7b41c36ee18922bd3191 | [link](https://dashboard-jx.jenkins-x.live/teams/jx/projects/jenkins-x/lighthouse/PR-1004/13) | `/test pr-build`
ghe | b3cdf238f2571cbdff1f7b41c36ee18922bd3191 | [link](https://dashboard-jx.jenkins-x.live/teams/jx/projects/jenkins-x/lighthouse/PR-1004/14) | `/test ghe`
bbs | b3cdf238f2571cbdff1f7b41c36ee18922bd3191 | [link](https://dashboard-jx.jenkins-x.live/teams/jx/projects/jenkins-x/lighthouse/PR-1004/16) | `/test bbs`
gitlab | b3cdf238f2571cbdff1f7b41c36ee18922bd3191 | [link](https://dashboard-jx.jenkins-x.live/teams/jx/projects/jenkins-x/lighthouse/PR-1004/17) | `/test gitlab`
github | b3cdf238f2571cbdff1f7b41c36ee18922bd3191 | [link](https://dashboard-jx.jenkins-x.live/teams/jx/projects/jenkins-x/lighthouse/PR-1004/15) | `/test github`

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

<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 -->
eddycharly: It looks quite better indeed 👍 

When loading the jobs from the repository, it would make sense to take all refs into account before loading. The related code in prow lives [here](https://github.com/kubernetes/test-infra/blob/2efbce017d1a6413667320cd8f979fd40b8ac7b5/prow/config/inrepoconfig.go#L51-L121)

jenkins-x-bot: @jstrachan: The following test **failed**, say `/retest` to rerun them all:

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

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

<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
--- | --- | --- | ---
gitlab | ca2d5b8785de613948029ae80f3227d77098ee8e | [link](https://dashboard-jx.jenkins-x.live/teams/jx/projects/jenkins-x/lighthouse/PR-1004/29) | `/test gitlab`
pr-build | f851924dac07b5643d3baef4f2850a7cb7e3f3ef | [link](https://dashboard-jx.jenkins-x.live/teams/jx/projects/jenkins-x/lighthouse/PR-1004/31) | `/test pr-build`

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

<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 -->
jstrachan: /retest
eddycharly: About the lighthouse and plugins config in the repo, I’m not sure how this would work. All the config could then be different from one branch to another ?

If so, I could just change the config in my branch to get a pr merged without any job, review or approval ?

If the implementation allows such use cases I find it quite dangerous. 

About the pre and post submit jobs, I would definitely merge the refs before loading the config from the repo. If we don’t do that, it opens doors for a pr being green and getting red once it’s merged. 
jstrachan: > About the lighthouse and plugins config in the repo, I’m not sure how this would work. All the config could then be different from one branch to another ?

Maybe we just park the idea of loading the lighthouse and plugins config in repo for now? The main thing I really want is in repo triggers (presubmit/postsubmits)


> About the pre and post submit jobs, I would definitely merge the refs before loading the config from the repo. If we don’t do that, it opens doors for a pr being green and getting red once it’s merged.

Currently we load the pre/post submits from the main branch only so we don't use the contents of the branch or need to merge refs so folks can't disable presubmits on a PR or whatever.
jstrachan: BTW I've removed everything from the [triggerconfig.ConfigSpec](https://github.com/jstrachan/lighthouse/blob/local-config-plugin/pkg/triggerconfig/types.go#L20) now other than presubmits/postsubmits to keep things nice and simple
jstrachan: @eddycharly OK I've removed the in repository configuration of lighthouse + plugins. I'm not sure how useful it was anyway & its hard to reason about. 

So things are much simpler now: in repository trigger configuration (presubmits/postsubmits) which are really useful
eddycharly: Thanks, I will take a look tomorrow.

I feel like we have two points to address in order to make the feature consistent:
- fetching in repo jobs from the main branch only looks not ideal, the in repo jobs should be bound to the branch/pr they belong to
- keeper should know about in repo jobs too, so maybe fetching the in repo config jobs should be built in the config itself and not specific to an agent ?

For the in repo jobs per branch, imagine I have repo with a nodejs app that uses nodejs 8, and I want to migrate to nodejs 12. I should be able to create a branch and use nodejs 12 in my build pipeline for this branch. 
abayer: Yeah, Keeper _has_ to know the presubmit jobs and whether they're required so it can determine whether the required jobs have passed and trigger those jobs if the required jobs have passed but against an older version of the target branch.
jstrachan: OK I've pushed a rebased/merged update which also includes the new `Validate()` methods on config/plugins and I've moved the in repo calculate code into a separate package so its now shared between webhooks + keeper

> * fetching in repo jobs from the main branch only looks not ideal, the in repo jobs should be bound to the branch/pr they belong to

So long as the in-repo presubmits/postsubmits are merged with whatever is in the shared repo, you're cool with loading the in repo triggers from the branch being triggered right? I wasn't sure if you wanted to avoid the possibility of folks removing in-repo presubmit triggers from a PR. 


> * keeper should know about in repo jobs too, so maybe fetching the in repo config jobs should be built in the config itself and not specific to an agent ?

keeper now shares the same in-repo config code as webhooks/plugins/trigger etc.

> For the in repo jobs per branch, imagine I have repo with a nodejs app that uses nodejs 8, and I want to migrate to nodejs 12. I should be able to create a branch and use nodejs 12 in my build pipeline for this branch.


jenkins-x-bot: @jstrachan: The following test **failed**, say `/retest` to rerun them all:

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

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

<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
--- | --- | --- | ---
pr-build | 079a2a94ebc1d78b20b3e5196439d912ce19021d | [link](https://dashboard-jx.jenkins-x.live/teams/jx/projects/jenkins-x/lighthouse/PR-1004/62) | `/test pr-build`
ghe | 079a2a94ebc1d78b20b3e5196439d912ce19021d | [link](https://dashboard-jx.jenkins-x.live/teams/jx/projects/jenkins-x/lighthouse/PR-1004/63) | `/test ghe`

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

<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
--- | --- | --- | ---
pr-build | 079a2a94ebc1d78b20b3e5196439d912ce19021d | [link](https://dashboard-jx.jenkins-x.live/teams/jx/projects/jenkins-x/lighthouse/PR-1004/62) | `/test pr-build`
ghe | 079a2a94ebc1d78b20b3e5196439d912ce19021d | [link](https://dashboard-jx.jenkins-x.live/teams/jx/projects/jenkins-x/lighthouse/PR-1004/63) | `/test ghe`
github | 079a2a94ebc1d78b20b3e5196439d912ce19021d | [link](https://dashboard-jx.jenkins-x.live/teams/jx/projects/jenkins-x/lighthouse/PR-1004/64) | `/test github`

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

<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
--- | --- | --- | ---
pr-build | 079a2a94ebc1d78b20b3e5196439d912ce19021d | [link](https://dashboard-jx.jenkins-x.live/teams/jx/projects/jenkins-x/lighthouse/PR-1004/62) | `/test pr-build`
ghe | 079a2a94ebc1d78b20b3e5196439d912ce19021d | [link](https://dashboard-jx.jenkins-x.live/teams/jx/projects/jenkins-x/lighthouse/PR-1004/63) | `/test ghe`
github | 079a2a94ebc1d78b20b3e5196439d912ce19021d | [link](https://dashboard-jx.jenkins-x.live/teams/jx/projects/jenkins-x/lighthouse/PR-1004/64) | `/test github`
gitlab | 079a2a94ebc1d78b20b3e5196439d912ce19021d | [link](https://dashboard-jx.jenkins-x.live/teams/jx/projects/jenkins-x/lighthouse/PR-1004/66) | `/test gitlab`

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

<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
--- | --- | --- | ---
pr-build | 079a2a94ebc1d78b20b3e5196439d912ce19021d | [link](https://dashboard-jx.jenkins-x.live/teams/jx/projects/jenkins-x/lighthouse/PR-1004/62) | `/test pr-build`
ghe | 079a2a94ebc1d78b20b3e5196439d912ce19021d | [link](https://dashboard-jx.jenkins-x.live/teams/jx/projects/jenkins-x/lighthouse/PR-1004/63) | `/test ghe`
github | 079a2a94ebc1d78b20b3e5196439d912ce19021d | [link](https://dashboard-jx.jenkins-x.live/teams/jx/projects/jenkins-x/lighthouse/PR-1004/64) | `/test github`
gitlab | 079a2a94ebc1d78b20b3e5196439d912ce19021d | [link](https://dashboard-jx.jenkins-x.live/teams/jx/projects/jenkins-x/lighthouse/PR-1004/66) | `/test gitlab`
bbs | 079a2a94ebc1d78b20b3e5196439d912ce19021d | [link](https://dashboard-jx.jenkins-x.live/teams/jx/projects/jenkins-x/lighthouse/PR-1004/65) | `/test bbs`

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

<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 -->
jstrachan: @eddycharly OK I just pushed a change where we use the Pull Request ref/sha to query in-repo triggers (presubmit/postsubmits) 
eddycharly: @jstrachan I looked quickly and it’s great that you reused the existing structs.

I still think that we should merge before loading in repo jobs. IMO prow had the correct approach, embedding the feature in the config domain. 
jstrachan: @eddycharly so rather than reading the files from the git branch directly, you'd rather do a git clone + then merge the PR with whatever master is at then read that right?

I guess we'd only need to do that when handling PRs right? 
eddycharly: Yes, the file that we load should be the result of a merge when multiple refs are involved.

When handling a push there will be a single ref so merging will not happen.
eddycharly: For example you have a job A on master that is not present in a branch.

When the PR is tested, without merging, it doesn’t see job A. Unfortunately the PR breaks job A and when you merge, job A suddenly fails.

Merging before loading the job prevents that, because testing the PR now knows about job A and the failure is detected before the PR gets merged. 
jstrachan: @eddycharly from an implementation perspective, could we load the in repo triggers from the master branch and apply any additions/overrides from the PR/sha? Then a PR doesn't miss anything from the main branch?
jstrachan: @eddycharly just pushed a simple implementation of loading from the main branch + merging in any changes from the PR/branch
jstrachan: once this https://github.com/jenkins-x/go-scm/pull/173 merges I've more tests for the PR / main branch merge logic
jstrachan: @eddycharly here's a little unit test that verifies we merge the triggers from master and the PR together (so that no trigger from master is removed; though it can be changed)
https://github.com/jstrachan/lighthouse/blob/local-config-plugin/pkg/triggerconfig/inrepo/calculate_test.go#L75-L108

also added a validation test that there's no duplicate triggers (presubmit/postsubmits) in a branch when loading - with nice error messages of the problem files + triggers
https://github.com/jstrachan/lighthouse/blob/local-config-plugin/pkg/triggerconfig/scmload/load_triggers_test.go#L32-L42
jenkins-x-bot: @jstrachan: The following test **failed**, say `/retest` to rerun them all:

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

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

<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
--- | --- | --- | ---
pr-build | aa39fe82c2c787baec17602f5c5ffeebc282d0ad | [link](https://dashboard-jx.jenkins-x.live/teams/jx/projects/jenkins-x/lighthouse/PR-1004/87) | `/test pr-build`
gitlab | b34689c5a378b7beb2a9d5351a4e240c6cf7ef12 | [link](https://dashboard-jx.jenkins-x.live/teams/jx/projects/jenkins-x/lighthouse/PR-1004/96) | `/test gitlab`

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

<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
--- | --- | --- | ---
pr-build | aa39fe82c2c787baec17602f5c5ffeebc282d0ad | [link](https://dashboard-jx.jenkins-x.live/teams/jx/projects/jenkins-x/lighthouse/PR-1004/87) | `/test pr-build`
gitlab | b34689c5a378b7beb2a9d5351a4e240c6cf7ef12 | [link](https://dashboard-jx.jenkins-x.live/teams/jx/projects/jenkins-x/lighthouse/PR-1004/96) | `/test gitlab`
bbs | b34689c5a378b7beb2a9d5351a4e240c6cf7ef12 | [link](https://dashboard-jx.jenkins-x.live/teams/jx/projects/jenkins-x/lighthouse/PR-1004/95) | `/test bbs`

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

<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
--- | --- | --- | ---
pr-build | aa39fe82c2c787baec17602f5c5ffeebc282d0ad | [link](https://dashboard-jx.jenkins-x.live/teams/jx/projects/jenkins-x/lighthouse/PR-1004/87) | `/test pr-build`
gitlab | b34689c5a378b7beb2a9d5351a4e240c6cf7ef12 | [link](https://dashboard-jx.jenkins-x.live/teams/jx/projects/jenkins-x/lighthouse/PR-1004/96) | `/test gitlab`
bbs | b34689c5a378b7beb2a9d5351a4e240c6cf7ef12 | [link](https://dashboard-jx.jenkins-x.live/teams/jx/projects/jenkins-x/lighthouse/PR-1004/95) | `/test bbs`
ghe | b34689c5a378b7beb2a9d5351a4e240c6cf7ef12 | [link](https://dashboard-jx.jenkins-x.live/teams/jx/projects/jenkins-x/lighthouse/PR-1004/93) | `/test ghe`

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

<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
--- | --- | --- | ---
pr-build | aa39fe82c2c787baec17602f5c5ffeebc282d0ad | [link](https://dashboard-jx.jenkins-x.live/teams/jx/projects/jenkins-x/lighthouse/PR-1004/87) | `/test pr-build`
gitlab | b34689c5a378b7beb2a9d5351a4e240c6cf7ef12 | [link](https://dashboard-jx.jenkins-x.live/teams/jx/projects/jenkins-x/lighthouse/PR-1004/96) | `/test gitlab`
bbs | b34689c5a378b7beb2a9d5351a4e240c6cf7ef12 | [link](https://dashboard-jx.jenkins-x.live/teams/jx/projects/jenkins-x/lighthouse/PR-1004/95) | `/test bbs`
ghe | b34689c5a378b7beb2a9d5351a4e240c6cf7ef12 | [link](https://dashboard-jx.jenkins-x.live/teams/jx/projects/jenkins-x/lighthouse/PR-1004/93) | `/test ghe`
github | aa39fe82c2c787baec17602f5c5ffeebc282d0ad | [link](https://dashboard-jx.jenkins-x.live/teams/jx/projects/jenkins-x/lighthouse/PR-1004/88) | `/test github`

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

<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
--- | --- | --- | ---
pr-build | aa39fe82c2c787baec17602f5c5ffeebc282d0ad | [link](https://dashboard-jx.jenkins-x.live/teams/jx/projects/jenkins-x/lighthouse/PR-1004/87) | `/test pr-build`
gitlab | b34689c5a378b7beb2a9d5351a4e240c6cf7ef12 | [link](https://dashboard-jx.jenkins-x.live/teams/jx/projects/jenkins-x/lighthouse/PR-1004/96) | `/test gitlab`
bbs | b34689c5a378b7beb2a9d5351a4e240c6cf7ef12 | [link](https://dashboard-jx.jenkins-x.live/teams/jx/projects/jenkins-x/lighthouse/PR-1004/95) | `/test bbs`
ghe | b34689c5a378b7beb2a9d5351a4e240c6cf7ef12 | [link](https://dashboard-jx.jenkins-x.live/teams/jx/projects/jenkins-x/lighthouse/PR-1004/93) | `/test ghe`
github | aa39fe82c2c787baec17602f5c5ffeebc282d0ad | [link](https://dashboard-jx.jenkins-x.live/teams/jx/projects/jenkins-x/lighthouse/PR-1004/88) | `/test github`
tekton | b34689c5a378b7beb2a9d5351a4e240c6cf7ef12 | [link](https://dashboard-jx.jenkins-x.live/teams/jx/projects/jenkins-x/lighthouse/PR-1004/97) | `/test tekton`

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

<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 -->
eddycharly: > @eddycharly here's a little unit test that verifies we merge the triggers from master and the PR branch/ref together (so that no trigger from master is removed; though it can be changed in a branch/PR)

I would argue that it's not an issue if the job was changed, the PR still has to be reviewed/approved so if the change is not legitimate it should simply not be approved.
jstrachan: /retest
eddycharly: @jstrachan thanks for those improvements.

I think we can start with something like this and eventually improve if necessary.

In the end, what do you think about the prow approach ? Wouldn't it have been easier to just change the `GetPreesubmits` and `GetPostsubmits` methods in the `Config` ?
jenkins-x-bot: @jstrachan: The following tests **failed**, say `/retest` to rerun them all:

Test name | Commit | Details | Rerun command
--- | --- | --- | ---
tekton | b34689c5a378b7beb2a9d5351a4e240c6cf7ef12 | [link](https://dashboard-jx.jenkins-x.live/teams/jx/projects/jenkins-x/lighthouse/PR-1004/97) | `/test tekton`
bbs | aa39fe82c2c787baec17602f5c5ffeebc282d0ad | [link](https://dashboard-jx.jenkins-x.live/teams/jx/projects/jenkins-x/lighthouse/PR-1004/89) | `/test bbs`

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

<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 -->
jstrachan: > @jstrachan thanks for those improvements.
> 
> I think we can start with something like this and eventually improve if necessary.

great stuff, thanks for all your feedback. We're definitely in a massively better place than when I first raised this PR :) 


> In the end, what do you think about the prow approach ? Wouldn't it have been easier to just change the `GetPreesubmits` and `GetPostsubmits` methods in the `Config` ?

Those methods just filter the presubmits/postsubmits by repo name based on the in memory struct right? There still needs to be code to load the in repo configs from the specific repo + make a new struct - unless I'm misunderstanding which bit of prow code you are talking about? We also need triggers for all presubmit/postsubmits as well; its not just those 2 slices.

I think the LH & prow code for in repo config are pretty similar now really; both using the same `InRepoConfig / Presubmit / PostSubmit` structs etc. The main difference is how the actual repository + ref specific triggers are loaded. Using go-scm to access the config means we don't have to do a full git clone as there's usually only one or two small trigger files to load from each ref/repo.
eddycharly: > Those methods just filter the presubmits/postsubmits by repo name based on the in memory struct right?

Nope, they checkout and merge refs together then load/validate the in repo config in the centralized config.

`GetPresubmits` calls `getProwYAML`:
```go
func (c *Config) GetPresubmits(gc git.ClientFactory, identifier string, baseSHAGetter RefGetter, headSHAGetters ...RefGetter) ([]Presubmit, error) {
	prowYAML, err := c.getProwYAML(gc, identifier, baseSHAGetter, headSHAGetters...)
	if err != nil {
		return nil, err
	}

	return append(c.PresubmitsStatic[identifier], prowYAML.Presubmits...), nil
}
```

and `getProwYAML` uses a `ProwYAMLGetter` that is responsible of loading the jobs from the repo:
```go
func (c *Config) getProwYAML(gc git.ClientFactory, identifier string, baseSHAGetter RefGetter, headSHAGetters ...RefGetter) (*ProwYAML, error) {
	if identifier == "" {
		return nil, errors.New("no identifier for repo given")
	}
	if !c.InRepoConfigEnabled(identifier) {
		return &ProwYAML{}, nil
	}

	baseSHA, err := baseSHAGetter()
	if err != nil {
		return nil, fmt.Errorf("failed to get baseSHA: %v", err)
	}
	var headSHAs []string
	for _, headSHAGetter := range headSHAGetters {
		headSHA, err := headSHAGetter()
		if err != nil {
			return nil, fmt.Errorf("failed to get headRef: %v", err)
		}
		headSHAs = append(headSHAs, headSHA)
	}
	prowYAML, err := c.ProwYAMLGetter(c, gc, identifier, baseSHA, headSHAs...)
	if err != nil {
		return nil, err
	}

	return prowYAML, nil
}
```

The default `ProwYAMLGetter` is [here](https://github.com/kubernetes/test-infra/blob/ea4b110151f5357d3c87afa7d8ea4208b0e759fc/prow/config/inrepoconfig.go#L51-L121), it does all the checkout + merging refs + loading jobs:
```go
func defaultProwYAMLGetter(
	c *Config,
	gc git.ClientFactory,
	identifier string,
	baseSHA string,
	headSHAs ...string) (*ProwYAML, error) {

	log := logrus.WithField("repo", identifier)
	log.Debugf("Attempting to get %q.", inRepoConfigFileName)

	if gc == nil {
		log.Error("defaultProwYAMLGetter was called with a nil git client")
		return nil, errors.New("gitClient is nil")
	}

	orgRepo := *NewOrgRepo(identifier)
	if orgRepo.Repo == "" {
		return nil, fmt.Errorf("didn't get two results when splitting repo identifier %q", identifier)
	}
	repo, err := gc.ClientFor(orgRepo.Org, orgRepo.Repo)
	if err != nil {
		return nil, fmt.Errorf("failed to clone repo for %q: %v", identifier, err)
	}
	defer func() {
		if err := repo.Clean(); err != nil {
			log.WithError(err).Error("Failed to clean up repo.")
		}
	}()

	if err := repo.Config("user.name", "prow"); err != nil {
		return nil, err
	}
	if err := repo.Config("user.email", "prow@localhost"); err != nil {
		return nil, err
	}
	if err := repo.Config("commit.gpgsign", "false"); err != nil {
		return nil, err
	}

	mergeMethod := c.Tide.MergeMethod(orgRepo)
	log.Debugf("Using merge strategy %q.", mergeMethod)
	if err := repo.MergeAndCheckout(baseSHA, string(mergeMethod), headSHAs...); err != nil {
		return nil, fmt.Errorf("failed to merge: %v", err)
	}

	prowYAMLFilePath := path.Join(repo.Directory(), inRepoConfigFileName)
	if _, err := os.Stat(prowYAMLFilePath); err != nil {
		if os.IsNotExist(err) {
			log.Debugf("File %q does not exist.", inRepoConfigFileName)
			return &ProwYAML{}, nil
		}
		return nil, fmt.Errorf("failed to check if file %q exists: %v", inRepoConfigFileName, err)
	}

	bytes, err := ioutil.ReadFile(prowYAMLFilePath)
	if err != nil {
		return nil, fmt.Errorf("failed to read %q: %v", inRepoConfigFileName, err)
	}

	prowYAML := &ProwYAML{}
	if err := yaml.Unmarshal(bytes, prowYAML); err != nil {
		return nil, fmt.Errorf("failed to unmarshal %q: %v", inRepoConfigFileName, err)
	}

	if err := DefaultAndValidateProwYAML(c, prowYAML, identifier); err != nil {
		return nil, err
	}

	log.Debugf("Successfully got %d presubmits and %d postsubmits from %q.", len(prowYAML.Presubmits), len(prowYAML.Postsubmits), inRepoConfigFileName)
	return prowYAML, nil
}
```


jstrachan: > > The main difference is how the actual repository + ref specific triggers are loaded. Using go-scm to access the config means we don't have to do a full git clone as there's usually only one or two small trigger files to load from each ref/repo.
> 
> This would be easily feasible with the prow approach, it's really just another `ProwYAMLGetter` implementation that calls the provider API instead of git clone/git merge.

the thing I like about the current LH codebase is simplicity; for each webhook on each repo there's a single call to create theLH config / prow configs from the repository/sha without worrying about caching or anything; the structs are then shared across all invocations of all plugins - irrespective of what methods the plugins call. 

i.e. as soon as the webhook invokes plugins for a repo/sha they all share the same in memory structs. My worry with adding the loading code inside those 2 method calls inside the config object and then exposing that API to all plugins whenever some code wants a presubmit/postsubmit is having lots of git clone / go-scm calls for the same webhook. It also isolates the code so we can make any change we want to anything in the combined lighthouse + prow config based on in-repo data in a single place (e.g. enabling triggers if they are missing on a repo). Over time we may think of other things we want to change
eddycharly: @jstrachan you need to rebase
jstrachan: @eddycharly done
abayer: @jstrachan Any chance you could squash down the commits?
jstrachan: @abayer done
jenkins-x-bot: @jstrachan: The following test **failed**, say `/retest` to rerun them all:

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

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

<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 -->
jstrachan: /retest
eddycharly: /lgtm
/hold

LGTM from me but i'll leave final approval to @abayer


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

This pull-request has been approved by: *[eddycharly](https://github.com/jenkins-x/lighthouse/pull/1004#issuecomment-692734411 "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-692734411/jenkins-x/lighthouse/blob/master/OWNERS)~~ [eddycharly]

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: New changes are detected. LGTM label has been removed.
jenkins-x-bot: [APPROVALNOTIFIER] This PR is **APPROVED**

This pull-request has been approved by: *[eddycharly](https://github.com/jenkins-x/lighthouse/pull/1004#issuecomment-692734411 "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/jenkins-x/lighthouse/blob/master/OWNERS)~~ [eddycharly]

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: @jstrachan: The following test **failed**, say `/retest` to rerun them all:

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

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

<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 | b7fd108e2b17f78826f30fe5e192a7d18063152e | [link](https://dashboard-jx.jenkins-x.live/teams/jx/projects/jenkins-x/lighthouse/PR-1004/115) | `/test ghe`
github | b7fd108e2b17f78826f30fe5e192a7d18063152e | [link](https://dashboard-jx.jenkins-x.live/teams/jx/projects/jenkins-x/lighthouse/PR-1004/117) | `/test github`

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

<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 | b7fd108e2b17f78826f30fe5e192a7d18063152e | [link](https://dashboard-jx.jenkins-x.live/teams/jx/projects/jenkins-x/lighthouse/PR-1004/115) | `/test ghe`
github | b7fd108e2b17f78826f30fe5e192a7d18063152e | [link](https://dashboard-jx.jenkins-x.live/teams/jx/projects/jenkins-x/lighthouse/PR-1004/117) | `/test github`
bbs | b7fd108e2b17f78826f30fe5e192a7d18063152e | [link](https://dashboard-jx.jenkins-x.live/teams/jx/projects/jenkins-x/lighthouse/PR-1004/118) | `/test bbs`

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

<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 | b7fd108e2b17f78826f30fe5e192a7d18063152e | [link](https://dashboard-jx.jenkins-x.live/teams/jx/projects/jenkins-x/lighthouse/PR-1004/115) | `/test ghe`
github | b7fd108e2b17f78826f30fe5e192a7d18063152e | [link](https://dashboard-jx.jenkins-x.live/teams/jx/projects/jenkins-x/lighthouse/PR-1004/117) | `/test github`
bbs | b7fd108e2b17f78826f30fe5e192a7d18063152e | [link](https://dashboard-jx.jenkins-x.live/teams/jx/projects/jenkins-x/lighthouse/PR-1004/118) | `/test bbs`
gitlab | b7fd108e2b17f78826f30fe5e192a7d18063152e | [link](https://dashboard-jx.jenkins-x.live/teams/jx/projects/jenkins-x/lighthouse/PR-1004/119) | `/test gitlab`

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

<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 | b7fd108e2b17f78826f30fe5e192a7d18063152e | [link](https://dashboard-jx.jenkins-x.live/teams/jx/projects/jenkins-x/lighthouse/PR-1004/115) | `/test ghe`
github | b7fd108e2b17f78826f30fe5e192a7d18063152e | [link](https://dashboard-jx.jenkins-x.live/teams/jx/projects/jenkins-x/lighthouse/PR-1004/117) | `/test github`
bbs | b7fd108e2b17f78826f30fe5e192a7d18063152e | [link](https://dashboard-jx.jenkins-x.live/teams/jx/projects/jenkins-x/lighthouse/PR-1004/118) | `/test bbs`
gitlab | b7fd108e2b17f78826f30fe5e192a7d18063152e | [link](https://dashboard-jx.jenkins-x.live/teams/jx/projects/jenkins-x/lighthouse/PR-1004/119) | `/test gitlab`
tekton | b7fd108e2b17f78826f30fe5e192a7d18063152e | [link](https://dashboard-jx.jenkins-x.live/teams/jx/projects/jenkins-x/lighthouse/PR-1004/120) | `/test tekton`

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

<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 | b7fd108e2b17f78826f30fe5e192a7d18063152e | [link](https://dashboard-jx.jenkins-x.live/teams/jx/projects/jenkins-x/lighthouse/PR-1004/115) | `/test ghe`
github | b7fd108e2b17f78826f30fe5e192a7d18063152e | [link](https://dashboard-jx.jenkins-x.live/teams/jx/projects/jenkins-x/lighthouse/PR-1004/117) | `/test github`
bbs | b7fd108e2b17f78826f30fe5e192a7d18063152e | [link](https://dashboard-jx.jenkins-x.live/teams/jx/projects/jenkins-x/lighthouse/PR-1004/118) | `/test bbs`
gitlab | b7fd108e2b17f78826f30fe5e192a7d18063152e | [link](https://dashboard-jx.jenkins-x.live/teams/jx/projects/jenkins-x/lighthouse/PR-1004/119) | `/test gitlab`
tekton | b7fd108e2b17f78826f30fe5e192a7d18063152e | [link](https://dashboard-jx.jenkins-x.live/teams/jx/projects/jenkins-x/lighthouse/PR-1004/120) | `/test tekton`
pr-build | b7fd108e2b17f78826f30fe5e192a7d18063152e | [link](https://dashboard-jx.jenkins-x.live/teams/jx/projects/jenkins-x/lighthouse/PR-1004/116) | `/test pr-build`

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

<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 -->
jstrachan: /retest
jenkins-x-bot: @jstrachan: The following tests **failed**, say `/retest` to rerun them all:

Test name | Commit | Details | Rerun command
--- | --- | --- | ---
ghe | b7fd108e2b17f78826f30fe5e192a7d18063152e | [link](https://dashboard-jx.jenkins-x.live/teams/jx/projects/jenkins-x/lighthouse/PR-1004/115) | `/test ghe`
github | b7fd108e2b17f78826f30fe5e192a7d18063152e | [link](https://dashboard-jx.jenkins-x.live/teams/jx/projects/jenkins-x/lighthouse/PR-1004/117) | `/test github`
bbs | b7fd108e2b17f78826f30fe5e192a7d18063152e | [link](https://dashboard-jx.jenkins-x.live/teams/jx/projects/jenkins-x/lighthouse/PR-1004/118) | `/test bbs`
gitlab | b7fd108e2b17f78826f30fe5e192a7d18063152e | [link](https://dashboard-jx.jenkins-x.live/teams/jx/projects/jenkins-x/lighthouse/PR-1004/119) | `/test gitlab`
tekton | b7fd108e2b17f78826f30fe5e192a7d18063152e | [link](https://dashboard-jx.jenkins-x.live/teams/jx/projects/jenkins-x/lighthouse/PR-1004/120) | `/test tekton`
pr-build | b7fd108e2b17f78826f30fe5e192a7d18063152e | [link](https://dashboard-jx.jenkins-x.live/teams/jx/projects/jenkins-x/lighthouse/PR-1004/121) | `/test pr-build`

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

<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
--- | --- | --- | ---
github | b7fd108e2b17f78826f30fe5e192a7d18063152e | [link](https://dashboard-jx.jenkins-x.live/teams/jx/projects/jenkins-x/lighthouse/PR-1004/117) | `/test github`
bbs | b7fd108e2b17f78826f30fe5e192a7d18063152e | [link](https://dashboard-jx.jenkins-x.live/teams/jx/projects/jenkins-x/lighthouse/PR-1004/118) | `/test bbs`
gitlab | b7fd108e2b17f78826f30fe5e192a7d18063152e | [link](https://dashboard-jx.jenkins-x.live/teams/jx/projects/jenkins-x/lighthouse/PR-1004/119) | `/test gitlab`
tekton | b7fd108e2b17f78826f30fe5e192a7d18063152e | [link](https://dashboard-jx.jenkins-x.live/teams/jx/projects/jenkins-x/lighthouse/PR-1004/120) | `/test tekton`
pr-build | b7fd108e2b17f78826f30fe5e192a7d18063152e | [link](https://dashboard-jx.jenkins-x.live/teams/jx/projects/jenkins-x/lighthouse/PR-1004/121) | `/test pr-build`
ghe | b7fd108e2b17f78826f30fe5e192a7d18063152e | [link](https://dashboard-jx.jenkins-x.live/teams/jx/projects/jenkins-x/lighthouse/PR-1004/122) | `/test ghe`

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

<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 | b7fd108e2b17f78826f30fe5e192a7d18063152e | [link](https://dashboard-jx.jenkins-x.live/teams/jx/projects/jenkins-x/lighthouse/PR-1004/118) | `/test bbs`
gitlab | b7fd108e2b17f78826f30fe5e192a7d18063152e | [link](https://dashboard-jx.jenkins-x.live/teams/jx/projects/jenkins-x/lighthouse/PR-1004/119) | `/test gitlab`
tekton | b7fd108e2b17f78826f30fe5e192a7d18063152e | [link](https://dashboard-jx.jenkins-x.live/teams/jx/projects/jenkins-x/lighthouse/PR-1004/120) | `/test tekton`
pr-build | b7fd108e2b17f78826f30fe5e192a7d18063152e | [link](https://dashboard-jx.jenkins-x.live/teams/jx/projects/jenkins-x/lighthouse/PR-1004/121) | `/test pr-build`
ghe | b7fd108e2b17f78826f30fe5e192a7d18063152e | [link](https://dashboard-jx.jenkins-x.live/teams/jx/projects/jenkins-x/lighthouse/PR-1004/122) | `/test ghe`
github | b7fd108e2b17f78826f30fe5e192a7d18063152e | [link](https://dashboard-jx.jenkins-x.live/teams/jx/projects/jenkins-x/lighthouse/PR-1004/123) | `/test github`

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

<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
--- | --- | --- | ---
gitlab | b7fd108e2b17f78826f30fe5e192a7d18063152e | [link](https://dashboard-jx.jenkins-x.live/teams/jx/projects/jenkins-x/lighthouse/PR-1004/119) | `/test gitlab`
tekton | b7fd108e2b17f78826f30fe5e192a7d18063152e | [link](https://dashboard-jx.jenkins-x.live/teams/jx/projects/jenkins-x/lighthouse/PR-1004/120) | `/test tekton`
pr-build | b7fd108e2b17f78826f30fe5e192a7d18063152e | [link](https://dashboard-jx.jenkins-x.live/teams/jx/projects/jenkins-x/lighthouse/PR-1004/121) | `/test pr-build`
ghe | b7fd108e2b17f78826f30fe5e192a7d18063152e | [link](https://dashboard-jx.jenkins-x.live/teams/jx/projects/jenkins-x/lighthouse/PR-1004/122) | `/test ghe`
github | b7fd108e2b17f78826f30fe5e192a7d18063152e | [link](https://dashboard-jx.jenkins-x.live/teams/jx/projects/jenkins-x/lighthouse/PR-1004/123) | `/test github`
bbs | b7fd108e2b17f78826f30fe5e192a7d18063152e | [link](https://dashboard-jx.jenkins-x.live/teams/jx/projects/jenkins-x/lighthouse/PR-1004/124) | `/test bbs`

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

<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
--- | --- | --- | ---
tekton | b7fd108e2b17f78826f30fe5e192a7d18063152e | [link](https://dashboard-jx.jenkins-x.live/teams/jx/projects/jenkins-x/lighthouse/PR-1004/120) | `/test tekton`
pr-build | b7fd108e2b17f78826f30fe5e192a7d18063152e | [link](https://dashboard-jx.jenkins-x.live/teams/jx/projects/jenkins-x/lighthouse/PR-1004/121) | `/test pr-build`
ghe | b7fd108e2b17f78826f30fe5e192a7d18063152e | [link](https://dashboard-jx.jenkins-x.live/teams/jx/projects/jenkins-x/lighthouse/PR-1004/122) | `/test ghe`
github | b7fd108e2b17f78826f30fe5e192a7d18063152e | [link](https://dashboard-jx.jenkins-x.live/teams/jx/projects/jenkins-x/lighthouse/PR-1004/123) | `/test github`
bbs | b7fd108e2b17f78826f30fe5e192a7d18063152e | [link](https://dashboard-jx.jenkins-x.live/teams/jx/projects/jenkins-x/lighthouse/PR-1004/124) | `/test bbs`
gitlab | b7fd108e2b17f78826f30fe5e192a7d18063152e | [link](https://dashboard-jx.jenkins-x.live/teams/jx/projects/jenkins-x/lighthouse/PR-1004/125) | `/test gitlab`

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

<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
--- | --- | --- | ---
pr-build | b7fd108e2b17f78826f30fe5e192a7d18063152e | [link](https://dashboard-jx.jenkins-x.live/teams/jx/projects/jenkins-x/lighthouse/PR-1004/121) | `/test pr-build`
ghe | b7fd108e2b17f78826f30fe5e192a7d18063152e | [link](https://dashboard-jx.jenkins-x.live/teams/jx/projects/jenkins-x/lighthouse/PR-1004/122) | `/test ghe`
github | b7fd108e2b17f78826f30fe5e192a7d18063152e | [link](https://dashboard-jx.jenkins-x.live/teams/jx/projects/jenkins-x/lighthouse/PR-1004/123) | `/test github`
bbs | b7fd108e2b17f78826f30fe5e192a7d18063152e | [link](https://dashboard-jx.jenkins-x.live/teams/jx/projects/jenkins-x/lighthouse/PR-1004/124) | `/test bbs`
gitlab | b7fd108e2b17f78826f30fe5e192a7d18063152e | [link](https://dashboard-jx.jenkins-x.live/teams/jx/projects/jenkins-x/lighthouse/PR-1004/125) | `/test gitlab`
tekton | b7fd108e2b17f78826f30fe5e192a7d18063152e | [link](https://dashboard-jx.jenkins-x.live/teams/jx/projects/jenkins-x/lighthouse/PR-1004/126) | `/test tekton`

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

<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 -->
jstrachan: /test pr-build
jenkins-x-bot: @jstrachan: The following tests **failed**, say `/retest` to rerun them all:

Test name | Commit | Details | Rerun command
--- | --- | --- | ---
ghe | b7fd108e2b17f78826f30fe5e192a7d18063152e | [link](https://dashboard-jx.jenkins-x.live/teams/jx/projects/jenkins-x/lighthouse/PR-1004/122) | `/test ghe`
github | b7fd108e2b17f78826f30fe5e192a7d18063152e | [link](https://dashboard-jx.jenkins-x.live/teams/jx/projects/jenkins-x/lighthouse/PR-1004/123) | `/test github`
bbs | b7fd108e2b17f78826f30fe5e192a7d18063152e | [link](https://dashboard-jx.jenkins-x.live/teams/jx/projects/jenkins-x/lighthouse/PR-1004/124) | `/test bbs`
gitlab | b7fd108e2b17f78826f30fe5e192a7d18063152e | [link](https://dashboard-jx.jenkins-x.live/teams/jx/projects/jenkins-x/lighthouse/PR-1004/125) | `/test gitlab`
tekton | b7fd108e2b17f78826f30fe5e192a7d18063152e | [link](https://dashboard-jx.jenkins-x.live/teams/jx/projects/jenkins-x/lighthouse/PR-1004/126) | `/test tekton`
pr-build | b7fd108e2b17f78826f30fe5e192a7d18063152e | [link](https://dashboard-jx.jenkins-x.live/teams/jx/projects/jenkins-x/lighthouse/PR-1004/127) | `/test pr-build`

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

<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 -->
abayer: Failures are due to athens proxy issues - https://github.com/jenkins-x/lighthouse/pull/1064/files#diff-37aff102a57d3d7b797f152915a6dc16 will fix them.
jenkins-x-bot: @jstrachan: The following tests **failed**, say `/retest` to rerun them all:

Test name | Commit | Details | Rerun command
--- | --- | --- | ---
ghe | b7fd108e2b17f78826f30fe5e192a7d18063152e | [link](https://dashboard-jx.jenkins-x.live/teams/jx/projects/jenkins-x/lighthouse/PR-1004/122) | `/test ghe`
github | b7fd108e2b17f78826f30fe5e192a7d18063152e | [link](https://dashboard-jx.jenkins-x.live/teams/jx/projects/jenkins-x/lighthouse/PR-1004/123) | `/test github`
bbs | b7fd108e2b17f78826f30fe5e192a7d18063152e | [link](https://dashboard-jx.jenkins-x.live/teams/jx/projects/jenkins-x/lighthouse/PR-1004/124) | `/test bbs`
gitlab | b7fd108e2b17f78826f30fe5e192a7d18063152e | [link](https://dashboard-jx.jenkins-x.live/teams/jx/projects/jenkins-x/lighthouse/PR-1004/125) | `/test gitlab`
pr-build | b7fd108e2b17f78826f30fe5e192a7d18063152e | [link](https://dashboard-jx.jenkins-x.live/teams/jx/projects/jenkins-x/lighthouse/PR-1004/127) | `/test pr-build`
tekton | 2f07053462f7da1ed1e4855390ecd9a9f5e70f32 | [link](https://dashboard-jx.jenkins-x.live/teams/jx/projects/jenkins-x/lighthouse/PR-1004/133) | `/test tekton`

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

<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 | b7fd108e2b17f78826f30fe5e192a7d18063152e | [link](https://dashboard-jx.jenkins-x.live/teams/jx/projects/jenkins-x/lighthouse/PR-1004/122) | `/test ghe`
bbs | b7fd108e2b17f78826f30fe5e192a7d18063152e | [link](https://dashboard-jx.jenkins-x.live/teams/jx/projects/jenkins-x/lighthouse/PR-1004/124) | `/test bbs`
tekton | 2f07053462f7da1ed1e4855390ecd9a9f5e70f32 | [link](https://dashboard-jx.jenkins-x.live/teams/jx/projects/jenkins-x/lighthouse/PR-1004/133) | `/test tekton`
gitlab | 2f07053462f7da1ed1e4855390ecd9a9f5e70f32 | [link](https://dashboard-jx.jenkins-x.live/teams/jx/projects/jenkins-x/lighthouse/PR-1004/132) | `/test gitlab`

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

<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 -->
jstrachan: /retest
jstrachan: /test ghe 
jstrachan: /test gitlab
jstrachan: /test bbs
jenkins-x-bot: @jstrachan: The following tests **failed**, say `/retest` to rerun them all:

Test name | Commit | Details | Rerun command
--- | --- | --- | ---
ghe | b7fd108e2b17f78826f30fe5e192a7d18063152e | [link](https://dashboard-jx.jenkins-x.live/teams/jx/projects/jenkins-x/lighthouse/PR-1004/122) | `/test ghe`
bbs | b7fd108e2b17f78826f30fe5e192a7d18063152e | [link](https://dashboard-jx.jenkins-x.live/teams/jx/projects/jenkins-x/lighthouse/PR-1004/124) | `/test bbs`
gitlab | 2f07053462f7da1ed1e4855390ecd9a9f5e70f32 | [link](https://dashboard-jx.jenkins-x.live/teams/jx/projects/jenkins-x/lighthouse/PR-1004/135) | `/test gitlab`

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

<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/dependency-matrix/matrix.md b/dependency-matrix/matrix.md
index 5667c466..ab2185be 100644
--- a/dependency-matrix/matrix.md
+++ b/dependency-matrix/matrix.md
@@ -2,4 +2,4 @@
 
 Dependency | Sources | Version | Mismatched versions
 ---------- | ------- | ------- | -------------------
-[jenkins-x/go-scm](https://github.com/jenkins-x/go-scm) |  | [1.5.168]() | 
+[jenkins-x/go-scm](https://github.com/jenkins-x/go-scm) |  | [1.5.170]() | 
diff --git a/dependency-matrix/matrix.yaml b/dependency-matrix/matrix.yaml
index 648f64bb..6e9a2952 100644
--- a/dependency-matrix/matrix.yaml
+++ b/dependency-matrix/matrix.yaml
@@ -3,5 +3,5 @@ dependencies:
   owner: jenkins-x
   repo: go-scm
   url: https://github.com/jenkins-x/go-scm
-  version: 1.5.168
+  version: 1.5.170
   versionURL: ""
diff --git a/docs/INSTALL.md b/docs/INSTALL.md
index 503a6a9d..0f7fd2af 100644
--- a/docs/INSTALL.md
+++ b/docs/INSTALL.md
@@ -494,7 +494,12 @@ Now we need to add the sample project to the Lighthouse configuration and setup
         config.yaml:
           name: config
         plugins.yaml:
-          name: plugins  
+          name: plugins
+    triggers:
+    - repos:
+      - $bot_user/$sample_repo_name
+      ignore_ok_to_test: false
+      elide_skipped_contexts: false
     plugins:
       $bot_user/$config_repo_name:
       - config-updater
@@ -503,6 +508,7 @@ Now we need to add the sample project to the Lighthouse configuration and setup
       $bot_user/$sample_repo_name:
       - approve
       - lgtm
+      - trigger
     EOF
     ```
 
diff --git a/docs/config/jobs/github-com-jenkins-x-lighthouse-pkg-config-job.md b/docs/config/jobs/github-com-jenkins-x-lighthouse-pkg-config-job.md
index ff98ba1c..0459b8f5 100644
--- a/docs/config/jobs/github-com-jenkins-x-lighthouse-pkg-config-job.md
+++ b/docs/config/jobs/github-com-jenkins-x-lighthouse-pkg-config-job.md
@@ -38,6 +38,7 @@ Periodic runs on a timer.
 | `cluster` | string | No | Cluster is the alias of the cluster to run this job in.<br />(Default: kube.DefaultClusterAlias) |
 | `namespace` | *string | No | Namespace is the namespace in which pods schedule.<br />  nil: results in config.PodNamespace (aka pod default)<br />  empty: results in config.LighthouseJobNamespace (aka same as LighthouseJob) |
 | `error_on_eviction` | bool | No | ErrorOnEviction indicates that the LighthouseJob should be completed and given<br />the ErrorState status if the pod that is executing the job is evicted.<br />If this field is unspecified or false, a new pod will be created to replace<br />the evicted one. |
+| `source` | string | No | SourcePath contains the path where the tekton pipeline run is defined |
 | `spec` | *[PodSpec](./k8s-io-api-core-v1.md#PodSpec) | No | Spec is the Kubernetes pod spec used if Agent is kubernetes. |
 | `pipeline_run_spec` | *[PipelineRunSpec](./github-com-tektoncd-pipeline-pkg-apis-pipeline-v1beta1.md#PipelineRunSpec) | No | PipelineRunSpec is the Tekton PipelineRun spec used if agent is tekton-pipeline |
 | `pipeline_run_params` | [][PipelineRunParam](./github-com-jenkins-x-lighthouse-pkg-config-job.md#PipelineRunParam) | No | PipelineRunParams are the params used by the pipeline run |
@@ -72,6 +73,7 @@ Postsubmit runs on push events.
 | `cluster` | string | No | Cluster is the alias of the cluster to run this job in.<br />(Default: kube.DefaultClusterAlias) |
 | `namespace` | *string | No | Namespace is the namespace in which pods schedule.<br />  nil: results in config.PodNamespace (aka pod default)<br />  empty: results in config.LighthouseJobNamespace (aka same as LighthouseJob) |
 | `error_on_eviction` | bool | No | ErrorOnEviction indicates that the LighthouseJob should be completed and given<br />the ErrorState status if the pod that is executing the job is evicted.<br />If this field is unspecified or false, a new pod will be created to replace<br />the evicted one. |
+| `source` | string | No | SourcePath contains the path where the tekton pipeline run is defined |
 | `spec` | *[PodSpec](./k8s-io-api-core-v1.md#PodSpec) | No | Spec is the Kubernetes pod spec used if Agent is kubernetes. |
 | `pipeline_run_spec` | *[PipelineRunSpec](./github-com-tektoncd-pipeline-pkg-apis-pipeline-v1beta1.md#PipelineRunSpec) | No | PipelineRunSpec is the Tekton PipelineRun spec used if agent is tekton-pipeline |
 | `pipeline_run_params` | [][PipelineRunParam](./github-com-jenkins-x-lighthouse-pkg-config-job.md#PipelineRunParam) | No | PipelineRunParams are the params used by the pipeline run |
@@ -111,6 +113,7 @@ Presubmit runs on PRs.
 | `cluster` | string | No | Cluster is the alias of the cluster to run this job in.<br />(Default: kube.DefaultClusterAlias) |
 | `namespace` | *string | No | Namespace is the namespace in which pods schedule.<br />  nil: results in config.PodNamespace (aka pod default)<br />  empty: results in config.LighthouseJobNamespace (aka same as LighthouseJob) |
 | `error_on_eviction` | bool | No | ErrorOnEviction indicates that the LighthouseJob should be completed and given<br />the ErrorState status if the pod that is executing the job is evicted.<br />If this field is unspecified or false, a new pod will be created to replace<br />the evicted one. |
+| `source` | string | No | SourcePath contains the path where the tekton pipeline run is defined |
 | `spec` | *[PodSpec](./k8s-io-api-core-v1.md#PodSpec) | No | Spec is the Kubernetes pod spec used if Agent is kubernetes. |
 | `pipeline_run_spec` | *[PipelineRunSpec](./github-com-tektoncd-pipeline-pkg-apis-pipeline-v1beta1.md#PipelineRunSpec) | No | PipelineRunSpec is the Tekton PipelineRun spec used if agent is tekton-pipeline |
 | `pipeline_run_params` | [][PipelineRunParam](./github-com-jenkins-x-lighthouse-pkg-config-job.md#PipelineRunParam) | No | PipelineRunParams are the params used by the pipeline run |
diff --git a/docs/config/lighthouse/github-com-jenkins-x-lighthouse-pkg-config-lighthouse.md b/docs/config/lighthouse/github-com-jenkins-x-lighthouse-pkg-config-lighthouse.md
index ccdfee63..a556de79 100644
--- a/docs/config/lighthouse/github-com-jenkins-x-lighthouse-pkg-config-lighthouse.md
+++ b/docs/config/lighthouse/github-com-jenkins-x-lighthouse-pkg-config-lighthouse.md
@@ -2,6 +2,7 @@
 
 - [Config](#Config)
 - [GitHubOptions](#GitHubOptions)
+- [InRepoConfig](#InRepoConfig)
 - [JenkinsOperator](#JenkinsOperator)
 - [OwnersDirExcludes](#OwnersDirExcludes)
 - [Plank](#Plank)
@@ -20,6 +21,7 @@ Config is config for all lighthouse controllers
 | `plank` | [Plank](./github-com-jenkins-x-lighthouse-pkg-config-lighthouse.md#Plank) | No |  |
 | `branch-protection` | [Config](./github-com-jenkins-x-lighthouse-pkg-config-branchprotection.md#Config) | No |  |
 | `orgs` | map[string][Config](./github-com-jenkins-x-lighthouse-pkg-config-org.md#Config) | No |  |
+| `in_repo_config` | [InRepoConfig](./github-com-jenkins-x-lighthouse-pkg-config-lighthouse.md#InRepoConfig) | Yes |  |
 | `jenkins_operators` | [][JenkinsOperator](./github-com-jenkins-x-lighthouse-pkg-config-lighthouse.md#JenkinsOperator) | No | TODO: Move this out of the main config. |
 | `prowjob_namespace` | string | No | LighthouseJobNamespace is the namespace in the cluster that prow<br />components will use for looking up LighthouseJobs. The namespace<br />needs to exist and will not be created by prow.<br />Defaults to "default". |
 | `pod_namespace` | string | No | PodNamespace is the namespace in the cluster that prow<br />components will use for looking up Pods owned by LighthouseJobs.<br />The namespace needs to exist and will not be created by prow.<br />Defaults to "default". |
@@ -38,6 +40,14 @@ GitHubOptions allows users to control how prow applications display GitHub websi
 |---|---|---|---|
 | `link_url` | string | No | LinkURLFromConfig is the string representation of the link_url config parameter.<br />This config parameter allows users to override the default GitHub link url for all plugins.<br />If this option is not set, we assume "https://github.com". |
 
+## InRepoConfig
+
+InRepoConfig to enable configuration inside the source code of a repository<br /><br />this struct mirrors the similar struct inside prow
+
+| Stanza | Type | Required | Description |
+|---|---|---|---|
+| `enabled` | map[string]*bool | No | Enabled describes whether InRepoConfig is enabled for a given repository. This can<br />be set globally, per org or per repo using '*', 'org' or 'org/repo' as key. The<br />narrowest match always takes precedence. |
+
 ## JenkinsOperator
 
 JenkinsOperator is config for the jenkins-operator controller.
diff --git a/go.mod b/go.mod
index f396009a..0ac7861d 100644
--- a/go.mod
+++ b/go.mod
@@ -8,7 +8,7 @@ require (
 	github.com/google/go-cmp v0.4.1
 	github.com/gorilla/sessions v1.2.0
 	github.com/hashicorp/go-multierror v1.1.0
-	github.com/jenkins-x/go-scm v1.5.168
+	github.com/jenkins-x/go-scm v1.5.170
 	github.com/mattn/go-zglob v0.0.1
 	github.com/onsi/ginkgo v1.11.0
 	github.com/onsi/gomega v1.8.1
diff --git a/go.sum b/go.sum
index 041989c7..ab11fe55 100644
--- a/go.sum
+++ b/go.sum
@@ -31,8 +31,8 @@ cloud.google.com/go/pubsub v1.2.0/go.mod h1:jhfEVHT8odbXTkndysNHCcx0awwzvfOlguIA
 cloud.google.com/go/storage v1.0.0/go.mod h1:IhtSnM/ZTZV8YYJWCY8RULGVqBDmpoyjwiyrjsg+URw=
 cloud.google.com/go/storage v1.5.0/go.mod h1:tpKbwo567HUNpVclU5sGELwQWBDZ8gh0ZeosJ0Rtdos=
 cloud.google.com/go/storage v1.6.0/go.mod h1:N7U0C8pVQ/+NIKOBQyamJIeKQKkZ+mxpohlUTyfDhBk=
-code.gitea.io/sdk/gitea v0.12.1 h1:bMgjEqPnNX/i6TpVwXwpjJtFOnUSuC9P6yy/jjy8sjY=
-code.gitea.io/sdk/gitea v0.12.1/go.mod h1:z3uwDV/b9Ls47NGukYM9XhnHtqPh/J+t40lsUrR6JDY=
+code.gitea.io/sdk/gitea v0.13.0 h1:iHognp8ZMhMFLooUUNZFpm8IHaC9qoHJDvAE5vTm5aw=
+code.gitea.io/sdk/gitea v0.13.0/go.mod h1:z3uwDV/b9Ls47NGukYM9XhnHtqPh/J+t40lsUrR6JDY=
 contrib.go.opencensus.io/exporter/aws v0.0.0-20181029163544-2befc13012d0/go.mod h1:uu1P0UCM/6RbsMrgPa98ll8ZcHM858i/AD06a9aLRCA=
 contrib.go.opencensus.io/exporter/ocagent v0.4.12/go.mod h1:450APlNTSR6FrvC3CTRqYosuDstRB9un7SOx2k/9ckA=
 contrib.go.opencensus.io/exporter/ocagent v0.5.0/go.mod h1:ImxhfLRpxoYiSq891pBrLVhN+qmP8BTVvdH2YLs7Gl0=
@@ -585,8 +585,8 @@ github.com/jcmturner/gofork v1.0.0/go.mod h1:MK8+TM0La+2rjBD4jE12Kj1pCCxK7d2LK/U
 github.com/jenkins-x/go-scm v1.5.65/go.mod h1:MgGRkJScE/rJ30J/bXYqduN5sDPZqZFITJopsnZmTOw=
 github.com/jenkins-x/go-scm v1.5.79/go.mod h1:PCT338UhP/pQ0IeEeMEf/hoLTYKcH7qjGEKd7jPkeYg=
 github.com/jenkins-x/go-scm v1.5.117/go.mod h1:PCT338UhP/pQ0IeEeMEf/hoLTYKcH7qjGEKd7jPkeYg=
-github.com/jenkins-x/go-scm v1.5.168 h1:s2Op/diUSUrD8g5rJPUNe5MRsL04q5R+ur0FkMXf5Ac=
-github.com/jenkins-x/go-scm v1.5.168/go.mod h1:wJgj7PfgsCs+YAXC0vEj43g48HKf94apSyza62ADxKY=
+github.com/jenkins-x/go-scm v1.5.170 h1:+vfayc1YqGgAQ5/yS//3RrkqMgaNPWFMJ6kDRxWi5bE=
+github.com/jenkins-x/go-scm v1.5.170/go.mod h1:xk/KnuS3rVHKBEASsShBZGABm9cGrwntQffiy3BfTCc=
 github.com/jessevdk/go-flags v1.4.0/go.mod h1:4FA24M0QyGHXBuZZK/XkWh8h0e1EYbRYJSGM75WSRxI=
 github.com/jinzhu/gorm v0.0.0-20170316141641-572d0a0ab1eb/go.mod h1:Vla75njaFJ8clLU1W44h34PjIkijhjHIYnZxMqCdxqo=
 github.com/jinzhu/gorm v1.9.12/go.mod h1:vhTjlKSJUTWNtcbQtrMBFCxy7eXTzeCAzfL5fBZT/Qs=
diff --git a/pkg/config/job/base.go b/pkg/config/job/base.go
index 57a23088..1e57af2f 100644
--- a/pkg/config/job/base.go
+++ b/pkg/config/job/base.go
@@ -60,8 +60,8 @@ type Base struct {
 	// If this field is unspecified or false, a new pod will be created to replace
 	// the evicted one.
 	ErrorOnEviction bool `json:"error_on_eviction,omitempty"`
-	// SourcePath contains the path where this job is defined
-	SourcePath string `json:"-"`
+	// SourcePath contains the path where the tekton pipeline run is defined
+	SourcePath string `json:"source,omitempty"`
 	// Spec is the Kubernetes pod spec used if Agent is kubernetes.
 	Spec *v1.PodSpec `json:"spec,omitempty"`
 	// PipelineRunSpec is the Tekton PipelineRun spec used if agent is tekton-pipeline
diff --git a/pkg/config/lighthouse/config.go b/pkg/config/lighthouse/config.go
index 298a42b7..ce9f1b6f 100644
--- a/pkg/config/lighthouse/config.go
+++ b/pkg/config/lighthouse/config.go
@@ -19,6 +19,7 @@ package lighthouse
 import (
 	"errors"
 	"os"
+	"strings"
 
 	"github.com/jenkins-x/lighthouse/pkg/config/branchprotection"
 	"github.com/jenkins-x/lighthouse/pkg/config/keeper"
@@ -31,6 +32,8 @@ type Config struct {
 	Plank            Plank                   `json:"plank,omitempty"`
 	BranchProtection branchprotection.Config `json:"branch-protection,omitempty"`
 	Orgs             map[string]org.Config   `json:"orgs,omitempty"`
+	InRepoConfig     InRepoConfig            `json:"in_repo_config"`
+
 	// TODO: Move this out of the main config.
 	JenkinsOperators []JenkinsOperator `json:"jenkins_operators,omitempty"`
 	// LighthouseJobNamespace is the namespace in the cluster that prow
@@ -105,3 +108,28 @@ func (c *Config) Parse() error {
 	}
 	return nil
 }
+
+// InRepoConfig to enable configuration inside the source code of a repository
+//
+// this struct mirrors the similar struct inside prow
+type InRepoConfig struct {
+	// Enabled describes whether InRepoConfig is enabled for a given repository. This can
+	// be set globally, per org or per repo using '*', 'org' or 'org/repo' as key. The
+	// narrowest match always takes precedence.
+	Enabled map[string]*bool `json:"enabled,omitempty"`
+}
+
+// InRepoConfigEnabled returns whether InRepoConfig is enabled for a given repository.
+func (c *Config) InRepoConfigEnabled(identifier string) bool {
+	if c.InRepoConfig.Enabled[identifier] != nil {
+		return *c.InRepoConfig.Enabled[identifier]
+	}
+	identifierSlashSplit := strings.Split(identifier, "/")
+	if len(identifierSlashSplit) == 2 && c.InRepoConfig.Enabled[identifierSlashSplit[0]] != nil {
+		return *c.InRepoConfig.Enabled[identifierSlashSplit[0]]
+	}
+	if c.InRepoConfig.Enabled["*"] != nil {
+		return *c.InRepoConfig.Enabled["*"]
+	}
+	return false
+}
diff --git a/pkg/keeper/keeper.go b/pkg/keeper/keeper.go
index c8b4b704..46709c47 100644
--- a/pkg/keeper/keeper.go
+++ b/pkg/keeper/keeper.go
@@ -42,6 +42,7 @@ import (
 	"github.com/jenkins-x/lighthouse/pkg/keeper/blockers"
 	"github.com/jenkins-x/lighthouse/pkg/keeper/history"
 	"github.com/jenkins-x/lighthouse/pkg/scmprovider"
+	"github.com/jenkins-x/lighthouse/pkg/triggerconfig/inrepo"
 	"github.com/jenkins-x/lighthouse/pkg/util"
 	"github.com/pkg/errors"
 	"github.com/prometheus/client_golang/prometheus"
@@ -73,6 +74,8 @@ type scmProviderClient interface {
 	GetRepositoryByFullName(string) (*scm.Repository, error)
 	ListAllPullRequestsForFullNameRepo(string, scm.PullRequestListOptions) ([]*scm.PullRequest, error)
 	CreateComment(owner, repo string, number int, isPR bool, comment string) error
+	GetFile(string, string, string, string) ([]byte, error)
+	ListFiles(string, string, string, string) ([]*scm.FileEntry, error)
 }
 
 type contextChecker interface {
@@ -1340,7 +1343,16 @@ func (c *DefaultController) presubmitsByPull(sp *subpool) (map[int][]job.Presubm
 		}
 	}
 
-	for _, ps := range c.config().Presubmits[sp.org+"/"+sp.repo] {
+	// lets get the in repo config for the repo
+	owner := sp.org
+	repo := sp.repo
+	sharedConfig := c.config()
+	cfg, _, err := inrepo.Generate(c.spc, sharedConfig, nil, owner, repo, "")
+	if err != nil {
+		return nil, errors.Wrapf(err, "failed to calculate in repo config")
+	}
+
+	for _, ps := range cfg.Presubmits[owner+"/"+repo] {
 		if !ps.ContextRequired() {
 			continue
 		}
diff --git a/pkg/plugins/plugins.go b/pkg/plugins/plugins.go
index 2a18ee0e..9967636d 100644
--- a/pkg/plugins/plugins.go
+++ b/pkg/plugins/plugins.go
@@ -21,7 +21,6 @@ import (
 	"fmt"
 	"io/ioutil"
 	"net/url"
-	"os"
 	"strings"
 	"sync"
 
@@ -258,27 +257,6 @@ func (pa *ConfigAgent) getPlugins(owner, repo string) []string {
 		plugins = append(plugins, pa.configuration.Plugins[o]...)
 		plugins = append(plugins, pa.configuration.Plugins[fullName]...)
 	}
-
-	// until we have the configuration stuff setup nicely - lets add a simple way to enable plugins
-	pluginNames := os.Getenv("LIGHTHOUSE_PLUGINS")
-	if pluginNames != "" {
-		names := strings.Split(pluginNames, ",")
-		for _, name := range names {
-			name = strings.TrimSpace(name)
-			if name != "" {
-				found := false
-				for _, p := range plugins {
-					if p == name {
-						found = true
-						break
-					}
-				}
-				if !found {
-					plugins = append(plugins, name)
-				}
-			}
-		}
-	}
 	logrus.Infof("found plugins %s\n", strings.Join(plugins, ", "))
 	return plugins
 }
diff --git a/pkg/repoconfig/merge/combine.go b/pkg/repoconfig/merge/combine.go
deleted file mode 100644
index c1ef0317..00000000
--- a/pkg/repoconfig/merge/combine.go
+++ /dev/null
@@ -1,31 +0,0 @@
-package merge
-
-import (
-	"github.com/jenkins-x/lighthouse/pkg/config/branchprotection"
-	"github.com/jenkins-x/lighthouse/pkg/repoconfig"
-)
-
-// CombineConfigs combines the two configurations together from multiple files
-func CombineConfigs(a, b *repoconfig.RepositoryConfig) *repoconfig.RepositoryConfig {
-	if a == nil {
-		return b
-	}
-	if b == nil {
-		return a
-	}
-	for _, r := range b.Spec.Presubmits {
-		a.Spec.Presubmits = append(a.Spec.Presubmits, r)
-	}
-	for _, r := range b.Spec.Postsubmits {
-		a.Spec.Postsubmits = append(a.Spec.Postsubmits, r)
-	}
-	if b.Spec.BranchProtection != nil {
-		if a.Spec.BranchProtection == nil {
-			a.Spec.BranchProtection = &branchprotection.ContextPolicy{}
-		}
-		for _, s := range b.Spec.BranchProtection.Contexts {
-			a.Spec.BranchProtection.Contexts = append(a.Spec.BranchProtection.Contexts, s)
-		}
-	}
-	return a
-}
diff --git a/pkg/repoconfig/merge/converters.go b/pkg/repoconfig/merge/converters.go
deleted file mode 100644
index 647a3cd7..00000000
--- a/pkg/repoconfig/merge/converters.go
+++ /dev/null
@@ -1,92 +0,0 @@
-package merge
-
-import (
-	"github.com/jenkins-x/lighthouse/pkg/config/job"
-	"github.com/jenkins-x/lighthouse/pkg/plugins"
-	"github.com/jenkins-x/lighthouse/pkg/repoconfig"
-)
-
-// ToPresubmit converts the repo config to the lighthouse config resource
-func ToPresubmit(r repoconfig.Presubmit) job.Presubmit {
-	return job.Presubmit{
-		Base:                ToJobBase(r.JobBase),
-		AlwaysRun:           r.AlwaysRun,
-		Optional:            r.Optional,
-		Trigger:             r.Trigger,
-		RerunCommand:        r.RerunCommand,
-		Brancher:            ToBrancher(r.Brancher),
-		RegexpChangeMatcher: ToRegexpChangeMatcher(r.RegexpChangeMatcher),
-		Reporter:            ToReporter(r.Reporter),
-	}
-}
-
-// ToPostsubmit converts the repo config to the lighthouse config resource
-func ToPostsubmit(r repoconfig.Postsubmit) job.Postsubmit {
-	return job.Postsubmit{
-		Base:                ToJobBase(r.JobBase),
-		RegexpChangeMatcher: ToRegexpChangeMatcher(r.RegexpChangeMatcher),
-		Brancher:            ToBrancher(r.Brancher),
-		Reporter:            ToReporter(r.Reporter),
-	}
-}
-
-// ToJobBase converts the repo config to the lighthouse config resource
-func ToJobBase(r repoconfig.JobBase) job.Base {
-	return job.Base{
-		Name:            r.Name,
-		Labels:          r.Labels,
-		Annotations:     r.Annotations,
-		MaxConcurrency:  r.MaxConcurrency,
-		Agent:           r.Agent,
-		Cluster:         r.Cluster,
-		Namespace:       r.Namespace,
-		ErrorOnEviction: r.ErrorOnEviction,
-		SourcePath:      r.SourcePath,
-		Spec:            r.Spec,
-		PipelineRunSpec: r.PipelineRunSpec,
-		UtilityConfig:   ToUtilityConfig(r.UtilityConfig),
-	}
-}
-
-// ToBrancher converts the repo config to the lighthouse config resource
-func ToBrancher(r repoconfig.Brancher) job.Brancher {
-	return job.Brancher{
-		SkipBranches: r.SkipBranches,
-		Branches:     r.Branches,
-	}
-}
-
-// ToReporter converts the repo config to the lighthouse config resource
-func ToReporter(r repoconfig.Reporter) job.Reporter {
-	return job.Reporter{
-		Context:    r.Context,
-		SkipReport: r.SkipReport,
-	}
-}
-
-// ToRegexpChangeMatcher converts the repo config to the lighthouse config resource
-func ToRegexpChangeMatcher(r repoconfig.RegexpChangeMatcher) job.RegexpChangeMatcher {
-	return job.RegexpChangeMatcher{RunIfChanged: r.RunIfChanged}
-}
-
-// ToUtilityConfig converts the repo config to the lighthouse config resource
-func ToUtilityConfig(r repoconfig.UtilityConfig) job.UtilityConfig {
-	return job.UtilityConfig{
-		Decorate:       r.Decorate,
-		PathAlias:      r.PathAlias,
-		CloneURI:       r.CloneURI,
-		SkipSubmodules: r.SkipSubmodules,
-		CloneDepth:     r.CloneDepth,
-	}
-}
-
-// ToApprove converts the repo config to the lighthouse config resource
-func ToApprove(r *repoconfig.Approve, repoKey string) plugins.Approve {
-	return plugins.Approve{
-		Repos:               []string{repoKey},
-		IssueRequired:       r.IssueRequired,
-		RequireSelfApproval: r.RequireSelfApproval,
-		LgtmActsAsApprove:   r.LgtmActsAsApprove,
-		IgnoreReviewState:   r.IgnoreReviewState,
-	}
-}
diff --git a/pkg/repoconfig/merge/merge.go b/pkg/repoconfig/merge/merge.go
deleted file mode 100644
index 21dd9d00..00000000
--- a/pkg/repoconfig/merge/merge.go
+++ /dev/null
@@ -1,90 +0,0 @@
-package merge
-
-import (
-	"github.com/jenkins-x/lighthouse/pkg/config"
-	"github.com/jenkins-x/lighthouse/pkg/config/branchprotection"
-	"github.com/jenkins-x/lighthouse/pkg/config/job"
-	"github.com/jenkins-x/lighthouse/pkg/plugins"
-	"github.com/jenkins-x/lighthouse/pkg/repoconfig"
-)
-
-// ConfigMerge merges the repository configuration into the global configuration
-func ConfigMerge(cfg *config.Config, pluginsCfg *plugins.Configuration, repoConfig *repoconfig.RepositoryConfig, repoOwner string, repoName string) error {
-	repoKey := repoOwner + "/" + repoName
-	if len(repoConfig.Spec.Presubmits) > 0 {
-		if cfg.Presubmits == nil {
-			cfg.Presubmits = map[string][]job.Presubmit{}
-		}
-
-		var ps []job.Presubmit
-		for _, p := range repoConfig.Spec.Presubmits {
-			ps = append(ps, ToPresubmit(p))
-		}
-		cfg.Presubmits[repoKey] = ps
-	}
-	if len(repoConfig.Spec.Postsubmits) > 0 {
-		if cfg.Postsubmits == nil {
-			cfg.Postsubmits = map[string][]job.Postsubmit{}
-		}
-
-		var ps []job.Postsubmit
-		for _, p := range repoConfig.Spec.Postsubmits {
-			ps = append(ps, ToPostsubmit(p))
-		}
-		cfg.Postsubmits[repoKey] = ps
-	}
-
-	if repoConfig.Spec.BranchProtection != nil {
-		if cfg.BranchProtection.Orgs == nil {
-			cfg.BranchProtection.Orgs = map[string]branchprotection.Org{}
-		}
-		org := cfg.BranchProtection.Orgs[repoOwner]
-		if org.Repos == nil {
-			org.Repos = map[string]branchprotection.Repo{}
-		}
-		repo := org.Repos[repoName]
-		repo.RequiredStatusChecks = repoConfig.Spec.BranchProtection
-		org.Repos[repoName] = repo
-		cfg.BranchProtection.Orgs[repoOwner] = org
-	}
-
-	keeper := repoConfig.Spec.Keeper
-	if keeper != nil {
-		if keeper.Query != nil {
-			for i, q := range cfg.Keeper.Queries {
-				// remove the old repository
-				idx := StringArrayIndex(q.Repos, repoKey)
-				if idx >= 0 {
-					cfg.Keeper.Queries[i].Repos = RemoveStringArrayAtIndex(cfg.Keeper.Queries[i].Repos, idx)
-					break
-				}
-			}
-			query := *keeper.Query
-			query.Repos = []string{repoKey}
-			cfg.Keeper.Queries = append(cfg.Keeper.Queries, query)
-		}
-	}
-
-	pc := repoConfig.Spec.PluginConfig
-	if pc != nil {
-		if pluginsCfg.Plugins == nil {
-			pluginsCfg.Plugins = map[string][]string{}
-		}
-		pluginsCfg.Plugins[repoKey] = pc.Plugins
-
-		if pc.Approve != nil {
-			pluginsCfg.Approve = append(pluginsCfg.Approve, ToApprove(pc.Approve, repoKey))
-		}
-
-		// lets add to the last idx
-		idx := len(pluginsCfg.Triggers) - 1
-		if idx < 0 {
-			idx = 0
-			pluginsCfg.Triggers = append(pluginsCfg.Triggers, plugins.Trigger{})
-		}
-		if StringArrayIndex(pluginsCfg.Triggers[idx].Repos, repoKey) < 0 {
-			pluginsCfg.Triggers[idx].Repos = append(pluginsCfg.Triggers[idx].Repos, repoKey)
-		}
-	}
-	return nil
-}
diff --git a/pkg/repoconfig/repoconfig_config_types.go b/pkg/repoconfig/repoconfig_config_types.go
deleted file mode 100644
index 85c885b2..00000000
--- a/pkg/repoconfig/repoconfig_config_types.go
+++ /dev/null
@@ -1,179 +0,0 @@
-/*
-Copyright 2017 The Kubernetes Authors.
-
-Licensed under the Apache License, Version 2.0 (the "License");
-you may not use this file except in compliance with the License.
-You may obtain a copy of the License at
-
-    http://www.apache.org/licenses/LICENSE-2.0
-
-Unless required by applicable law or agreed to in writing, software
-distributed under the License is distributed on an "AS IS" BASIS,
-WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-See the License for the specific language governing permissions and
-limitations under the License.
-*/
-
-package repoconfig
-
-import (
-	"regexp"
-	"time"
-
-	"github.com/jenkins-x/lighthouse/pkg/config/job"
-	tektonv1beta1 "github.com/tektoncd/pipeline/pkg/apis/pipeline/v1beta1"
-	v1 "k8s.io/api/core/v1"
-)
-
-// this file contains copies of structs from the config package
-// using different JSON/YAML marshalling so that they look like
-// kubernetes CRDs; using camelCase rather than lower case and underscores
-
-// JobBase contains attributes common to all job types
-type JobBase struct {
-	// The name of the job. Must match regex [A-Za-z0-9-._]+
-	// e.g. pull-test-infra-bazel-build
-	Name string `json:"name"`
-	// Labels are added to LighthouseJobs and pods created for this job.
-	Labels map[string]string `json:"labels,omitempty"`
-	// Annotations are unused by prow itself, but provide a space to configure other automation.
-	Annotations map[string]string `json:"annotations,omitempty"`
-	// MaximumConcurrency of this job, 0 implies no limit.
-	MaxConcurrency int `json:"maxConcurrency,omitempty"`
-	// Agent that will take care of running this job.
-	Agent string `json:"agent"`
-	// Cluster is the alias of the cluster to run this job in.
-	// (Default: kube.DefaultClusterAlias)
-	Cluster string `json:"cluster,omitempty"`
-	// Namespace is the namespace in which pods schedule.
-	//   nil: results in config.PodNamespace (aka pod default)
-	//   empty: results in config.LighthouseJobNamespace (aka same as LighthouseJob)
-	Namespace *string `json:"namespace,omitempty"`
-	// ErrorOnEviction indicates that the LighthouseJob should be completed and given
-	// the ErrorState status if the pod that is executing the job is evicted.
-	// If this field is unspecified or false, a new pod will be created to replace
-	// the evicted one.
-	ErrorOnEviction bool `json:"errorOnEviction,omitempty"`
-	// SourcePath contains the path where this job is defined
-	SourcePath string `json:"-"`
-	// Spec is the Kubernetes pod spec used if Agent is kubernetes.
-	Spec *v1.PodSpec `json:"spec,omitempty"`
-	// PipelineRunSpec is the Tekton PipelineRun spec used if agent is tekton-pipeline
-	PipelineRunSpec *tektonv1beta1.PipelineRunSpec `json:"pipelineRunSpec,omitempty"`
-	// PipelineRunParams are the params used by the pipeline run
-	PipelineRunParams []job.PipelineRunParam `json:"pipeline_run_params,omitempty"`
-
-	UtilityConfig
-}
-
-// Presubmit runs on PRs.
-type Presubmit struct {
-	JobBase
-
-	// AlwaysRun automatically for every PR, or only when a comment triggers it.
-	AlwaysRun bool `json:"alwaysRun"`
-
-	// Optional indicates that the job's status context should not be required for merge.
-	Optional bool `json:"optional,omitempty"`
-
-	// Trigger is the regular expression to trigger the job.
-	// e.g. `@k8s-bot e2e test this`
-	// RerunCommand must also be specified if this field is specified.
-	// (Default: `(?m)^/test (?:.*? )?<job name>(?: .*?)?$`)
-	Trigger string `json:"trigger,omitempty"`
-
-	// The RerunCommand to give users. Must match Trigger.
-	// Trigger must also be specified if this field is specified.
-	// (Default: `/test <job name>`)
-	RerunCommand string `json:"rerunCommand,omitempty"`
-
-	Brancher
-
-	RegexpChangeMatcher
-
-	Reporter
-
-	// We'll set these when we load it.
-	//re *regexp.Regexp // from Trigger.
-}
-
-// Postsubmit runs on push events.
-type Postsubmit struct {
-	JobBase
-
-	RegexpChangeMatcher
-
-	Brancher
-
-	// TODO(krzyzacy): Move existing `Report` into `SkipReport` once this is deployed
-	Reporter
-}
-
-// Periodic runs on a timer.
-type Periodic struct {
-	JobBase
-
-	// (deprecated)Interval to wait between two runs of the job.
-	Interval string `json:"interval"`
-	// Cron representation of job trigger time
-	Cron string `json:"cron"`
-	// Tags for config entries
-	Tags []string `json:"tags,omitempty"`
-
-	interval time.Duration
-}
-
-// Brancher is for shared code between jobs that only run against certain
-// branches. An empty brancher runs against all branches.
-type Brancher struct {
-	// Do not run against these branches. Default is no branches.
-	SkipBranches []string `json:"skipBranches,omitempty"`
-	// Only run against these branches. Default is all branches.
-	Branches []string `json:"branches,omitempty"`
-
-	// We'll set these when we load it.
-	re     *regexp.Regexp
-	reSkip *regexp.Regexp
-}
-
-// RegexpChangeMatcher is for code shared between jobs that run only when certain files are changed.
-type RegexpChangeMatcher struct {
-	// RunIfChanged defines a regex used to select which subset of file changes should trigger this job.
-	// If any file in the changeset matches this regex, the job will be triggered
-	RunIfChanged string         `json:"runIfChanged,omitempty"`
-	reChanges    *regexp.Regexp // from RunIfChanged
-}
-
-// Reporter keeps various details for status reporting
-type Reporter struct {
-	// Context is the name of the GitHub status context for the job.
-	// Defaults: the same as the name of the job.
-	Context string `json:"context,omitempty"`
-	// SkipReport skips commenting and setting status on GitHub.
-	SkipReport bool `json:"skipReport,omitempty"`
-}
-
-// ChangedFilesProvider returns a slice of modified files.
-type ChangedFilesProvider func() ([]string, error)
-
-// UtilityConfig holds decoration metadata, such as how to clone and additional containers/etc
-type UtilityConfig struct {
-	// Decorate determines if we decorate the PodSpec or not
-	Decorate bool `json:"decorate,omitempty"`
-
-	// PathAlias is the location under <root-dir>/src
-	// where the repository under test is cloned. If this
-	// is not set, <root-dir>/src/github.com/org/repo will
-	// be used as the default.
-	PathAlias string `json:"pathAlias,omitempty"`
-	// CloneURI is the URI that is used to clone the
-	// repository. If unset, will default to
-	// `https://github.com/org/repo.git`.
-	CloneURI string `json:"cloneUri,omitempty"`
-	// SkipSubmodules determines if submodules should be
-	// cloned when the job is run. Defaults to true.
-	SkipSubmodules bool `json:"skipSubmodules,omitempty"`
-	// CloneDepth is the depth of the clone that will be used.
-	// A depth of zero will do a full clone.
-	CloneDepth int `json:"cloneDepth,omitempty"`
-}
diff --git a/pkg/repoconfig/repoconfig_plugins_types.go b/pkg/repoconfig/repoconfig_plugins_types.go
deleted file mode 100644
index f2d8f56f..00000000
--- a/pkg/repoconfig/repoconfig_plugins_types.go
+++ /dev/null
@@ -1,27 +0,0 @@
-package repoconfig
-
-// this file contains copies of structs from the plugins package
-// using different JSON/YAML marshalling so that they look like
-// kubernetes CRDs; using camelCase rather than lower case and underscores
-
-// Approve specifies a configuration for a single approve.
-//
-// The configuration for the approve plugin is defined as a list of these structures.
-type Approve struct {
-	// IssueRequired indicates if an associated issue is required for approval in
-	// the specified repos.
-	IssueRequired bool `json:"issueRequired,omitempty"`
-
-	// RequireSelfApproval requires PR authors to explicitly approve their PRs.
-	// Otherwise the plugin assumes the author of the PR approves the changes in the PR.
-	RequireSelfApproval *bool `json:"requireSelfApproval,omitempty"`
-
-	// LgtmActsAsApprove indicates that the lgtm command should be used to
-	// indicate approval
-	LgtmActsAsApprove bool `json:"lgtmActsAsApprove,omitempty"`
-
-	// IgnoreReviewState causes the approve plugin to ignore the GitHub review state. Otherwise:
-	// * an APPROVE github review is equivalent to leaving an "/approve" message.
-	// * A REQUEST_CHANGES github review is equivalent to leaving an /approve cancel" message.
-	IgnoreReviewState *bool `json:"ignoreReviewState,omitempty"`
-}
diff --git a/pkg/repoconfig/repoconfig_types.go b/pkg/repoconfig/repoconfig_types.go
deleted file mode 100644
index 1b764dd8..00000000
--- a/pkg/repoconfig/repoconfig_types.go
+++ /dev/null
@@ -1,62 +0,0 @@
-package repoconfig
-
-import (
-	"github.com/jenkins-x/lighthouse/pkg/config/branchprotection"
-	"github.com/jenkins-x/lighthouse/pkg/config/keeper"
-	metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
-)
-
-// RepositoryConfig represents local repository configurations
-type RepositoryConfig struct {
-	metav1.TypeMeta `json:",inline"`
-	// +optional
-	metav1.ObjectMeta `json:"metadata"`
-
-	// Spec holds the desired state of the RepositoryConfig from the client
-	// +optional
-	Spec RepositoryConfigSpec `json:"spec"`
-}
-
-// RepositoryConfigSpec defines the desired state of RepositoryConfig.
-type RepositoryConfigSpec struct {
-	// Presubmit zero or more presubmits
-	Presubmits []Presubmit `json:"presubmits,omitempty"`
-
-	// Postsubmit zero or more postsubmits
-	Postsubmits []Postsubmit `json:"postsubmits,omitempty"`
-
-	// Plugins the plugin names to enable for this repository
-	Plugins []string `json:"plugins,omitempty"`
-
-	// BranchProtections to configure branch protection
-	BranchProtection *branchprotection.ContextPolicy `json:"branchProtection,omitempty"`
-
-	// PluginConfig the configuration for the plugins
-	PluginConfig *PluginConfig `json:"pluginConfig,omitempty"`
-
-	// Keeper any keeper/tide related configurations
-	Keeper *Keeper `json:"keeper,omitempty"`
-}
-
-// RepositoryConfigList contains a list of RepositoryConfig
-type RepositoryConfigList struct {
-	metav1.TypeMeta `json:",inline"`
-	// +optional
-	metav1.ListMeta `json:"metadata,omitempty"`
-	Items           []RepositoryConfig `json:"items"`
-}
-
-// Keeper for keeper specific queries
-type Keeper struct {
-	// Query the query to add for the repository
-	Query *keeper.Query `json:"query,omitempty"`
-}
-
-// PluginConfig configuration for plugins
-type PluginConfig struct {
-	// Plugins the list of plugins
-	Plugins []string `json:"plugins,omitempty"`
-
-	// Approve approve plugin configuration
-	Approve *Approve `json:"approve,omitempty"`
-}
diff --git a/pkg/repoconfig/scmload/load.go b/pkg/repoconfig/scmload/load.go
deleted file mode 100644
index 15086409..00000000
--- a/pkg/repoconfig/scmload/load.go
+++ /dev/null
@@ -1,93 +0,0 @@
-package scmload
-
-import (
-	"context"
-	"strings"
-
-	"github.com/jenkins-x/go-scm/scm"
-	"github.com/jenkins-x/lighthouse/pkg/config"
-	"github.com/jenkins-x/lighthouse/pkg/plugins"
-	"github.com/jenkins-x/lighthouse/pkg/repoconfig"
-	"github.com/jenkins-x/lighthouse/pkg/repoconfig/merge"
-	"github.com/pkg/errors"
-	"sigs.k8s.io/yaml"
-)
-
-// MergeConfig merges the configuration with any `lighthouse.yaml` files in the repository
-func MergeConfig(cfg *config.Config, pluginCfg *plugins.Configuration, scmClient *scm.Client, repoOwner string, repoName string, sha string) (bool, error) {
-	repoConfig, err := LoadRepositoryConfig(scmClient, repoOwner, repoName, sha)
-	if err != nil {
-		return false, errors.Wrap(err, "failed to load configs")
-	}
-	if repoConfig == nil {
-		return false, nil
-	}
-
-	err = merge.ConfigMerge(cfg, pluginCfg, repoConfig, repoOwner, repoName)
-	if err != nil {
-		return false, errors.Wrapf(err, "failed to merge repository config with repository %s/%s and sha %s", repoOwner, repoName, sha)
-	}
-	return true, nil
-}
-
-// LoadRepositoryConfig loads the `lighthouse.yaml` configuration files in the repository
-func LoadRepositoryConfig(scmClient *scm.Client, repoOwner string, repoName string, sha string) (*repoconfig.RepositoryConfig, error) {
-	if sha == "" {
-		sha = "master"
-	}
-
-	var answer *repoconfig.RepositoryConfig
-	repo := scm.Join(repoOwner, repoName)
-
-	ctx := context.Background()
-	path := ".lighthouse"
-	files, _, err := scmClient.Contents.List(ctx, repo, path, sha)
-	if err != nil {
-		return nil, errors.Wrapf(err, "failed to find any lighthouse configuration files in repo %s at sha %s", repo, sha)
-	}
-	for _, f := range files {
-		if isDirType(f.Type) {
-			filePath := path + "/" + f.Name + "/lighthouse.yaml"
-			cfg, err := loadConfigFile(ctx, scmClient, repo, filePath, sha)
-			if err != nil {
-				return nil, errors.Wrapf(err, "failed to load file %s in %s with sha %s", filePath, repo, sha)
-			}
-			if cfg != nil {
-				answer = merge.CombineConfigs(answer, cfg)
-			}
-		} else if f.Name == "lighthouse.yaml" {
-			filePath := path + "/" + f.Name
-			cfg, err := loadConfigFile(ctx, scmClient, repo, filePath, sha)
-			if err != nil {
-				return nil, errors.Wrapf(err, "failed to load file %s in %s with sha %s", filePath, repo, sha)
-			}
-			if cfg != nil {
-				answer = merge.CombineConfigs(answer, cfg)
-			}
-		}
-	}
-	return answer, nil
-}
-
-func isDirType(t string) bool {
-	return strings.ToLower(t) == "dir"
-}
-
-func loadConfigFile(ctx context.Context, client *scm.Client, repo string, path string, sha string) (*repoconfig.RepositoryConfig, error) {
-	c, r, err := client.Contents.Find(ctx, repo, path, sha)
-	if err != nil {
-		if r != nil && r.Status == 404 {
-			return nil, nil
-		}
-		return nil, errors.Wrapf(err, "failed to find  file %s in repo %s with sha %s status %d", path, repo, sha, r.Status)
-	}
-	if len(c.Data) == 0 {
-		return nil, nil
-	}
-	repoConfig := &repoconfig.RepositoryConfig{}
-	err = yaml.Unmarshal(c.Data, repoConfig)
-	if err != nil {
-		return nil, errors.Wrapf(err, "failed to unmarshal file %s in repo %s with sha %s", path, repo, sha)
-	}
-	return repoConfig, nil
-}
diff --git a/pkg/scmprovider/client.go b/pkg/scmprovider/client.go
index a693bcfe..e81594b9 100644
--- a/pkg/scmprovider/client.go
+++ b/pkg/scmprovider/client.go
@@ -29,6 +29,7 @@ type SCMClient interface {
 
 	// Functions implemented in content.go
 	GetFile(string, string, string, string) ([]byte, error)
+	ListFiles(string, string, string, string) ([]*scm.FileEntry, error)
 
 	// Functions implemented in git.go
 	GetRef(string, string, string) (string, error)
@@ -99,6 +100,11 @@ type Client struct {
 	botName string
 }
 
+// ToScmClient gets the underlying SCM client
+func (c *Client) ToScmClient() *scm.Client {
+	return c.client
+}
+
 // BotName returns the bot name
 func (c *Client) BotName() (string, error) {
 	botName := c.botName
diff --git a/pkg/scmprovider/content.go b/pkg/scmprovider/content.go
index 7aa18be5..853c94de 100644
--- a/pkg/scmprovider/content.go
+++ b/pkg/scmprovider/content.go
@@ -2,16 +2,30 @@ package scmprovider
 
 import (
 	"context"
+
+	"github.com/jenkins-x/go-scm/scm"
 )
 
-// GetFile retruns the file from GitHub
+// GetFile returns the file from git
 func (c *Client) GetFile(owner, repo, filepath, commit string) ([]byte, error) {
 	ctx := context.Background()
 	fullName := c.repositoryName(owner, repo)
-	answer, _, err := c.client.Contents.Find(ctx, fullName, filepath, commit)
+	answer, r, err := c.client.Contents.Find(ctx, fullName, filepath, commit)
+	// handle files not existing nicely
+	if r != nil && r.Status == 404 {
+		return nil, nil
+	}
 	var data []byte
 	if answer != nil {
 		data = answer.Data
 	}
 	return data, err
 }
+
+// ListFiles returns the files from git
+func (c *Client) ListFiles(owner, repo, filepath, commit string) ([]*scm.FileEntry, error) {
+	ctx := context.Background()
+	fullName := c.repositoryName(owner, repo)
+	answer, _, err := c.client.Contents.List(ctx, fullName, filepath, commit)
+	return answer, err
+}
diff --git a/pkg/triggerconfig/inrepo/calculate.go b/pkg/triggerconfig/inrepo/calculate.go
new file mode 100644
index 00000000..a21769f5
--- /dev/null
+++ b/pkg/triggerconfig/inrepo/calculate.go
@@ -0,0 +1,48 @@
+package inrepo
+
+import (
+	"github.com/jenkins-x/go-scm/scm"
+	"github.com/jenkins-x/lighthouse/pkg/config"
+	"github.com/jenkins-x/lighthouse/pkg/plugins"
+	"github.com/jenkins-x/lighthouse/pkg/triggerconfig/merge"
+	"github.com/pkg/errors"
+)
+
+// Generate generates the in repository config if enabled for this repository otherwise return the shared config
+func Generate(scmClient scmProviderClient, sharedConfig *config.Config, sharedPlugins *plugins.Configuration, owner, repo, eventRef string) (*config.Config, *plugins.Configuration, error) {
+	fullName := scm.Join(owner, repo)
+	if !sharedConfig.InRepoConfigEnabled(fullName) {
+		return sharedConfig, sharedPlugins, nil
+	}
+
+	// in repository configuration configured for this repository so lets create the in repository specific config structs
+	cfg := *sharedConfig
+
+	// plugins are optional - e.g. keeper doesn't pass plugins in
+	pluginCfg := plugins.Configuration{}
+	if sharedPlugins != nil {
+		pluginCfg = *sharedPlugins
+	}
+
+	if eventRef == "" {
+		eventRef = "master"
+	}
+
+	// lets load the main branch first then merge in any changes from this PR/branch
+	refs := []string{"master"}
+	if eventRef != "master" {
+		refs = append(refs, eventRef)
+	}
+	for _, ref := range refs {
+		repoConfig, err := LoadTriggerConfig(scmClient, owner, repo, ref)
+		if err != nil {
+			return sharedConfig, sharedPlugins, errors.Wrapf(err, "failed to create trigger config from local source for repo %s/%s ref %s", owner, repo, ref)
+		}
+
+		err = merge.ConfigMerge(&cfg, &pluginCfg, repoConfig, owner, repo)
+		if err != nil {
+			return sharedConfig, sharedPlugins, errors.Wrapf(err, "failed to merge repository config with repository %s/%s for ref %s", owner, repo, ref)
+		}
+	}
+	return &cfg, &pluginCfg, nil
+}
diff --git a/pkg/triggerconfig/inrepo/load_triggers.go b/pkg/triggerconfig/inrepo/load_triggers.go
new file mode 100644
index 00000000..54c95ca9
--- /dev/null
+++ b/pkg/triggerconfig/inrepo/load_triggers.go
@@ -0,0 +1,164 @@
+package inrepo
+
+import (
+	"path/filepath"
+	"strings"
+
+	"github.com/jenkins-x/lighthouse/pkg/config"
+	"github.com/jenkins-x/lighthouse/pkg/config/job"
+	"github.com/jenkins-x/lighthouse/pkg/plugins"
+	"github.com/jenkins-x/lighthouse/pkg/triggerconfig"
+	"github.com/jenkins-x/lighthouse/pkg/triggerconfig/merge"
+	"github.com/pkg/errors"
+	tektonv1beta1 "github.com/tektoncd/pipeline/pkg/apis/pipeline/v1beta1"
+	"sigs.k8s.io/yaml"
+)
+
+// MergeTriggers merges the configuration with any `lighthouse.yaml` files in the repository
+func MergeTriggers(cfg *config.Config, pluginCfg *plugins.Configuration, scmClient scmProviderClient, ownerName string, repoName string, sha string) (bool, error) {
+	repoConfig, err := LoadTriggerConfig(scmClient, ownerName, repoName, sha)
+	if err != nil {
+		return false, errors.Wrap(err, "failed to load configs")
+	}
+	if repoConfig == nil {
+		return false, nil
+	}
+
+	err = merge.ConfigMerge(cfg, pluginCfg, repoConfig, ownerName, repoName)
+	if err != nil {
+		return false, errors.Wrapf(err, "failed to merge repository config with repository %s/%s and sha %s", ownerName, repoName, sha)
+	}
+	return true, nil
+}
+
+// LoadTriggerConfig loads the `lighthouse.yaml` configuration files in the repository
+func LoadTriggerConfig(scmClient scmProviderClient, ownerName string, repoName string, sha string) (*triggerconfig.Config, error) {
+	if sha == "" {
+		sha = "master"
+	}
+
+	m := map[string]*triggerconfig.Config{}
+
+	path := ".lighthouse"
+	files, err := scmClient.ListFiles(ownerName, repoName, path, sha)
+	if err != nil {
+		return nil, errors.Wrapf(err, "failed to find any lighthouse configuration files in repo %s/%s at sha %s", ownerName, repoName, sha)
+	}
+	for _, f := range files {
+		if isDirType(f.Type) {
+			filePath := path + "/" + f.Name + "/triggers.yaml"
+			cfg, err := loadConfigFile(scmClient, ownerName, repoName, filePath, sha)
+			if err != nil {
+				return nil, errors.Wrapf(err, "failed to load file %s in %s/%s with sha %s", filePath, ownerName, repoName, sha)
+			}
+			if cfg != nil {
+				m[filePath] = cfg
+			}
+		} else if f.Name == "trigger.yaml" {
+			filePath := path + "/" + f.Name
+			cfg, err := loadConfigFile(scmClient, ownerName, repoName, filePath, sha)
+			if err != nil {
+				return nil, errors.Wrapf(err, "failed to load file %s in %s/%s with sha %s", filePath, ownerName, repoName, sha)
+			}
+			if cfg != nil {
+				m[filePath] = cfg
+			}
+		}
+	}
+	return mergeConfigs(m)
+}
+
+func mergeConfigs(m map[string]*triggerconfig.Config) (*triggerconfig.Config, error) {
+	var answer *triggerconfig.Config
+
+	// lets check for duplicates
+	presubmitNames := map[string]string{}
+	postsubmitNames := map[string]string{}
+	for file, cfg := range m {
+		for _, ps := range cfg.Spec.Presubmits {
+			name := ps.Name
+			otherFile := presubmitNames[name]
+			if otherFile == "" {
+				presubmitNames[name] = file
+			} else {
+				return nil, errors.Errorf("duplicate presubmit %s in file %s and %s", name, otherFile, file)
+			}
+		}
+		for _, ps := range cfg.Spec.Postsubmits {
+			name := ps.Name
+			otherFile := postsubmitNames[name]
+			if otherFile == "" {
+				postsubmitNames[name] = file
+			} else {
+				return nil, errors.Errorf("duplicate postsubmit %s in file %s and %s", name, otherFile, file)
+			}
+		}
+		answer = merge.CombineConfigs(answer, cfg)
+	}
+	return answer, nil
+}
+
+func isDirType(t string) bool {
+	return strings.ToLower(t) == "dir"
+}
+
+func loadConfigFile(client scmProviderClient, ownerName, repoName, path, sha string) (*triggerconfig.Config, error) {
+	data, err := client.GetFile(ownerName, repoName, path, sha)
+	if err != nil {
+		return nil, errors.Wrapf(err, "failed to find file %s in repo %s/%s with sha %s", path, ownerName, repoName, sha)
+	}
+	if len(data) == 0 {
+		return nil, nil
+	}
+	repoConfig := &triggerconfig.Config{}
+	err = yaml.Unmarshal(data, repoConfig)
+	if err != nil {
+		return nil, errors.Wrapf(err, "failed to unmarshal file %s in repo %s/%s with sha %s", path, ownerName, repoName, sha)
+	}
+	dir := filepath.Dir(path)
+	for i := range repoConfig.Spec.Presubmits {
+		r := &repoConfig.Spec.Presubmits[i]
+		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)
+			}
+
+		}
+		if r.Agent == "" && r.PipelineRunSpec != nil {
+			r.Agent = job.TektonPipelineAgent
+		}
+	}
+	for i := range repoConfig.Spec.Postsubmits {
+		r := &repoConfig.Spec.Postsubmits[i]
+		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)
+			}
+		}
+		if r.Agent == "" && r.PipelineRunSpec != nil {
+			r.Agent = job.TektonPipelineAgent
+		}
+	}
+	return repoConfig, nil
+}
+
+func loadJobBaseFromSourcePath(client scmProviderClient, j *job.Base, ownerName, repoName, path, sha string) error {
+	data, err := client.GetFile(ownerName, repoName, path, sha)
+	if err != nil {
+		return errors.Wrapf(err, "failed to find file %s in repo %s/%s with sha %s", path, ownerName, repoName, sha)
+	}
+	if len(data) == 0 {
+		return errors.Errorf("empty file file %s in repo %s/%s for sha %s", path, ownerName, repoName, sha)
+	}
+
+	// for now lets assume its a PipelineRun we could eventually support different kinds
+	prs := &tektonv1beta1.PipelineRun{}
+	err = yaml.Unmarshal(data, prs)
+	if err != nil {
+		return errors.Wrapf(err, "failed to unmarshal YAML file %s/%s in repo %s with sha %s", path, ownerName, repoName, sha)
+	}
+	j.PipelineRunSpec = &prs.Spec
+	return nil
+}
diff --git a/pkg/triggerconfig/inrepo/scm_provider_client.go b/pkg/triggerconfig/inrepo/scm_provider_client.go
new file mode 100644
index 00000000..01b49c67
--- /dev/null
+++ b/pkg/triggerconfig/inrepo/scm_provider_client.go
@@ -0,0 +1,8 @@
+package inrepo
+
+import "github.com/jenkins-x/go-scm/scm"
+
+type scmProviderClient interface {
+	GetFile(string, string, string, string) ([]byte, error)
+	ListFiles(string, string, string, string) ([]*scm.FileEntry, error)
+}
diff --git a/pkg/triggerconfig/merge/combine.go b/pkg/triggerconfig/merge/combine.go
new file mode 100644
index 00000000..0fbc3f32
--- /dev/null
+++ b/pkg/triggerconfig/merge/combine.go
@@ -0,0 +1,22 @@
+package merge
+
+import (
+	"github.com/jenkins-x/lighthouse/pkg/triggerconfig"
+)
+
+// CombineConfigs combines the two configurations together from multiple files
+func CombineConfigs(a, b *triggerconfig.Config) *triggerconfig.Config {
+	if a == nil {
+		return b
+	}
+	if b == nil {
+		return a
+	}
+	for _, r := range b.Spec.Presubmits {
+		a.Spec.Presubmits = append(a.Spec.Presubmits, r)
+	}
+	for _, r := range b.Spec.Postsubmits {
+		a.Spec.Postsubmits = append(a.Spec.Postsubmits, r)
+	}
+	return a
+}
diff --git a/pkg/repoconfig/merge/helpers.go b/pkg/triggerconfig/merge/helpers.go
similarity index 100%
rename from pkg/repoconfig/merge/helpers.go
rename to pkg/triggerconfig/merge/helpers.go
diff --git a/pkg/triggerconfig/merge/merge.go b/pkg/triggerconfig/merge/merge.go
new file mode 100644
index 00000000..fa2ae9f6
--- /dev/null
+++ b/pkg/triggerconfig/merge/merge.go
@@ -0,0 +1,57 @@
+package merge
+
+import (
+	"github.com/jenkins-x/lighthouse/pkg/config"
+	"github.com/jenkins-x/lighthouse/pkg/config/job"
+	"github.com/jenkins-x/lighthouse/pkg/plugins"
+	"github.com/jenkins-x/lighthouse/pkg/triggerconfig"
+	"github.com/pkg/errors"
+)
+
+// ConfigMerge merges the repository configuration into the global configuration
+func ConfigMerge(cfg *config.Config, pluginsCfg *plugins.Configuration, repoConfig *triggerconfig.Config, repoOwner string, repoName string) error {
+	repoKey := repoOwner + "/" + repoName
+	if len(repoConfig.Spec.Presubmits) > 0 {
+		if cfg.Presubmits == nil {
+			cfg.Presubmits = map[string][]job.Presubmit{}
+		}
+
+		ps := cfg.Presubmits[repoKey]
+		for _, p := range repoConfig.Spec.Presubmits {
+			ps = append(ps, p)
+		}
+		cfg.Presubmits[repoKey] = ps
+	}
+	if len(repoConfig.Spec.Postsubmits) > 0 {
+		if cfg.Postsubmits == nil {
+			cfg.Postsubmits = map[string][]job.Postsubmit{}
+		}
+
+		ps := cfg.Postsubmits[repoKey]
+		for _, p := range repoConfig.Spec.Postsubmits {
+			ps = append(ps, p)
+		}
+		cfg.Postsubmits[repoKey] = ps
+	}
+
+	// lets make sure we've got a trigger added
+	idx := len(pluginsCfg.Triggers) - 1
+	if idx < 0 {
+		idx = 0
+		pluginsCfg.Triggers = append(pluginsCfg.Triggers, plugins.Trigger{})
+	}
+	if StringArrayIndex(pluginsCfg.Triggers[idx].Repos, repoKey) < 0 {
+		pluginsCfg.Triggers[idx].Repos = append(pluginsCfg.Triggers[idx].Repos, repoKey)
+	}
+
+	// lets validate the configuration is valid
+	err := pluginsCfg.Validate()
+	if err != nil {
+		return errors.Wrapf(err, "failed to validate plugins")
+	}
+	err = cfg.Validate(cfg.ProwConfig)
+	if err != nil {
+		return errors.Wrapf(err, "failed to validate config")
+	}
+	return nil
+}
diff --git a/pkg/triggerconfig/types.go b/pkg/triggerconfig/types.go
new file mode 100644
index 00000000..279303b6
--- /dev/null
+++ b/pkg/triggerconfig/types.go
@@ -0,0 +1,34 @@
+package triggerconfig
+
+import (
+	"github.com/jenkins-x/lighthouse/pkg/config/job"
+	metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
+)
+
+// Config represents local trigger configurations which can be merged into the configuration
+type Config struct {
+	metav1.TypeMeta `json:",inline"`
+	// +optional
+	metav1.ObjectMeta `json:"metadata"`
+
+	// Spec holds the desired state of the Config from the client
+	// +optional
+	Spec ConfigSpec `json:"spec"`
+}
+
+// ConfigSpec specifies the optional presubmit/postsubmit/trigger configurations
+type ConfigSpec struct {
+	// Presubmit zero or more presubmits
+	Presubmits []job.Presubmit `json:"presubmits,omitempty"`
+
+	// Postsubmit zero or more postsubmits
+	Postsubmits []job.Postsubmit `json:"postsubmits,omitempty"`
+}
+
+// ConfigList contains a list of Config
+type ConfigList struct {
+	metav1.TypeMeta `json:",inline"`
+	// +optional
+	metav1.ListMeta `json:"metadata,omitempty"`
+	Items           []Config `json:"items"`
+}
diff --git a/pkg/webhook/create_agent.go b/pkg/webhook/create_agent.go
new file mode 100644
index 00000000..28ceff9b
--- /dev/null
+++ b/pkg/webhook/create_agent.go
@@ -0,0 +1,38 @@
+/*
+Copyright 2016 The Kubernetes Authors.
+
+Licensed under the Apache License, Version 2.0 (the "License");
+you may not use this file except in compliance with the License.
+You may obtain a copy of the License at
+
+    http://www.apache.org/licenses/LICENSE-2.0
+
+Unless required by applicable law or agreed to in writing, software
+distributed under the License is distributed on an "AS IS" BASIS,
+WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+See the License for the specific language governing permissions and
+limitations under the License.
+*/
+
+package webhook
+
+import (
+	"github.com/jenkins-x/lighthouse/pkg/plugins"
+	"github.com/jenkins-x/lighthouse/pkg/triggerconfig/inrepo"
+	"github.com/pkg/errors"
+	"github.com/sirupsen/logrus"
+)
+
+// CreateAgent creates an agent for the given plugin and repository
+// if the repository is configured to use in repository configuration then we create the use the repository specific
+// configuration
+func (s *Server) CreateAgent(l *logrus.Entry, plugin, owner, repo, ref string) (plugins.Agent, error) {
+	pc := plugins.NewAgent(s.ConfigAgent, s.Plugins, s.ClientAgent, s.ServerURL, l.WithField("plugin", plugin))
+
+	var err error
+	pc.Config, pc.PluginConfig, err = inrepo.Generate(pc.SCMProviderClient, pc.Config, pc.PluginConfig, owner, repo, ref)
+	if err != nil {
+		return pc, errors.Wrapf(err, "failed to calculate in repo config")
+	}
+	return pc, nil
+}
diff --git a/pkg/webhook/events.go b/pkg/webhook/events.go
index c59c29dc..85f0ee1e 100644
--- a/pkg/webhook/events.go
+++ b/pkg/webhook/events.go
@@ -115,7 +115,11 @@ func (s *Server) handleGenericComment(l *logrus.Entry, ce *scmprovider.GenericCo
 			s.wg.Add(1)
 			go func(p string, h plugins.GenericCommentHandler) {
 				defer s.wg.Done()
-				agent := plugins.NewAgent(s.ConfigAgent, s.Plugins, s.ClientAgent, s.ServerURL, l.WithField("plugin", p))
+				agent, err := s.CreateAgent(l, p, ce.Repo.Namespace, ce.Repo.Name, "")
+				if err != nil {
+					agent.Logger.WithError(err).Error("Error creating agent for GenericCommentEvent.")
+					return
+				}
 				if err := h(agent, *ce); err != nil {
 					agent.Logger.WithError(err).Error("Error handling GenericCommentEvent.")
 				}
@@ -126,7 +130,11 @@ func (s *Server) handleGenericComment(l *logrus.Entry, ce *scmprovider.GenericCo
 				s.wg.Add(1)
 				go func(p string, h plugins.CommandEventHandler, m plugins.CommandMatch) {
 					defer s.wg.Done()
-					agent := plugins.NewAgent(s.ConfigAgent, s.Plugins, s.ClientAgent, s.ServerURL, l.WithField("plugin", p))
+					agent, err := s.CreateAgent(l, p, ce.Repo.Namespace, ce.Repo.Name, "")
+					if err != nil {
+						agent.Logger.WithError(err).Error("Error creating agent for GenericCommentEvent.")
+						return
+					}
 					agent.InitializeCommentPruner(
 						ce.Repo.Namespace,
 						ce.Repo.Name,
@@ -162,7 +170,11 @@ func (s *Server) handlePushEvent(l *logrus.Entry, pe *scm.PushHook) {
 			c++
 			go func(p string, h plugins.PushEventHandler) {
 				defer s.wg.Done()
-				agent := plugins.NewAgent(s.ConfigAgent, s.Plugins, s.ClientAgent, s.ServerURL, l.WithField("plugin", p))
+				agent, err := s.CreateAgent(l, p, repo.Namespace, repo.Name, pe.Ref)
+				if err != nil {
+					agent.Logger.WithError(err).Error("Error creating agent for PushEvent.")
+					return
+				}
 				if err := h(agent, *pe); err != nil {
 					agent.Logger.WithError(err).Error("Error handling PushEvent.")
 				}
@@ -193,7 +205,11 @@ func (s *Server) handlePullRequestEvent(l *logrus.Entry, pr *scm.PullRequestHook
 			c++
 			go func(p string, h plugins.PullRequestHandler) {
 				defer s.wg.Done()
-				agent := plugins.NewAgent(s.ConfigAgent, s.Plugins, s.ClientAgent, s.ServerURL, l.WithField("plugin", p))
+				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.")
+					return
+				}
 				agent.InitializeCommentPruner(
 					pr.Repo.Namespace,
 					pr.Repo.Name,
@@ -247,11 +263,16 @@ func (s *Server) handleReviewEvent(l *logrus.Entry, re scm.ReviewHook) {
 	})
 	l.Infof("Review %s.", re.Action)
 	for p, h := range s.getPlugins(re.PullRequest.Base.Repo.Namespace, re.PullRequest.Base.Repo.Name) {
+		repo := re.PullRequest.Base.Repo
 		if h.ReviewEventHandler != nil {
 			s.wg.Add(1)
 			go func(p string, h plugins.ReviewEventHandler) {
 				defer s.wg.Done()
-				agent := plugins.NewAgent(s.ConfigAgent, s.Plugins, s.ClientAgent, s.ServerURL, l.WithField("plugin", p))
+				agent, err := s.CreateAgent(l, p, repo.Namespace, repo.Name, re.PullRequest.Sha)
+				if err != nil {
+					agent.Logger.WithError(err).Error("Error creating agent for ReviewEvent.")
+					return
+				}
 				agent.InitializeCommentPruner(
 					re.Repo.Namespace,
 					re.Repo.Name,
@@ -263,6 +284,7 @@ func (s *Server) handleReviewEvent(l *logrus.Entry, re scm.ReviewHook) {
 			}(p, h.ReviewEventHandler)
 		}
 	}
+
 	action := re.Action
 	if !actionRelatesToPullRequestComment(action, l) {
 		return


Test patch:
diff --git a/pkg/keeper/keeper_test.go b/pkg/keeper/keeper_test.go
index 9fb72b7e..6f8e136b 100644
--- a/pkg/keeper/keeper_test.go
+++ b/pkg/keeper/keeper_test.go
@@ -30,6 +30,7 @@ import (
 	"time"
 
 	"github.com/jenkins-x/go-scm/scm"
+	fakescm "github.com/jenkins-x/go-scm/scm/driver/fake"
 	"github.com/jenkins-x/lighthouse/pkg/apis/lighthouse/v1alpha1"
 	"github.com/jenkins-x/lighthouse/pkg/client/clientset/versioned/fake"
 	"github.com/jenkins-x/lighthouse/pkg/config/job"
@@ -509,6 +510,7 @@ type fgc struct {
 	expectedSHA    string
 	ignoreExpected bool
 	combinedStatus map[string]map[string]commitStatus
+	fakeClient     *scm.Client
 }
 
 type commitStatus struct {
@@ -632,6 +634,33 @@ func (f *fgc) GetPullRequestChanges(org, repo string, number int) ([]*scm.Change
 		nil
 }
 
+// GetFile returns the file from git
+func (f *fgc) GetFile(owner, repo, filepath, commit string) ([]byte, error) {
+	if f.fakeClient == nil {
+		f.fakeClient, _ = fakescm.NewDefault()
+	}
+	ctx := context.Background()
+	fullName := scm.Join(owner, repo)
+	answer, r, err := f.fakeClient.Contents.Find(ctx, fullName, filepath, commit)
+	// handle files not existing nicely
+	if r != nil && r.Status == 404 {
+		return nil, nil
+	}
+	var data []byte
+	if answer != nil {
+		data = answer.Data
+	}
+	return data, err
+}
+
+// ListFiles returns the files from git
+func (f *fgc) ListFiles(owner, repo, filepath, commit string) ([]*scm.FileEntry, error) {
+	ctx := context.Background()
+	fullName := scm.Join(owner, repo)
+	answer, _, err := f.fakeClient.Contents.List(ctx, fullName, filepath, commit)
+	return answer, err
+}
+
 // TestDividePool ensures that subpools returned by dividePool satisfy a few
 // important invariants.
 func TestDividePool(t *testing.T) {
diff --git a/pkg/repoconfig/merge/test_data/simple/expected-config.yaml b/pkg/repoconfig/merge/test_data/simple/expected-config.yaml
deleted file mode 100644
index 5aadbf67..00000000
--- a/pkg/repoconfig/merge/test_data/simple/expected-config.yaml
+++ /dev/null
@@ -1,37 +0,0 @@
-branch-protection:
-  orgs:
-    myorg:
-      repos:
-        myowner:
-          required_status_checks:
-            contexts:
-            - lint
-github:
-  LinkURL: null
-plank: {}
-postsubmits:
-  myorg/myowner:
-  - agent: ""
-    context: release
-    name: release
-presubmits:
-  myorg/myowner:
-  - agent: ""
-    always_run: true
-    context: lint
-    name: lint
-    rerun_command: /relint
-    trigger: /lint
-push_gateway:
-  serve_metrics: false
-tide:
-  context_options:
-    required-if-present-contexts: null
-  queries:
-  - labels:
-    - mylabel
-    missingLabels:
-    - foo
-    - bar
-    repos:
-    - myorg/myowner
\ No newline at end of file
diff --git a/pkg/repoconfig/merge/test_data/simple/expected-plugins.yaml b/pkg/repoconfig/merge/test_data/simple/expected-plugins.yaml
deleted file mode 100644
index 404eab00..00000000
--- a/pkg/repoconfig/merge/test_data/simple/expected-plugins.yaml
+++ /dev/null
@@ -1,62 +0,0 @@
-approve:
-- lgtm_acts_as_approve: true
-  repos:
-  - someorg/somerepo
-  require_self_approval: true
-- repos:
-  - myorg/myowner
-  require_self_approval: false
-cat: {}
-cherry_pick_unapproved: {}
-config_updater:
-  gzip: false
-  maps:
-    env/prow/config.yaml:
-      name: config
-    env/prow/plugins.yaml:
-      name: plugins
-heart: {}
-label:
-  additional_labels: null
-owners: {}
-plugins:
-  myorg/myowner:
-  - approve
-  - assign
-  - help
-  - hold
-  - lgtm
-  - lifecycle
-  - size
-  - trigger
-  - wip
-  - heart
-  someorg/somerepo:
-  - config-updater
-  - approve
-  - assign
-  - help
-  - hold
-  - lgtm
-  - lifecycle
-  - size
-  - trigger
-  - wip
-  - heart
-  - cat
-  - override
-  - dog
-  - pony
-requiresig: {}
-sigmention: {}
-size:
-  l: 0
-  m: 0
-  s: 0
-  xl: 0
-  xxl: 0
-triggers:
-- repos:
-  - someorg/somerepo
-  - myorg/myowner
-  trusted_org: someorg
\ No newline at end of file
diff --git a/pkg/repoconfig/merge/test_data/simple/lighthouse.yaml b/pkg/repoconfig/merge/test_data/simple/lighthouse.yaml
deleted file mode 100644
index 7815324a..00000000
--- a/pkg/repoconfig/merge/test_data/simple/lighthouse.yaml
+++ /dev/null
@@ -1,38 +0,0 @@
-apiVersion: config.lighthouse.jenkins-x.io/v1alpha1
-kind: RepositoryConfig
-spec:
-  presubmits:
-  - name: lint
-    context: "lint"
-    alwaysRun: true
-    optional: false
-    trigger: "/lint"
-    rerunCommand: "/relint"
-  postsubmits:
-  - name: release
-    context: "release"
-  branchProtection:
-    contexts:
-    - lint
-  pluginConfig:
-    plugins:
-    - approve
-    - assign
-    - help
-    - hold
-    - lgtm
-    - lifecycle
-    - size
-    - trigger
-    - wip
-    - heart
-    approve:
-      lgtmActsAsApprove: false
-      requireSelfApproval: false
-  keeper:
-    query:
-      labels:
-      - mylabel
-      missingLabels:
-      - foo
-      - bar
diff --git a/pkg/repoconfig/scmload/load_test.go b/pkg/repoconfig/scmload/load_test.go
deleted file mode 100644
index c3c82213..00000000
--- a/pkg/repoconfig/scmload/load_test.go
+++ /dev/null
@@ -1,30 +0,0 @@
-package scmload_test
-
-import (
-	"testing"
-
-	"github.com/jenkins-x/go-scm/scm/driver/fake"
-	"github.com/jenkins-x/lighthouse/pkg/config"
-	"github.com/jenkins-x/lighthouse/pkg/plugins"
-	"github.com/jenkins-x/lighthouse/pkg/repoconfig/scmload"
-	"github.com/stretchr/testify/assert"
-	"github.com/stretchr/testify/require"
-)
-
-func TestMergeConfig(t *testing.T) {
-	scmClient, _ := fake.NewDefault()
-	repoOwner := "myorg"
-	repoName := "myrepo"
-	sha := "TODO"
-	cfg := &config.Config{}
-	pluginCfg := &plugins.Configuration{}
-	flag, err := scmload.MergeConfig(cfg, pluginCfg, scmClient, repoOwner, repoName, sha)
-	require.NoError(t, err, "failed to merge configs")
-	assert.True(t, flag, "did not return merge flag")
-
-	LogConfig(t, cfg)
-
-	r := repoOwner + "/" + repoName
-	assert.Len(t, cfg.Presubmits[r], 2, "presubmits for repo %s", r)
-	assert.Len(t, cfg.Postsubmits[r], 1, "postsubmits for repo %s", r)
-}
diff --git a/pkg/triggerconfig/inrepo/calculate_test.go b/pkg/triggerconfig/inrepo/calculate_test.go
new file mode 100644
index 00000000..1c53aad4
--- /dev/null
+++ b/pkg/triggerconfig/inrepo/calculate_test.go
@@ -0,0 +1,115 @@
+package inrepo_test
+
+import (
+	"testing"
+
+	"github.com/jenkins-x/go-scm/scm"
+	fakescm "github.com/jenkins-x/go-scm/scm/driver/fake"
+	"github.com/jenkins-x/lighthouse/pkg/config"
+	"github.com/jenkins-x/lighthouse/pkg/config/job"
+	"github.com/jenkins-x/lighthouse/pkg/config/lighthouse"
+	"github.com/jenkins-x/lighthouse/pkg/plugins"
+	"github.com/jenkins-x/lighthouse/pkg/scmprovider"
+	"github.com/jenkins-x/lighthouse/pkg/triggerconfig/inrepo"
+	"github.com/stretchr/testify/assert"
+	"github.com/stretchr/testify/require"
+)
+
+func TestCalculate(t *testing.T) {
+	scmClient, _ := fakescm.NewDefault()
+	scmProvider := scmprovider.ToClient(scmClient, "my-bot")
+
+	owner := "myorg"
+	repo := "myrepo"
+	ref := "master"
+	fullName := scm.Join(owner, repo)
+
+	enabled := true
+	sharedConfig := &config.Config{
+		ProwConfig: config.ProwConfig{
+			InRepoConfig: lighthouse.InRepoConfig{
+				Enabled: map[string]*bool{
+					fullName: &enabled,
+				},
+			},
+		},
+	}
+	sharedPluginConfig := &plugins.Configuration{}
+
+	cfg, pluginsCfg, err := inrepo.Generate(scmProvider, sharedConfig, sharedPluginConfig, owner, repo, ref)
+	require.NoError(t, err, "failed to calculate in repo config")
+
+	require.NoError(t, err, "failed to invoke getClientAndTrigger")
+
+	// lets verify we've loaded in repository global configuration
+	require.NotNil(t, cfg, "no client.Config found")
+	require.NotNil(t, pluginsCfg, "no client.PluginConfig found")
+
+	// lets verify we've loaded in repository trigger configuration
+	require.Len(t, cfg.Presubmits[fullName], 2, "presubmits for repo %s", fullName)
+	presubmit := cfg.Presubmits[fullName][0]
+	assert.NotNil(t, presubmit.PipelineRunSpec, "cfg.Presubmits[0].PipelineRunSpec for repo %s", fullName)
+	assert.Equal(t, job.TektonPipelineAgent, presubmit.Agent, "cfg.Presubmits[0].Agent for repo %s", fullName)
+
+	assert.NotNil(t, cfg.Presubmits[fullName][1].PipelineRunSpec, "cfg.Presubmits[1].PipelineRunSpec for repo %s", fullName)
+
+	// lets verify we have a valid PipelineRunSpec and PipelineRunParams
+	if assert.NotNil(t, presubmit.PipelineRunSpec.PipelineSpec, "cfg.Presubmits[0].PipelineRunSpec.PipelineSpec for repo %s", fullName) {
+		t.Logf("repo %s has Presubmits[0] with %d tasks", fullName, len(presubmit.PipelineRunSpec.PipelineSpec.Tasks))
+	}
+
+	pipelineRunParams := presubmit.PipelineRunParams
+	if assert.Len(t, pipelineRunParams, 1, "cfg.Presubmits[0].PipelineRunParams for repo %s", fullName) {
+		t.Logf("repo %s has Presubmits[0] with PipelineRun Params %s = %s", fullName, pipelineRunParams[0].Name, pipelineRunParams[0].ValueTemplate)
+	}
+
+	require.Len(t, cfg.Postsubmits[fullName], 1, "postsubmits for repo %s", fullName)
+	postsubmit := cfg.Postsubmits[fullName][0]
+	assert.NotNil(t, postsubmit.PipelineRunSpec, "cfg.Postsubmits[0].PipelineRunSpec for repo %s", fullName)
+	assert.Equal(t, job.TektonPipelineAgent, postsubmit.Agent, "cfg.Postsubmits[0].Agent for repo %s", fullName)
+
+	// lets test we've a trigger configuration for this repository
+	trigger := pluginsCfg.TriggerFor(owner, repo)
+	require.NotNil(t, trigger, "no trigger found")
+	require.Len(t, trigger.Repos, 1, "trigger.Repos")
+	assert.Equal(t, trigger.Repos[0], fullName, "trigger.Repos[0]")
+}
+
+func TestTriggersInBranchMergeToMaster(t *testing.T) {
+	scmClient, _ := fakescm.NewDefault()
+	scmProvider := scmprovider.ToClient(scmClient, "my-bot")
+
+	owner := "myorg"
+	repo := "branchtest"
+	ref := "mybranch"
+	fullName := scm.Join(owner, repo)
+
+	enabled := true
+	sharedConfig := &config.Config{
+		ProwConfig: config.ProwConfig{
+			InRepoConfig: lighthouse.InRepoConfig{
+				Enabled: map[string]*bool{
+					fullName: &enabled,
+				},
+			},
+		},
+	}
+	sharedPluginConfig := &plugins.Configuration{}
+
+	cfg, _, err := inrepo.Generate(scmProvider, sharedConfig, sharedPluginConfig, owner, repo, ref)
+	require.NoError(t, err, "failed to calculate in repo config")
+
+	presubmits := cfg.Presubmits[fullName]
+	presubmitNames := []string{}
+	for _, ps := range presubmits {
+		presubmitNames = append(presubmitNames, ps.Name)
+	}
+	t.Logf("repo %s has presubit names %v\n", fullName, presubmitNames)
+
+	assert.Len(t, presubmits, 2, "presubmits for repo %s", fullName)
+	assert.Contains(t, presubmitNames, "lint", "presubmits for repo %s", fullName)
+	assert.Contains(t, presubmitNames, "newthingy", "presubmits for repo %s", fullName)
+
+	assert.Len(t, cfg.Postsubmits[fullName], 0, "postsubmits for repo %s", fullName)
+
+}
diff --git a/pkg/repoconfig/scmload/load_integration_test.go b/pkg/triggerconfig/inrepo/load_integration_test.go
similarity index 83%
rename from pkg/repoconfig/scmload/load_integration_test.go
rename to pkg/triggerconfig/inrepo/load_integration_test.go
index 7b3b14b3..e5808f2a 100644
--- a/pkg/repoconfig/scmload/load_integration_test.go
+++ b/pkg/triggerconfig/inrepo/load_integration_test.go
@@ -1,4 +1,4 @@
-package scmload_test
+package inrepo_test
 
 import (
 	"os"
@@ -7,7 +7,8 @@ import (
 	"github.com/jenkins-x/go-scm/scm/factory"
 	"github.com/jenkins-x/lighthouse/pkg/config"
 	"github.com/jenkins-x/lighthouse/pkg/plugins"
-	"github.com/jenkins-x/lighthouse/pkg/repoconfig/scmload"
+	"github.com/jenkins-x/lighthouse/pkg/scmprovider"
+	"github.com/jenkins-x/lighthouse/pkg/triggerconfig/inrepo"
 	"github.com/stretchr/testify/assert"
 	"github.com/stretchr/testify/require"
 )
@@ -20,13 +21,15 @@ func TestMergeConfigIntegration(t *testing.T) {
 		return
 	}
 	scmClient, _ := factory.NewClient("github", "https://github.com", token)
+	scmProvider := scmprovider.ToClient(scmClient, "my-bot")
+
 	repoOwner := "jenkins-x"
 	repoName := "lighthouse-test-project"
 	sha := ""
 	cfg := &config.Config{}
 	pluginCfg := &plugins.Configuration{}
 
-	flag, err := scmload.MergeConfig(cfg, pluginCfg, scmClient, repoOwner, repoName, sha)
+	flag, err := inrepo.MergeTriggers(cfg, pluginCfg, scmProvider, repoOwner, repoName, sha)
 	require.NoError(t, err, "failed to merge configs")
 	assert.True(t, flag, "did not return merge flag")
 
diff --git a/pkg/triggerconfig/inrepo/load_triggers_test.go b/pkg/triggerconfig/inrepo/load_triggers_test.go
new file mode 100644
index 00000000..c5fc3de2
--- /dev/null
+++ b/pkg/triggerconfig/inrepo/load_triggers_test.go
@@ -0,0 +1,48 @@
+package inrepo_test
+
+import (
+	"testing"
+
+	"github.com/jenkins-x/go-scm/scm/driver/fake"
+	"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/triggerconfig/inrepo"
+	"github.com/stretchr/testify/assert"
+	"github.com/stretchr/testify/require"
+)
+
+func TestMergeConfig(t *testing.T) {
+	scmClient, _ := fake.NewDefault()
+	scmProvider := scmprovider.ToClient(scmClient, "my-bot")
+
+	owner := "myorg"
+	repo := "loadtest"
+	ref := "master"
+	cfg := &config.Config{}
+	pluginCfg := &plugins.Configuration{}
+	flag, err := inrepo.MergeTriggers(cfg, pluginCfg, scmProvider, owner, repo, ref)
+	require.NoError(t, err, "failed to merge configs")
+	assert.True(t, flag, "did not return merge flag")
+
+	LogConfig(t, cfg)
+
+	r := owner + "/" + repo
+	assert.Len(t, cfg.Presubmits[r], 2, "presubmits for repo %s", r)
+	assert.Len(t, cfg.Postsubmits[r], 1, "postsubmits for repo %s", r)
+}
+
+func TestInvalidConfigs(t *testing.T) {
+	scmClient, _ := fake.NewDefault()
+	scmProvider := scmprovider.ToClient(scmClient, "my-bot")
+
+	invalidRepos := []string{"duplicate-presubmit", "duplicate-postsubmit"}
+	for _, repo := range invalidRepos {
+		owner := "myorg"
+		ref := "master"
+		_, err := inrepo.LoadTriggerConfig(scmProvider, owner, repo, ref)
+		require.Errorf(t, err, "should have failed to load triggers from repo %s/%s with ref %s", owner, repo, ref)
+
+		t.Logf("got expected error loading invalid configuration on repo %s of: %s", repo, err.Error())
+	}
+}
diff --git a/pkg/repoconfig/scmload/test_data/myorg/myrepo/.lighthouse/linter/lighthouse.yaml b/pkg/triggerconfig/inrepo/test_data/myorg/branchtest/refs/master/.lighthouse/triggers/triggers.yaml
similarity index 74%
rename from pkg/repoconfig/scmload/test_data/myorg/myrepo/.lighthouse/linter/lighthouse.yaml
rename to pkg/triggerconfig/inrepo/test_data/myorg/branchtest/refs/master/.lighthouse/triggers/triggers.yaml
index fb8f4c3d..372fea95 100644
--- a/pkg/repoconfig/scmload/test_data/myorg/myrepo/.lighthouse/linter/lighthouse.yaml
+++ b/pkg/triggerconfig/inrepo/test_data/myorg/branchtest/refs/master/.lighthouse/triggers/triggers.yaml
@@ -1,5 +1,5 @@
 apiVersion: config.lighthouse.jenkins-x.io/v1alpha1
-kind: RepositoryConfig
+kind: TriggerConfig
 spec:
   presubmits:
   - name: lint
@@ -8,7 +8,5 @@ spec:
     optional: false
     trigger: "/lint"
     rerunCommand: "/relint"
-  branchProtection:
-    contexts:
-    - lint
+    agent: tekton-pipeline
 
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
new file mode 100644
index 00000000..aabcc87b
--- /dev/null
+++ b/pkg/triggerconfig/inrepo/test_data/myorg/branchtest/refs/mybranch/.lighthouse/triggers/triggers.yaml
@@ -0,0 +1,12 @@
+apiVersion: config.lighthouse.jenkins-x.io/v1alpha1
+kind: TriggerConfig
+spec:
+  presubmits:
+  - name: newthingy
+    context: "newthingy"
+    alwaysRun: true
+    optional: false
+    trigger: "/newthingy"
+    rerunCommand: "/renewthingy"
+    agent: tekton-pipeline
+
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
new file mode 100644
index 00000000..16af2e57
--- /dev/null
+++ b/pkg/triggerconfig/inrepo/test_data/myorg/duplicate-postsubmit/.lighthouse/duplicate-lint/triggers.yaml
@@ -0,0 +1,16 @@
+apiVersion: config.lighthouse.jenkins-x.io/v1alpha1
+kind: TriggerConfig
+spec:
+  presubmits:
+  - name: lint
+    context: "test"
+    alwaysRun: true
+    optional: false
+    trigger: "/test"
+    rerunCommand: "/retest"
+    agent: tekton-pipeline
+  postsubmits:
+  - name: release
+    context: "release"
+    agent: tekton-pipeline
+
diff --git a/pkg/repoconfig/scmload/test_data/myorg/myrepo/.lighthouse/jenkins-x/lighthouse.yaml b/pkg/triggerconfig/inrepo/test_data/myorg/duplicate-postsubmit/.lighthouse/linter/triggers.yaml
similarity index 77%
rename from pkg/repoconfig/scmload/test_data/myorg/myrepo/.lighthouse/jenkins-x/lighthouse.yaml
rename to pkg/triggerconfig/inrepo/test_data/myorg/duplicate-postsubmit/.lighthouse/linter/triggers.yaml
index 9af5e1d1..a86284c4 100644
--- a/pkg/repoconfig/scmload/test_data/myorg/myrepo/.lighthouse/jenkins-x/lighthouse.yaml
+++ b/pkg/triggerconfig/inrepo/test_data/myorg/duplicate-postsubmit/.lighthouse/linter/triggers.yaml
@@ -1,5 +1,5 @@
 apiVersion: config.lighthouse.jenkins-x.io/v1alpha1
-kind: RepositoryConfig
+kind: TriggerConfig
 spec:
   presubmits:
   - name: test
@@ -8,10 +8,8 @@ spec:
     optional: false
     trigger: "/test"
     rerunCommand: "/retest"
+    agent: tekton-pipeline
   postsubmits:
   - name: release
     context: "release"
-  branchProtection:
-    contexts:
-    - test
-
+    agent: tekton-pipeline
\ No newline at end of file
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
new file mode 100644
index 00000000..16af2e57
--- /dev/null
+++ b/pkg/triggerconfig/inrepo/test_data/myorg/duplicate-presubmit/.lighthouse/duplicate-lint/triggers.yaml
@@ -0,0 +1,16 @@
+apiVersion: config.lighthouse.jenkins-x.io/v1alpha1
+kind: TriggerConfig
+spec:
+  presubmits:
+  - name: lint
+    context: "test"
+    alwaysRun: true
+    optional: false
+    trigger: "/test"
+    rerunCommand: "/retest"
+    agent: tekton-pipeline
+  postsubmits:
+  - name: release
+    context: "release"
+    agent: tekton-pipeline
+
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
new file mode 100644
index 00000000..372fea95
--- /dev/null
+++ b/pkg/triggerconfig/inrepo/test_data/myorg/duplicate-presubmit/.lighthouse/linter/triggers.yaml
@@ -0,0 +1,12 @@
+apiVersion: config.lighthouse.jenkins-x.io/v1alpha1
+kind: TriggerConfig
+spec:
+  presubmits:
+  - name: lint
+    context: "lint"
+    alwaysRun: true
+    optional: false
+    trigger: "/lint"
+    rerunCommand: "/relint"
+    agent: tekton-pipeline
+
diff --git a/pkg/repoconfig/scmload/test_data/myorg/myrepo/.lighthouse/dummy/README.md b/pkg/triggerconfig/inrepo/test_data/myorg/loadtest/.lighthouse/dummy/README.md
similarity index 100%
rename from pkg/repoconfig/scmload/test_data/myorg/myrepo/.lighthouse/dummy/README.md
rename to pkg/triggerconfig/inrepo/test_data/myorg/loadtest/.lighthouse/dummy/README.md
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
new file mode 100644
index 00000000..e08bf03f
--- /dev/null
+++ b/pkg/triggerconfig/inrepo/test_data/myorg/loadtest/.lighthouse/jenkins-x/triggers.yaml
@@ -0,0 +1,16 @@
+apiVersion: config.lighthouse.jenkins-x.io/v1alpha1
+kind: TriggerConfig
+spec:
+  presubmits:
+  - name: test
+    context: "test"
+    alwaysRun: true
+    optional: false
+    trigger: "/test"
+    rerunCommand: "/retest"
+    agent: tekton-pipeline
+  postsubmits:
+  - name: release
+    context: "release"
+    agent: tekton-pipeline
+
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
new file mode 100644
index 00000000..372fea95
--- /dev/null
+++ b/pkg/triggerconfig/inrepo/test_data/myorg/loadtest/.lighthouse/linter/triggers.yaml
@@ -0,0 +1,12 @@
+apiVersion: config.lighthouse.jenkins-x.io/v1alpha1
+kind: TriggerConfig
+spec:
+  presubmits:
+  - name: lint
+    context: "lint"
+    alwaysRun: true
+    optional: false
+    trigger: "/lint"
+    rerunCommand: "/relint"
+    agent: tekton-pipeline
+
diff --git a/pkg/triggerconfig/inrepo/test_data/myorg/myrepo/.lighthouse/dummy/README.md b/pkg/triggerconfig/inrepo/test_data/myorg/myrepo/.lighthouse/dummy/README.md
new file mode 100644
index 00000000..8957ece3
--- /dev/null
+++ b/pkg/triggerconfig/inrepo/test_data/myorg/myrepo/.lighthouse/dummy/README.md
@@ -0,0 +1,1 @@
+to test a dir without a config file
diff --git a/pkg/triggerconfig/inrepo/test_data/myorg/myrepo/.lighthouse/jenkins-x/release.yaml b/pkg/triggerconfig/inrepo/test_data/myorg/myrepo/.lighthouse/jenkins-x/release.yaml
new file mode 100644
index 00000000..5e78279e
--- /dev/null
+++ b/pkg/triggerconfig/inrepo/test_data/myorg/myrepo/.lighthouse/jenkins-x/release.yaml
@@ -0,0 +1,35 @@
+apiVersion: tekton.dev/v1beta1
+kind: PipelineRun
+metadata:
+  name: release
+spec:
+  pipelineSpec:
+    params:
+      - name: MORNING_GREETINGS
+        description: "morning greetings, default is Good Morning!"
+        type: string
+        default: "Good Morning!"
+      - name: NIGHT_GREETINGS
+        description: "Night greetings, default is Good Night!"
+        type: string
+        default: "Good Night!"
+    tasks:
+      # Task to display morning greetings
+      - name: echo-good-morning
+        taskRef:
+          name: task-echo-message
+        params:
+          - name: MESSAGE
+            value: $(params.MORNING_GREETINGS)
+      # Task to display night greetings
+      - name: echo-good-night
+        taskRef:
+          name: task-echo-message
+        params:
+          - name: MESSAGE
+            value: $(params.NIGHT_GREETINGS)
+  params:
+    - name: MORNING_GREETINGS
+      value: "Good Morning, Bob!"
+    - name: NIGHT_GREETINGS
+      value: "Good Night, Bob!"
\ No newline at end of file
diff --git a/pkg/triggerconfig/inrepo/test_data/myorg/myrepo/.lighthouse/jenkins-x/test.yaml b/pkg/triggerconfig/inrepo/test_data/myorg/myrepo/.lighthouse/jenkins-x/test.yaml
new file mode 100644
index 00000000..fa3a065c
--- /dev/null
+++ b/pkg/triggerconfig/inrepo/test_data/myorg/myrepo/.lighthouse/jenkins-x/test.yaml
@@ -0,0 +1,35 @@
+apiVersion: tekton.dev/v1beta1
+kind: PipelineRun
+metadata:
+  name: test
+spec:
+  pipelineSpec:
+    params:
+      - name: MORNING_GREETINGS
+        description: "morning greetings, default is Good Morning!"
+        type: string
+        default: "Good Morning!"
+      - name: NIGHT_GREETINGS
+        description: "Night greetings, default is Good Night!"
+        type: string
+        default: "Good Night!"
+    tasks:
+      # Task to display morning greetings
+      - name: echo-good-morning
+        taskRef:
+          name: task-echo-message
+        params:
+          - name: MESSAGE
+            value: $(params.MORNING_GREETINGS)
+      # Task to display night greetings
+      - name: echo-good-night
+        taskRef:
+          name: task-echo-message
+        params:
+          - name: MESSAGE
+            value: $(params.NIGHT_GREETINGS)
+  params:
+    - name: MORNING_GREETINGS
+      value: "Good Morning, Bob!"
+    - name: NIGHT_GREETINGS
+      value: "Good Night, Bob!"
\ No newline at end of file
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
new file mode 100644
index 00000000..d5f8e659
--- /dev/null
+++ b/pkg/triggerconfig/inrepo/test_data/myorg/myrepo/.lighthouse/jenkins-x/triggers.yaml
@@ -0,0 +1,22 @@
+apiVersion: config.lighthouse.jenkins-x.io/v1alpha1
+kind: TriggerConfig
+spec:
+  presubmits:
+  - name: test
+    context: "test"
+    always_run: true
+    optional: false
+    trigger: "/test"
+    rerun_command: "/retest"
+    source: "test.yaml"
+    pipeline_run_params:
+      - name: MORNING_GREETINGS
+        valueTemplate: "hey this is a custom parameter"
+  postsubmits:
+  - name: release
+    context: "release"
+    source: "release.yaml"
+  branchProtection:
+    contexts:
+    - test
+
diff --git a/pkg/triggerconfig/inrepo/test_data/myorg/myrepo/.lighthouse/linter/lint.yaml b/pkg/triggerconfig/inrepo/test_data/myorg/myrepo/.lighthouse/linter/lint.yaml
new file mode 100644
index 00000000..fcc29375
--- /dev/null
+++ b/pkg/triggerconfig/inrepo/test_data/myorg/myrepo/.lighthouse/linter/lint.yaml
@@ -0,0 +1,35 @@
+apiVersion: tekton.dev/v1beta1
+kind: PipelineRun
+metadata:
+  name: lint
+spec:
+  pipelineSpec:
+    params:
+      - name: MORNING_GREETINGS
+        description: "morning greetings, default is Good Morning!"
+        type: string
+        default: "Good Morning!"
+      - name: NIGHT_GREETINGS
+        description: "Night greetings, default is Good Night!"
+        type: string
+        default: "Good Night!"
+    tasks:
+      # Task to display morning greetings
+      - name: echo-good-morning
+        taskRef:
+          name: task-echo-message
+        params:
+          - name: MESSAGE
+            value: $(params.MORNING_GREETINGS)
+      # Task to display night greetings
+      - name: echo-good-night
+        taskRef:
+          name: task-echo-message
+        params:
+          - name: MESSAGE
+            value: $(params.NIGHT_GREETINGS)
+  params:
+    - name: MORNING_GREETINGS
+      value: "Good Morning, Bob!"
+    - name: NIGHT_GREETINGS
+      value: "Good Night, Bob!"
\ No newline at end of file
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
new file mode 100644
index 00000000..6b0fdad2
--- /dev/null
+++ b/pkg/triggerconfig/inrepo/test_data/myorg/myrepo/.lighthouse/linter/triggers.yaml
@@ -0,0 +1,15 @@
+apiVersion: config.lighthouse.jenkins-x.io/v1alpha1
+kind: TriggerConfig
+spec:
+  presubmits:
+  - name: lint
+    context: "lint"
+    always_run: true
+    optional: false
+    trigger: "/lint"
+    rerun_command: "/relint"
+    source: "lint.yaml"
+  branchProtection:
+    contexts:
+    - lint
+
diff --git a/pkg/repoconfig/merge/combine_test.go b/pkg/triggerconfig/merge/combine_test.go
similarity index 68%
rename from pkg/repoconfig/merge/combine_test.go
rename to pkg/triggerconfig/merge/combine_test.go
index ad7630c0..52c23ea8 100644
--- a/pkg/repoconfig/merge/combine_test.go
+++ b/pkg/triggerconfig/merge/combine_test.go
@@ -3,53 +3,54 @@ package merge_test
 import (
 	"testing"
 
-	"github.com/jenkins-x/lighthouse/pkg/repoconfig"
-	"github.com/jenkins-x/lighthouse/pkg/repoconfig/merge"
+	"github.com/jenkins-x/lighthouse/pkg/config/job"
+	"github.com/jenkins-x/lighthouse/pkg/triggerconfig"
+	"github.com/jenkins-x/lighthouse/pkg/triggerconfig/merge"
 	"github.com/stretchr/testify/assert"
 	"github.com/stretchr/testify/require"
 )
 
-func TestCombineRepositoryConfig(t *testing.T) {
-	v1 := repoconfig.RepositoryConfig{
-		Spec: repoconfig.RepositoryConfigSpec{
-			Presubmits: []repoconfig.Presubmit{
+func TestCombineTriggerConfig(t *testing.T) {
+	v1 := triggerconfig.Config{
+		Spec: triggerconfig.ConfigSpec{
+			Presubmits: []job.Presubmit{
 				{
-					JobBase: repoconfig.JobBase{
+					Base: job.Base{
 						Name: "lint",
 					},
 					AlwaysRun:    true,
 					Optional:     false,
 					Trigger:      "/lint",
 					RerunCommand: "/relint",
-					Reporter: repoconfig.Reporter{
+					Reporter: job.Reporter{
 						Context: "lint",
 					},
 				},
 			},
-			Postsubmits: []repoconfig.Postsubmit{
+			Postsubmits: []job.Postsubmit{
 				{
-					JobBase: repoconfig.JobBase{
+					Base: job.Base{
 						Name: "release",
 					},
-					Reporter: repoconfig.Reporter{
+					Reporter: job.Reporter{
 						Context: "release",
 					},
 				},
 			},
 		},
 	}
-	v2 := repoconfig.RepositoryConfig{
-		Spec: repoconfig.RepositoryConfigSpec{
-			Presubmits: []repoconfig.Presubmit{
+	v2 := triggerconfig.Config{
+		Spec: triggerconfig.ConfigSpec{
+			Presubmits: []job.Presubmit{
 				{
-					JobBase: repoconfig.JobBase{
+					Base: job.Base{
 						Name: "another",
 					},
 					AlwaysRun:    true,
 					Optional:     false,
 					Trigger:      "/another",
 					RerunCommand: "/reanother",
-					Reporter: repoconfig.Reporter{
+					Reporter: job.Reporter{
 						Context: "another",
 					},
 				},
@@ -59,8 +60,8 @@ func TestCombineRepositoryConfig(t *testing.T) {
 
 	testCases := []struct {
 		name                string
-		r1                  *repoconfig.RepositoryConfig
-		r2                  *repoconfig.RepositoryConfig
+		r1                  *triggerconfig.Config
+		r2                  *triggerconfig.Config
 		expectedPresubmits  int
 		expectedPostsubmits int
 	}{
diff --git a/pkg/repoconfig/merge/merge_test.go b/pkg/triggerconfig/merge/merge_test.go
similarity index 81%
rename from pkg/repoconfig/merge/merge_test.go
rename to pkg/triggerconfig/merge/merge_test.go
index e3837640..a74f6a7d 100644
--- a/pkg/repoconfig/merge/merge_test.go
+++ b/pkg/triggerconfig/merge/merge_test.go
@@ -8,56 +8,52 @@ import (
 
 	"github.com/google/go-cmp/cmp"
 	"github.com/jenkins-x/lighthouse/pkg/config"
-	"github.com/jenkins-x/lighthouse/pkg/config/keeper"
+	"github.com/jenkins-x/lighthouse/pkg/config/job"
 	"github.com/jenkins-x/lighthouse/pkg/plugins"
-	"github.com/jenkins-x/lighthouse/pkg/repoconfig"
-	"github.com/jenkins-x/lighthouse/pkg/repoconfig/merge"
+	"github.com/jenkins-x/lighthouse/pkg/triggerconfig"
+	"github.com/jenkins-x/lighthouse/pkg/triggerconfig/merge"
 	"github.com/stretchr/testify/assert"
 	"github.com/stretchr/testify/require"
 	"sigs.k8s.io/yaml"
 )
 
-func TestMergeRepositoryConfig(t *testing.T) {
+func TestMergeTriggerConfig(t *testing.T) {
 	testCases := []struct {
 		name       string
 		cfg        config.Config
 		pluginCfg  plugins.Configuration
-		repoConfig repoconfig.RepositoryConfig
+		repoConfig triggerconfig.Config
 	}{
 		{
 			name: "emptyConfig",
-			repoConfig: repoconfig.RepositoryConfig{
-				Spec: repoconfig.RepositoryConfigSpec{
-					Presubmits: []repoconfig.Presubmit{
+			repoConfig: triggerconfig.Config{
+				Spec: triggerconfig.ConfigSpec{
+					Presubmits: []job.Presubmit{
 						{
-							JobBase: repoconfig.JobBase{
-								Name: "lint",
+							Base: job.Base{
+								Name:  "lint",
+								Agent: job.TektonPipelineAgent,
 							},
 							AlwaysRun:    true,
 							Optional:     false,
 							Trigger:      "/lint",
 							RerunCommand: "/relint",
-							Reporter: repoconfig.Reporter{
+							Reporter: job.Reporter{
 								Context: "lint",
 							},
 						},
 					},
-					Postsubmits: []repoconfig.Postsubmit{
+					Postsubmits: []job.Postsubmit{
 						{
-							JobBase: repoconfig.JobBase{
-								Name: "release",
+							Base: job.Base{
+								Name:  "release",
+								Agent: job.TektonPipelineAgent,
 							},
-							Reporter: repoconfig.Reporter{
+							Reporter: job.Reporter{
 								Context: "release",
 							},
 						},
 					},
-					Keeper: &repoconfig.Keeper{
-						Query: &keeper.Query{
-							Labels:        []string{"mylabel"},
-							MissingLabels: []string{"foo", "bar"},
-						},
-					},
 				},
 			},
 		},
@@ -80,7 +76,7 @@ func TestMergeRepositoryConfig(t *testing.T) {
 	}
 }
 
-func TestMergeRepositoryConfigFiles(t *testing.T) {
+func TestMergeTriggerConfigFiles(t *testing.T) {
 	sourceData := filepath.Join("test_data")
 	fileNames, err := ioutil.ReadDir(sourceData)
 	assert.NoError(t, err)
@@ -95,7 +91,7 @@ func TestMergeRepositoryConfigFiles(t *testing.T) {
 			srcPluginsFile := filepath.Join(sourceData, name, "source-plugins.yaml")
 			expectedConfigFile := filepath.Join(sourceData, name, "expected-config.yaml")
 			expectedPluginsFile := filepath.Join(sourceData, name, "expected-plugins.yaml")
-			repoConfigFile := filepath.Join(sourceData, name, "lighthouse.yaml")
+			repoConfigFile := filepath.Join(sourceData, name, "triggers.yaml")
 			require.FileExists(t, srcConfigFile)
 			require.FileExists(t, expectedConfigFile)
 			require.FileExists(t, expectedPluginsFile)
@@ -103,7 +99,7 @@ func TestMergeRepositoryConfigFiles(t *testing.T) {
 
 			cfg := &config.Config{}
 			pluginCfg := &plugins.Configuration{}
-			repoConfig := &repoconfig.RepositoryConfig{}
+			repoConfig := &triggerconfig.Config{}
 			LoadYAMLFile(t, srcConfigFile, cfg)
 			LoadYAMLFile(t, srcPluginsFile, pluginCfg)
 			LoadYAMLFile(t, repoConfigFile, repoConfig)
diff --git a/pkg/triggerconfig/merge/test_data/simple/expected-config.yaml b/pkg/triggerconfig/merge/test_data/simple/expected-config.yaml
new file mode 100644
index 00000000..97d04f23
--- /dev/null
+++ b/pkg/triggerconfig/merge/test_data/simple/expected-config.yaml
@@ -0,0 +1,23 @@
+branch-protection: {}
+github:
+  LinkURL: null
+in_repo_config: {}
+plank: {}
+postsubmits:
+  myorg/myowner:
+  - agent: tekton-pipeline
+    context: release
+    name: release
+presubmits:
+  myorg/myowner:
+  - agent: tekton-pipeline
+    always_run: true
+    context: lint
+    name: lint
+    rerun_command: /relint
+    trigger: /lint
+push_gateway:
+  serve_metrics: false
+tide:
+  context_options:
+    required-if-present-contexts: null
\ No newline at end of file
diff --git a/pkg/triggerconfig/merge/test_data/simple/expected-plugins.yaml b/pkg/triggerconfig/merge/test_data/simple/expected-plugins.yaml
new file mode 100644
index 00000000..d940c6b2
--- /dev/null
+++ b/pkg/triggerconfig/merge/test_data/simple/expected-plugins.yaml
@@ -0,0 +1,60 @@
+approve:
+- lgtm_acts_as_approve: true
+  repos:
+  - someorg/somerepo
+  require_self_approval: true
+cat: {}
+cherry_pick_unapproved:
+  branchregexp: ^release-.*$
+  comment: |-
+    This PR is not for the master branch but does not have the `cherry-pick-approved`  label. Adding the `do-not-merge/cherry-pick-not-approved`  label.
+
+    To approve the cherry-pick, please assign the patch release manager for the release branch by writing `/assign @username` in a comment when ready.
+
+    The list of patch release managers for each release can be found [here](https://git.k8s.io/sig-release/release-managers.md).
+config_updater:
+  gzip: false
+  maps:
+    env/prow/config.yaml:
+      name: config
+    env/prow/plugins.yaml:
+      name: plugins
+heart: {}
+label:
+  additional_labels: null
+owners:
+  labels_excludes:
+  - approved
+  - lgtm
+plugins:
+  someorg/somerepo:
+  - config-updater
+  - approve
+  - assign
+  - help
+  - hold
+  - lgtm
+  - lifecycle
+  - size
+  - trigger
+  - wip
+  - heart
+  - cat
+  - override
+  - dog
+  - pony
+requiresig: {}
+sigmention:
+  regexp: (?m)@kubernetes/sig-([\w-]*)-(misc|test-failures|bugs|feature-requests|proposals|pr-reviews|api-reviews)
+size:
+  l: 0
+  m: 0
+  s: 0
+  xl: 0
+  xxl: 0
+triggers:
+- join_org_url: https://github.com/orgs/someorg/people
+  repos:
+  - someorg/somerepo
+  - myorg/myowner
+  trusted_org: someorg
\ No newline at end of file
diff --git a/pkg/repoconfig/merge/test_data/simple/source-config.yaml b/pkg/triggerconfig/merge/test_data/simple/source-config.yaml
similarity index 100%
rename from pkg/repoconfig/merge/test_data/simple/source-config.yaml
rename to pkg/triggerconfig/merge/test_data/simple/source-config.yaml
diff --git a/pkg/repoconfig/merge/test_data/simple/source-plugins.yaml b/pkg/triggerconfig/merge/test_data/simple/source-plugins.yaml
similarity index 100%
rename from pkg/repoconfig/merge/test_data/simple/source-plugins.yaml
rename to pkg/triggerconfig/merge/test_data/simple/source-plugins.yaml
diff --git a/pkg/triggerconfig/merge/test_data/simple/triggers.yaml b/pkg/triggerconfig/merge/test_data/simple/triggers.yaml
new file mode 100644
index 00000000..8cd2c076
--- /dev/null
+++ b/pkg/triggerconfig/merge/test_data/simple/triggers.yaml
@@ -0,0 +1,15 @@
+apiVersion: config.lighthouse.jenkins-x.io/v1alpha1
+kind: TriggerConfig
+spec:
+  presubmits:
+  - name: lint
+    context: "lint"
+    always_run: true
+    optional: false
+    trigger: "/lint"
+    rerun_command: "/relint"
+    agent: tekton-pipeline
+  postsubmits:
+  - name: release
+    context: "release"
+    agent: tekton-pipeline
diff --git a/pkg/triggerconfig/scmload/test_data/myorg/duplicate-postsubmit/.lighthouse/duplicate-lint/triggers.yaml b/pkg/triggerconfig/scmload/test_data/myorg/duplicate-postsubmit/.lighthouse/duplicate-lint/triggers.yaml
new file mode 100644
index 00000000..16af2e57
--- /dev/null
+++ b/pkg/triggerconfig/scmload/test_data/myorg/duplicate-postsubmit/.lighthouse/duplicate-lint/triggers.yaml
@@ -0,0 +1,16 @@
+apiVersion: config.lighthouse.jenkins-x.io/v1alpha1
+kind: TriggerConfig
+spec:
+  presubmits:
+  - name: lint
+    context: "test"
+    alwaysRun: true
+    optional: false
+    trigger: "/test"
+    rerunCommand: "/retest"
+    agent: tekton-pipeline
+  postsubmits:
+  - name: release
+    context: "release"
+    agent: tekton-pipeline
+
diff --git a/pkg/triggerconfig/scmload/test_data/myorg/duplicate-postsubmit/.lighthouse/linter/triggers.yaml b/pkg/triggerconfig/scmload/test_data/myorg/duplicate-postsubmit/.lighthouse/linter/triggers.yaml
new file mode 100644
index 00000000..a86284c4
--- /dev/null
+++ b/pkg/triggerconfig/scmload/test_data/myorg/duplicate-postsubmit/.lighthouse/linter/triggers.yaml
@@ -0,0 +1,15 @@
+apiVersion: config.lighthouse.jenkins-x.io/v1alpha1
+kind: TriggerConfig
+spec:
+  presubmits:
+  - name: test
+    context: "test"
+    alwaysRun: true
+    optional: false
+    trigger: "/test"
+    rerunCommand: "/retest"
+    agent: tekton-pipeline
+  postsubmits:
+  - name: release
+    context: "release"
+    agent: tekton-pipeline
\ No newline at end of file
diff --git a/pkg/triggerconfig/scmload/test_data/myorg/duplicate-presubmit/.lighthouse/duplicate-lint/triggers.yaml b/pkg/triggerconfig/scmload/test_data/myorg/duplicate-presubmit/.lighthouse/duplicate-lint/triggers.yaml
new file mode 100644
index 00000000..16af2e57
--- /dev/null
+++ b/pkg/triggerconfig/scmload/test_data/myorg/duplicate-presubmit/.lighthouse/duplicate-lint/triggers.yaml
@@ -0,0 +1,16 @@
+apiVersion: config.lighthouse.jenkins-x.io/v1alpha1
+kind: TriggerConfig
+spec:
+  presubmits:
+  - name: lint
+    context: "test"
+    alwaysRun: true
+    optional: false
+    trigger: "/test"
+    rerunCommand: "/retest"
+    agent: tekton-pipeline
+  postsubmits:
+  - name: release
+    context: "release"
+    agent: tekton-pipeline
+
diff --git a/pkg/triggerconfig/scmload/test_data/myorg/duplicate-presubmit/.lighthouse/linter/triggers.yaml b/pkg/triggerconfig/scmload/test_data/myorg/duplicate-presubmit/.lighthouse/linter/triggers.yaml
new file mode 100644
index 00000000..372fea95
--- /dev/null
+++ b/pkg/triggerconfig/scmload/test_data/myorg/duplicate-presubmit/.lighthouse/linter/triggers.yaml
@@ -0,0 +1,12 @@
+apiVersion: config.lighthouse.jenkins-x.io/v1alpha1
+kind: TriggerConfig
+spec:
+  presubmits:
+  - name: lint
+    context: "lint"
+    alwaysRun: true
+    optional: false
+    trigger: "/lint"
+    rerunCommand: "/relint"
+    agent: tekton-pipeline
+