|
| 1 | +// Copyright 2017-2019 Intel Corporation |
| 2 | +// |
| 3 | +// Licensed under the Apache License, Version 2.0 (the "License"); |
| 4 | +// you may not use this file except in compliance with the License. |
| 5 | +// You may obtain a copy of the License at |
| 6 | +// |
| 7 | +// http://www.apache.org/licenses/LICENSE-2.0 |
| 8 | +// |
| 9 | +// Unless required by applicable law or agreed to in writing, software |
| 10 | +// distributed under the License is distributed on an "AS IS" BASIS, |
| 11 | +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| 12 | +// See the License for the specific language governing permissions and |
| 13 | +// limitations under the License. |
| 14 | + |
| 15 | +// This script acts as a trigger script for the main ngraph-unittest.groovy |
| 16 | +// Jenkins job. This script is part of a Jenkins multi-branch pipeline job |
| 17 | +// which can trigger GitHub jobs more effectively than the GitHub Pull |
| 18 | +// Request Builder (GHPRB) plugin, in our environment. |
| 19 | + |
| 20 | +// The original ngraph-tf-unittest job required the following parameters. We |
| 21 | +// set these up below as global variables, so we do not need to rewrite the |
| 22 | +// original script -- we only need to provide this new trigger hook. |
| 23 | +// |
| 24 | +// Parameters which ngraph-unittest uses: |
| 25 | +String PR_URL = CHANGE_URL |
| 26 | +String PR_COMMIT_AUTHOR = CHANGE_AUTHOR |
| 27 | +//ORIG: String JENKINS_BRANCH = "master" |
| 28 | +String JENKINS_BRANCH = "chrisl/ngraph-bridge" |
| 29 | + |
| 30 | +// Constants |
| 31 | +JENKINS_DIR = 'jenkins' |
| 32 | + |
| 33 | +env.MB_PIPELINE_CHECKOUT = true |
| 34 | + |
| 35 | +node("trigger") { |
| 36 | + |
| 37 | + echo ' ' |
| 38 | + echo "Trigger started with parameters:" |
| 39 | + echo " PR_URL: ${PR_URL}" |
| 40 | + echo " PR_COMMIT_AUTHOR: ${PR_COMMIT_AUTHOR}" |
| 41 | + echo " JENKINS_BRANCH: ${JENKINS_BRANCH}" |
| 42 | + |
| 43 | + deleteDir() // Clear the workspace before starting |
| 44 | + |
| 45 | + dir(JENKINS_DIR){ |
| 46 | + // Clone the cje-algo directory which contains our Jenkins groovy script |
| 47 | + git(branch: JENKINS_BRANCH, changelog: false, poll: false, |
| 48 | + url: 'https://github.intel.com/AIPG/cje-algo') |
| 49 | + } |
| 50 | + |
| 51 | + sh """ |
| 52 | + echo ' ' |
| 53 | + echo "Contents of WORKSPACE:" |
| 54 | + ls -l |
| 55 | + echo ' ' |
| 56 | + echo "Contents of WORKSPACE/${JENKINS_DIR}" |
| 57 | + ls -l ${JENKINS_DIR} |
| 58 | + """ |
| 59 | + |
| 60 | + // Call the main job script. |
| 61 | + // |
| 62 | + // NOTE: We keep the main job script in github.intel.com because it may |
| 63 | + // contain references to tech which has not yet been released. |
| 64 | + // |
| 65 | + echo "Calling tf-ng-bridge-ci-premerge.groovy" |
| 66 | + def ciPreMerge = load("${JENKINS_DIR}/tf-ng-bridge-ci-premerge.groovy") |
| 67 | + ciPreMerge(PR_URL, PR_COMMIT_AUTHOR) |
| 68 | + echo "tf-ng-bridge-ci-premerge.groovy completed" |
| 69 | + |
| 70 | +} // End: node |
| 71 | + |
| 72 | +echo "Done" |
0 commit comments