jenkins-trigger.groovy 2.5 KB
Newer Older
1
// Copyright 2017-2020 Intel Corporation
2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23
//
// 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.

// This script acts as a trigger script for the main ngraph-unittest.groovy
// Jenkins job.  This script is part of a Jenkins multi-branch pipeline job
// which can trigger GitHub jobs more effectively than the GitHub Pull
// Request Builder (GHPRB) plugin, in our environment.

// The original ngraph-unittest job required the following parameters.  We
// set these up below as global variables, so we do not need to rewrite the
// original script -- we only need to provide this new trigger hook.
//
24

25
String JENKINS_BRANCH = "master"
26
String TIMEOUTTIME = "3600"
27 28 29 30 31

// Constants
JENKINS_DIR = '.'

timestamps {
32

33 34 35 36 37
    node("trigger") {

        deleteDir()  // Clear the workspace before starting

        // Clone the cje-algo directory which contains our Jenkins groovy scripts
38 39 40
        def sleeptime=0
        retry(count: 3) {
            sleep sleeptime; sleeptime = 10
41
            sh "git clone -b $JENKINS_BRANCH https://gitlab.devtools.intel.com/AIPG/AlgoVal/cje-algo ."
42
        }
43 44 45 46 47 48

        // Call the main job script.
        //
        // NOTE: We keep the main job script in github.intel.com because it may
        //      contain references to technology which has not yet been released.
        //
49
        
50 51
        echo "Calling ngraph-ci-premerge.groovy"
        def ngraphCIPreMerge = load("${JENKINS_DIR}/ngraph-ci-premerge.groovy")
52

53
        ngraphCIPreMerge(premerge: 'true',
54 55 56 57
                         prURL: CHANGE_URL,
                         prTitle: CHANGE_TITLE,
                         prTarget: CHANGE_TARGET,
                         prAuthor: CHANGE_AUTHOR,
58
                         jenkinsBranch: JENKINS_BRANCH,
59
                         timeoutTime: TIMEOUTTIME,
60 61 62 63
                         useMBPipelineSCM: 'true',
                         checkoutBranch: '-UNDEFINED-BRANCH-'
                        )
                         
64 65 66
        echo "ngraph-ci-premerge.groovy completed"

    }  // End:  node
67

68 69 70 71
}  // End:  timestamps

echo "Done"