Refactor build config to use triggers

Add triggers to build configs, similar to triggers on deployment configs
This code should be factored better - It's extremely hard to follow.