ci: move ci-job-validation to duffy API

It seems all jobs were converted to the new `duffy` command, except
ci-job-validation which still used the old `cico` command.

Signed-off-by: Niels de Vos <ndevos@redhat.com>
This commit is contained in:
Niels de Vos 2023-01-13 10:14:14 +01:00 committed by mergify[bot]
parent 3880d642b9
commit b557fc82bd
2 changed files with 24 additions and 7 deletions

View File

@ -28,7 +28,8 @@ following files:
and configuration to request a bare-metal machine
1. checkout the `centos/ci` branch of the repository, which contains scripts
for provisioning and preparing the environment for running tests
1. reserve a bare-metal machine with `cico` (configured on the Jenkins Slave)
1. reserve a bare-metal machine with `duffy` (configured on the Jenkins
Slave)
1. provision the reserved bare-metal machine with additional tools and
dependencies to run the test (see `prepare.sh` below)
1. run `make containerized-tests` and `make containerized-build` in parallel

View File

@ -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.
@ -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}"
}
}
@ -113,7 +129,7 @@ node('cico-workspace') {
finally {
stage('return bare-metal machine') {
sh 'cico node done ${CICO_SSID}'
sh 'duffy client retire-session ${CICO_SSID}'
}
}
}