diff --git a/commitlint.groovy b/commitlint.groovy index 02210cf70..ebf519854 100644 --- a/commitlint.groovy +++ b/commitlint.groovy @@ -1,10 +1,23 @@ def cico_retries = 16 def cico_retry_interval = 60 +def duffy_pool = 'virt-ec2-t2-centos-8s-x86_64' def ci_git_repo = 'https://github.com/ceph/ceph-csi' def ci_git_branch = 'ci/centos' def ref = "devel" def git_since = 'origin/devel' +def create_duffy_config() { + writeFile( + file: '/home/jenkins/.config/duffy', + text: """client: + | url: https://duffy.ci.centos.org/api/v1 + | auth: + | name: ceph-csi + | key: ${env.CICO_API_KEY} + |""".stripMargin() + ) +} + node('cico-workspace') { stage('checkout ci repository') { git url: "${ci_git_repo}", @@ -13,18 +26,21 @@ node('cico-workspace') { } stage('reserve bare-metal machine') { + create_duffy_config() + def firstAttempt = true retry(30) { if (!firstAttempt) { sleep(time: 5, unit: "MINUTES") } firstAttempt = false - cico = sh( - script: "cico node get -f value -c hostname -c comment --release=8-stream --retry-count=${cico_retries} --retry-interval=${cico_retry_interval}", + def cmd = sh( + script: "duffy client request-session pool=${duffy_pool},quantity=1", returnStdout: true - ).trim().tokenize(' ') - env.CICO_NODE = "${cico[0]}.ci.centos.org" - env.CICO_SSID = "${cico[1]}" + ) + def duffy = new groovy.json.JsonSlurper().parseText(cmd) + env.CICO_NODE = "${duffy.session.nodes[0].hostname}" + env.CICO_SSID = "${duffy.session.id}" } } @@ -47,7 +63,7 @@ node('cico-workspace') { finally { stage('return bare-metal machine') { - sh 'cico node done ${CICO_SSID}' + sh 'duffy client retire-session ${CICO_SSID}' } } } diff --git a/containerized-tests.groovy b/containerized-tests.groovy index f83877ca2..431212eb9 100644 --- a/containerized-tests.groovy +++ b/containerized-tests.groovy @@ -1,5 +1,6 @@ def cico_retries = 16 def cico_retry_interval = 60 +def duffy_pool = 'virt-ec2-t2-centos-8s-x86_64' def ci_git_repo = 'https://github.com/ceph/ceph-csi' def ci_git_branch = 'ci/centos' def git_repo = 'https://github.com/ceph/ceph-csi' @@ -21,6 +22,18 @@ def podman_login(registry, username, passwd) { ssh "podman login --authfile=~/.podman-auth.json --username='${username}' --password='${passwd}' ${registry}" } +def create_duffy_config() { + writeFile( + file: '/home/jenkins/.config/duffy', + text: """client: + | url: https://duffy.ci.centos.org/api/v1 + | auth: + | name: ceph-csi + | key: ${env.CICO_API_KEY} + |""".stripMargin() + ) +} + // podman_pull pulls image from the source (CI internal) registry, and tags it // as unqualified image name and into the destination registry. This prevents // pulling from the destination registry. @@ -64,18 +77,21 @@ node('cico-workspace') { } stage('reserve bare-metal machine') { + create_duffy_config() + def firstAttempt = true retry(30) { if (!firstAttempt) { sleep(time: 5, unit: "MINUTES") } firstAttempt = false - cico = sh( - script: "cico node get -f value -c hostname -c comment --release=8-stream --retry-count=${cico_retries} --retry-interval=${cico_retry_interval}", + def cmd = sh( + script: "duffy client request-session pool=${duffy_pool},quantity=1", returnStdout: true - ).trim().tokenize(' ') - env.CICO_NODE = "${cico[0]}.ci.centos.org" - env.CICO_SSID = "${cico[1]}" + ) + def duffy = new groovy.json.JsonSlurper().parseText(cmd) + env.CICO_NODE = "${duffy.session.nodes[0].hostname}" + env.CICO_SSID = "${duffy.session.id}" } } @@ -165,7 +181,7 @@ node('cico-workspace') { finally { stage('return bare-metal machine') { - sh 'cico node done ${CICO_SSID}' + sh 'duffy client retire-session ${CICO_SSID}' } } } diff --git a/k8s-e2e-external-storage.groovy b/k8s-e2e-external-storage.groovy index 1b6ca8d2c..76d1645fa 100644 --- a/k8s-e2e-external-storage.groovy +++ b/k8s-e2e-external-storage.groovy @@ -1,5 +1,6 @@ def cico_retries = 16 def cico_retry_interval = 60 +def duffy_pool = 'virt-ec2-t2-centos-8s-x86_64' def ci_git_repo = 'https://github.com/ceph/ceph-csi' def ci_git_branch = 'ci/centos' def git_repo = 'https://github.com/ceph/ceph-csi' @@ -20,6 +21,18 @@ def podman_login(registry, username, passwd) { ssh "podman login --authfile=~/.podman-auth.json --username='${username}' --password='${passwd}' ${registry}" } +def create_duffy_config() { + writeFile( + file: '/home/jenkins/.config/duffy', + text: """client: + | url: https://duffy.ci.centos.org/api/v1 + | auth: + | name: ceph-csi + | key: ${env.CICO_API_KEY} + |""".stripMargin() + ) +} + // podman_pull pulls image from the source (CI internal) registry, and tags it // as unqualified image name and into the destination registry. This prevents // pulling from the destination registry. @@ -89,18 +102,21 @@ node('cico-workspace') { } stage('reserve bare-metal machine') { + create_duffy_config() + def firstAttempt = true retry(30) { if (!firstAttempt) { sleep(time: 5, unit: "MINUTES") } firstAttempt = false - cico = sh( - script: "cico node get -f value -c hostname -c comment --release=8-stream --retry-count=${cico_retries} --retry-interval=${cico_retry_interval}", + def cmd = sh( + script: "duffy client request-session pool=${duffy_pool},quantity=1", returnStdout: true - ).trim().tokenize(' ') - env.CICO_NODE = "${cico[0]}.ci.centos.org" - env.CICO_SSID = "${cico[1]}" + ) + def duffy = new groovy.json.JsonSlurper().parseText(cmd) + env.CICO_NODE = "${duffy.session.nodes[0].hostname}" + env.CICO_SSID = "${duffy.session.id}" } } @@ -192,7 +208,7 @@ node('cico-workspace') { finally { stage('return bare-metal machine') { - sh 'cico node done ${CICO_SSID}' + sh 'duffy client retire-session ${CICO_SSID}' } if (failure) { diff --git a/mini-e2e-helm.groovy b/mini-e2e-helm.groovy index 1a8183c3e..8d680616d 100644 --- a/mini-e2e-helm.groovy +++ b/mini-e2e-helm.groovy @@ -1,5 +1,6 @@ def cico_retries = 16 def cico_retry_interval = 60 +def duffy_pool = 'virt-ec2-t2-centos-8s-x86_64' def ci_git_repo = 'https://github.com/ceph/ceph-csi' def ci_git_branch = 'ci/centos' def git_repo = 'https://github.com/ceph/ceph-csi' @@ -22,6 +23,18 @@ def podman_login(registry, username, passwd) { ssh "podman login --authfile=~/.podman-auth.json --username='${username}' --password='${passwd}' ${registry}" } +def create_duffy_config() { + writeFile( + file: '/home/jenkins/.config/duffy', + text: """client: + | url: https://duffy.ci.centos.org/api/v1 + | auth: + | name: ceph-csi + | key: ${env.CICO_API_KEY} + |""".stripMargin() + ) +} + // podman_pull pulls image from the source (CI internal) registry, and tags it // as unqualified image name and into the destination registry. This prevents // pulling from the destination registry. @@ -91,18 +104,21 @@ node('cico-workspace') { } stage('reserve bare-metal machine') { + create_duffy_config() + def firstAttempt = true retry(30) { if (!firstAttempt) { sleep(time: 5, unit: "MINUTES") } firstAttempt = false - cico = sh( - script: "cico node get -f value -c hostname -c comment --release=8-stream --retry-count=${cico_retries} --retry-interval=${cico_retry_interval}", + def cmd = sh( + script: "duffy client request-session pool=${duffy_pool},quantity=1", returnStdout: true - ).trim().tokenize(' ') - env.CICO_NODE = "${cico[0]}.ci.centos.org" - env.CICO_SSID = "${cico[1]}" + ) + def duffy = new groovy.json.JsonSlurper().parseText(cmd) + env.CICO_NODE = "${duffy.session.nodes[0].hostname}" + env.CICO_SSID = "${duffy.session.id}" } } @@ -203,7 +219,7 @@ node('cico-workspace') { finally { stage('return bare-metal machine') { - sh 'cico node done ${CICO_SSID}' + sh 'duffy client retire-session ${CICO_SSID}' } if (failure) { diff --git a/mini-e2e.groovy b/mini-e2e.groovy index 80ce72247..3ab46f6c6 100644 --- a/mini-e2e.groovy +++ b/mini-e2e.groovy @@ -1,5 +1,6 @@ def cico_retries = 16 def cico_retry_interval = 60 +def duffy_pool = 'virt-ec2-t2-centos-8s-x86_64' def ci_git_repo = 'https://github.com/ceph/ceph-csi' def ci_git_branch = 'ci/centos' def git_repo = 'https://github.com/ceph/ceph-csi' @@ -19,6 +20,18 @@ def podman_login(registry, username, passwd) { ssh "podman login --authfile=~/.podman-auth.json --username='${username}' --password='${passwd}' ${registry}" } +def create_duffy_config() { + writeFile( + file: '/home/jenkins/.config/duffy', + text: """client: + | url: https://duffy.ci.centos.org/api/v1 + | auth: + | name: ceph-csi + | key: ${env.CICO_API_KEY} + |""".stripMargin() + ) +} + // podman_pull pulls image from the source (CI internal) registry, and tags it // as unqualified image name and into the destination registry. This prevents // pulling from the destination registry. @@ -88,18 +101,21 @@ node('cico-workspace') { } stage('reserve bare-metal machine') { + create_duffy_config() + def firstAttempt = true retry(30) { if (!firstAttempt) { sleep(time: 5, unit: "MINUTES") } firstAttempt = false - cico = sh( - script: "cico node get -f value -c hostname -c comment --release=8-stream --retry-count=${cico_retries} --retry-interval=${cico_retry_interval}", + def cmd = sh( + script: "duffy client request-session pool=${duffy_pool},quantity=1", returnStdout: true - ).trim().tokenize(' ') - env.CICO_NODE = "${cico[0]}.ci.centos.org" - env.CICO_SSID = "${cico[1]}" + ) + def duffy = new groovy.json.JsonSlurper().parseText(cmd) + env.CICO_NODE = "${duffy.session.nodes[0].hostname}" + env.CICO_SSID = "${duffy.session.id}" } } @@ -184,7 +200,7 @@ node('cico-workspace') { finally { stage('return bare-metal machine') { - sh 'cico node done ${CICO_SSID}' + sh 'duffy client retire-session ${CICO_SSID}' } if (failure) { diff --git a/upgrade-tests.groovy b/upgrade-tests.groovy index f3a5b82f0..1ac72bbd3 100644 --- a/upgrade-tests.groovy +++ b/upgrade-tests.groovy @@ -1,5 +1,6 @@ def cico_retries = 16 def cico_retry_interval = 60 +def duffy_pool = 'virt-ec2-t2-centos-8s-x86_64' def ci_git_repo = 'https://github.com/ceph/ceph-csi' def ci_git_branch = 'ci/centos' def git_repo = 'https://github.com/ceph/ceph-csi' @@ -19,6 +20,18 @@ def podman_login(registry, username, passwd) { ssh "podman login --authfile=~/.podman-auth.json --username='${username}' --password='${passwd}' ${registry}" } +def create_duffy_config() { + writeFile( + file: '/home/jenkins/.config/duffy', + text: """client: + | url: https://duffy.ci.centos.org/api/v1 + | auth: + | name: ceph-csi + | key: ${env.CICO_API_KEY} + |""".stripMargin() + ) +} + // podman_pull pulls image from the source (CI internal) registry, and tags it // as unqualified image name and into the destination registry. This prevents // pulling from the destination registry. @@ -88,18 +101,21 @@ node('cico-workspace') { } stage('reserve bare-metal machine') { + create_duffy_config() + def firstAttempt = true retry(30) { if (!firstAttempt) { sleep(time: 5, unit: "MINUTES") } firstAttempt = false - cico = sh( - script: "cico node get -f value -c hostname -c comment --release=8-stream --retry-count=${cico_retries} --retry-interval=${cico_retry_interval}", + def cmd = sh( + script: "duffy client request-session pool=${duffy_pool},quantity=1", returnStdout: true - ).trim().tokenize(' ') - env.CICO_NODE = "${cico[0]}.ci.centos.org" - env.CICO_SSID = "${cico[1]}" + ) + def duffy = new groovy.json.JsonSlurper().parseText(cmd) + env.CICO_NODE = "${duffy.session.nodes[0].hostname}" + env.CICO_SSID = "${duffy.session.id}" } } @@ -188,7 +204,7 @@ node('cico-workspace') { finally { stage('return bare-metal machine') { - sh 'cico node done ${CICO_SSID}' + sh 'duffy client retire-session ${CICO_SSID}' } if (failure) {