From 378b5131ea39c421162d5766e3516f8e6b95013f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Christian=20K=C3=BChnel?= Date: Tue, 7 Apr 2020 14:44:13 +0200 Subject: [PATCH] added timeouts for pipelines --- Jenkins/BETA-apply-patch/Jenkinsfile | 2 +- Jenkins/BETA-phabricator-linux/Jenkinsfile | 3 +++ Jenkins/Phabricator-pipeline/Jenkinsfile | 3 +++ 3 files changed, 7 insertions(+), 1 deletion(-) diff --git a/Jenkins/BETA-apply-patch/Jenkinsfile b/Jenkins/BETA-apply-patch/Jenkinsfile index 375459c..e0010ff 100644 --- a/Jenkins/BETA-apply-patch/Jenkinsfile +++ b/Jenkins/BETA-apply-patch/Jenkinsfile @@ -1 +1 @@ -// Copyright 2019 Google LLC // // Licensed under the the Apache License v2.0 with LLVM Exceptions (the "License"); // you may not use this file except in compliance with the License. // You may obtain a copy of the License at // // https://llvm.org/LICENSE.txt // // 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. def success = true def failure_message = "" pipeline { agent { label 'linux' } parameters { string(name: 'DIFF_ID') string(name: 'PHID') string(name: 'REV_ID') } environment { CONDUIT_TOKEN = credentials('phabricator-conduit-token') PHABRICATOR_HOST = 'https://reviews.llvm.org' LLVM_DIR = "${WORKSPACE}/llvm-project" SCRIPT_DIR = "${WORKSPACE}/llvm-premerge-checks/scripts" RESULT_DIR = "${WORKSPACE}/results" PHAB_LOG = "${RESULT_DIR}/.phabricator-comment" MY_BUILD_ID = "${JOB_BASE_NAME}-${BUILD_NUMBER}" TARGET_DIR = "/mnt/nfs/results/${MY_BUILD_ID}" RESULT_URL = "http://results.llvm-merge-guard.org/${MY_BUILD_ID}" } stages { stage("build info"){ steps { echo "Building diff ${DIFF_ID} with PHID ${PHID} for Revision ${REV_ID}" script { currentBuild.displayName += " D${REV_ID}" currentBuild.description = "D${REV_ID}" } } } stage("git checkout"){ steps { dir("${LLVM_DIR}"){ git url: 'git@github.com:llvm-premerge-tests/llvm-project.git' } dir("llvm-premerge-checks") { git url: 'https://github.com/google/llvm-premerge-checks.git' } sh """ rm -rf ${RESULT_DIR} mkdir -p ${RESULT_DIR} """ } } stage('arc patch'){ steps { dir("${LLVM_DIR}"){ sh """ ${SCRIPT_DIR}/phabtalk/apply_patch2.py ${DIFF_ID} \ --token ${CONDUIT_TOKEN} \ --url ${PHABRICATOR_HOST} \ --comment-file ${PHAB_LOG} \ --push-branch """ } } } } post { always { dir("${RESULT_DIR}") { // copy console log to result folder sh "wget -qO console-log.txt http://jenkins-ui.jenkins.svc.cluster.local:8080/job/${JOB_BASE_NAME}/${BUILD_NUMBER}/consoleText" sh "mkdir ${TARGET_DIR}" sh "cp * ${TARGET_DIR}" } sh """${SCRIPT_DIR}/phabtalk/phabtalk.py "${PHID}" "${DIFF_ID}" \ --workspace "${LLVM_DIR}" \ --conduit-token "${CONDUIT_TOKEN}" \ --host "${PHABRICATOR_HOST}/api/" \ --buildresult ${currentBuild.result} \ --results-dir "${TARGET_DIR}" \ --results-url "${RESULT_URL}" \ --failures "Applying patch failed" \ --name "apply patch" """ } } } \ No newline at end of file +// Copyright 2019 Google LLC // // Licensed under the the Apache License v2.0 with LLVM Exceptions (the "License"); // you may not use this file except in compliance with the License. // You may obtain a copy of the License at // // https://llvm.org/LICENSE.txt // // 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. def success = true def failure_message = "" pipeline { agent { label 'linux' } parameters { string(name: 'DIFF_ID') string(name: 'PHID') string(name: 'REV_ID') } environment { CONDUIT_TOKEN = credentials('phabricator-conduit-token') PHABRICATOR_HOST = 'https://reviews.llvm.org' LLVM_DIR = "${WORKSPACE}/llvm-project" SCRIPT_DIR = "${WORKSPACE}/llvm-premerge-checks/scripts" RESULT_DIR = "${WORKSPACE}/results" PHAB_LOG = "${RESULT_DIR}/.phabricator-comment" MY_BUILD_ID = "${JOB_BASE_NAME}-${BUILD_NUMBER}" TARGET_DIR = "/mnt/nfs/results/${MY_BUILD_ID}" RESULT_URL = "http://results.llvm-merge-guard.org/${MY_BUILD_ID}" } options { timeout(time:10, unit:'MINUTES') } stages { stage("build info"){ steps { echo "Building diff ${DIFF_ID} with PHID ${PHID} for Revision ${REV_ID}" script { currentBuild.displayName += " D${REV_ID}" currentBuild.description = "D${REV_ID}" } } } stage("git checkout"){ steps { dir("${LLVM_DIR}"){ git url: 'git@github.com:llvm-premerge-tests/llvm-project.git' } dir("llvm-premerge-checks") { git url: 'https://github.com/google/llvm-premerge-checks.git' } sh """ rm -rf ${RESULT_DIR} mkdir -p ${RESULT_DIR} """ } } stage('arc patch'){ steps { dir("${LLVM_DIR}"){ sh """ ${SCRIPT_DIR}/phabtalk/apply_patch2.py ${DIFF_ID} \ --token ${CONDUIT_TOKEN} \ --url ${PHABRICATOR_HOST} \ --comment-file ${PHAB_LOG} \ --push-branch """ } } } } post { always { dir("${RESULT_DIR}") { // copy console log to result folder sh "wget -qO console-log.txt http://jenkins-ui.jenkins.svc.cluster.local:8080/job/${JOB_BASE_NAME}/${BUILD_NUMBER}/consoleText" sh "mkdir ${TARGET_DIR}" sh "cp * ${TARGET_DIR}" } sh """${SCRIPT_DIR}/phabtalk/phabtalk.py "${PHID}" "${DIFF_ID}" \ --workspace "${LLVM_DIR}" \ --conduit-token "${CONDUIT_TOKEN}" \ --host "${PHABRICATOR_HOST}/api/" \ --buildresult ${currentBuild.result} \ --results-dir "${TARGET_DIR}" \ --results-url "${RESULT_URL}" \ --failures "Applying patch failed" \ --name "apply patch" """ } } } \ No newline at end of file diff --git a/Jenkins/BETA-phabricator-linux/Jenkinsfile b/Jenkins/BETA-phabricator-linux/Jenkinsfile index 824b7fc..32301ba 100644 --- a/Jenkins/BETA-phabricator-linux/Jenkinsfile +++ b/Jenkins/BETA-phabricator-linux/Jenkinsfile @@ -33,6 +33,9 @@ pipeline { TARGET_DIR = "/mnt/nfs/results/${MY_BUILD_ID}" RESULT_URL = "http://results.llvm-merge-guard.org/${MY_BUILD_ID}" } + options { + timeout(time:2, unit:'HOURS') + } stages { stage("build info"){ steps { diff --git a/Jenkins/Phabricator-pipeline/Jenkinsfile b/Jenkins/Phabricator-pipeline/Jenkinsfile index 31a90c2..a05d331 100644 --- a/Jenkins/Phabricator-pipeline/Jenkinsfile +++ b/Jenkins/Phabricator-pipeline/Jenkinsfile @@ -31,6 +31,9 @@ pipeline { RESULT_URL = "http://results.llvm-merge-guard.org/${BUILD_ID}" DIFF_JSON = "${WORKSPACE}/build/diff.json" } + options { + timeout(time:2, unit:'HOURS') + } stages { stage("build info"){ steps {