From 44fbd9ea6bcd06f55959c277f71ea2ea9970776f Mon Sep 17 00:00:00 2001 From: Michal Konečný Date: Jun 21 2022 10:18:49 +0000 Subject: Don't mix declarative and scripted pipeline Agent can't be used in scripted pipeline, which is used by pagure project. This means that the label needs to be defined differently as well. For more info about scripted and declarative Jenkins pipeline see https://www.jenkins.io/doc/book/pipeline/#declarative-versus-scripted-pipeline-syntax Signed-off-by: Michal Konečný --- diff --git a/.cico.pipeline b/.cico.pipeline index d784a04..781a4b4 100644 --- a/.cico.pipeline +++ b/.cico.pipeline @@ -25,64 +25,60 @@ def syncfromduffynode(rsyncpath){ sh 'rsync -e "ssh -o UserKnownHostsFile=/dev/null -o StrictHostKeyChecking=no -l root " -Ha --include=' + rsyncpath + " ${DUFFY_NODE}.ci.centos.org:~/ ./" } -agent { - node('pagure') { +node('cico-workspace') { - label 'cico-workspace' - - properties([ - parameters([ - string(defaultValue: "", description: "", name: "REPO"), - string(defaultValue: "", description: "", name: "BRANCH"), - ]) + properties([ + parameters([ + string(defaultValue: "", description: "", name: "REPO"), + string(defaultValue: "", description: "", name: "BRANCH"), ]) + ]) + + stage('Allocate Node'){ + env.CICO_API_KEY = env.DUFFY_KEY + duffy_rtn=sh( + script: 'cico --debug node get -f value -c hostname -c comment', + returnStdout: true + ).trim().tokenize(' ') + env.DUFFY_NODE=duffy_rtn[0] + env.SSID=duffy_rtn[1] + env.BRANCH=params.BRANCH + env.REPO=params.REPO + } - stage('Allocate Node'){ - env.CICO_API_KEY = env.DUFFY_KEY - duffy_rtn=sh( - script: 'cico --debug node get -f value -c hostname -c comment', - returnStdout: true - ).trim().tokenize(' ') - env.DUFFY_NODE=duffy_rtn[0] - env.SSID=duffy_rtn[1] - env.BRANCH=params.BRANCH - env.REPO=params.REPO + try { + stage('Pre Setup Node'){ + // Install EPEL + onmyduffynode 'yum -y install epel-release git' } - try { - stage('Pre Setup Node'){ - // Install EPEL - onmyduffynode 'yum -y install epel-release git' - } - - stage('Notify PR'){ - notifyPagurePR("pagure", "Tests running ", "BUILDING", "STARTED") - } + stage('Notify PR'){ + notifyPagurePR("pagure", "Tests running ", "BUILDING", "STARTED") + } - stage('Clone Test Suite') { - onmyduffynode "GIT_TRACE=1 GIT_CURL_VERBOSE=1 git clone --single-branch --depth 1 https://pagure.io/pagure.git" - } + stage('Clone Test Suite') { + onmyduffynode "GIT_TRACE=1 GIT_CURL_VERBOSE=1 git clone --single-branch --depth 1 https://pagure.io/pagure.git" + } - stage('Run Test Suite') { - timeout(time: 6, unit: 'HOURS') { - onmyduffynode 'cd pagure && sh ./run_ci_tests_containers.sh' - } + stage('Run Test Suite') { + timeout(time: 6, unit: 'HOURS') { + onmyduffynode 'cd pagure && sh ./run_ci_tests_containers.sh' } + } - } catch (e) { - currentBuild.result = "FAILURE" - throw e - } finally { - - stage('Deallocate Node'){ - sh 'cico node done ${SSID}' - } + } catch (e) { + currentBuild.result = "FAILURE" + throw e + } finally { - stage('Notify PR'){ - res = currentBuild.currentResult - notifyPagurePR("pagure", "Build " + res + "! ", res, "FINALIZED") - } + stage('Deallocate Node'){ + sh 'cico node done ${SSID}' + } + stage('Notify PR'){ + res = currentBuild.currentResult + notifyPagurePR("pagure", "Build " + res + "! ", res, "FINALIZED") } + } -} +} \ No newline at end of file