Refactor gitlab CI integration
This patch refactors the CI process for the image a lot. It creates a universal build and test step while reducing the previous duplicated build step for master, to a relabling job. This should prevent problem form code duplication that appeared in other projects before.