Skip to content

Commit

Permalink
ci: use new duffy command for CentOS CI
Browse files Browse the repository at this point in the history
The `cico` command is getting deprecated, and the new `duffy` command
should be used instead. The new command requires a `~/.config/duffy`
file that contains an API endpoint and credentials.

See-also: https://sigs.centos.org/guide/ci/#installing-and-configuring-duffy-client
Signed-off-by: Niels de Vos <ndevos@redhat.com>
  • Loading branch information
nixpanic authored and mergify[bot] committed Dec 12, 2022
1 parent 69329b5 commit 3880d64
Show file tree
Hide file tree
Showing 6 changed files with 132 additions and 36 deletions.
28 changes: 22 additions & 6 deletions commitlint.groovy
Original file line number Diff line number Diff line change
@@ -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}",
Expand All @@ -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}"
}
}

Expand All @@ -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}'
}
}
}
28 changes: 22 additions & 6 deletions containerized-tests.groovy
Original file line number Diff line number Diff line change
@@ -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'
Expand All @@ -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.
Expand Down Expand Up @@ -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}"
}
}

Expand Down Expand Up @@ -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}'
}
}
}
28 changes: 22 additions & 6 deletions k8s-e2e-external-storage.groovy
Original file line number Diff line number Diff line change
@@ -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'
Expand All @@ -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.
Expand Down Expand Up @@ -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}"
}
}

Expand Down Expand Up @@ -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) {
Expand Down
28 changes: 22 additions & 6 deletions mini-e2e-helm.groovy
Original file line number Diff line number Diff line change
@@ -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'
Expand All @@ -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.
Expand Down Expand Up @@ -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}"
}
}

Expand Down Expand Up @@ -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) {
Expand Down
28 changes: 22 additions & 6 deletions mini-e2e.groovy
Original file line number Diff line number Diff line change
@@ -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'
Expand All @@ -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.
Expand Down Expand Up @@ -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}"
}
}

Expand Down Expand Up @@ -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) {
Expand Down
28 changes: 22 additions & 6 deletions upgrade-tests.groovy
Original file line number Diff line number Diff line change
@@ -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'
Expand All @@ -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.
Expand Down Expand Up @@ -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}"
}
}

Expand Down Expand Up @@ -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) {
Expand Down

0 comments on commit 3880d64

Please sign in to comment.