Build matrix for master and slave