#!/usr/bin/groovy

// Copyright (C) Luxoft Sweden AB 2018

void buildARP(String variant, String imageName) {
    String arpDir = "meta-arp"
    node("Yocto") {
        dir(arpDir) {
            checkout scm
        }

        // Initialize pelux-manifests to get the code
        sh "rm -rf pelux-manifests/"
        sh "git clone https://github.com/Pelagicore/pelux-manifests.git"

        dir('pelux-manifests') {
            def code = load "ci-scripts/yocto.groovy"
            String arpPath = "${env.WORKSPACE}/${arpDir}"
            code.buildWithLayer(variant, imageName, arpDir, arpPath)
        }
    }
}

parallel (
    'arp':        { buildARP("arp",        "core-image-pelux-minimal") },
    'arp-qtauto': { buildARP("arp-qtauto", "core-image-pelux-qtauto-neptune") },
)
