| |
@@ -1,10 +1,10 @@
|
| |
- #!groovy
|
| |
-
|
| |
def git_refs = params.GIT_REFS
|
| |
def git_repo = params.GIT_REPO
|
| |
def chdir = params.CHDIR
|
| |
def image_name = params.IMAGE_NAME
|
| |
- def quay_secret_name = params.QUAY_SECRET_NAME
|
| |
+ def image_build_extra_args = params.IMAGE_BUILD_EXTRA_ARGS
|
| |
+ def image_push = params.IMAGE_PUSH
|
| |
+ def push_secret_name = params.PUSH_SECRET_NAME
|
| |
|
| |
def node_sh(cmd) {
|
| |
def key_path = '/duffy-ssh-key/ssh-privatekey'
|
| |
@@ -21,53 +21,68 @@
|
| |
}
|
| |
|
| |
node('cico-workspace') {
|
| |
- stage('cico') {
|
| |
- node = sh(script: "cico --debug node get -f value -c hostname -c comment", returnStdout: true).trim().tokenize(' ')
|
| |
- env.node_hostname = "${node[0]}.ci.centos.org"
|
| |
- env.node_ssid = "${node[1]}"
|
| |
+ try {
|
| |
+ stage('cico') {
|
| |
+ node = sh(script: "cico --debug node get --release 9-stream -f value -c hostname -c comment", returnStdout: true).trim().tokenize(' ')
|
| |
+ env.node_hostname = "${node[0]}.ci.centos.org"
|
| |
+ env.node_ssid = "${node[1]}"
|
| |
|
| |
- wrap([$class: 'MaskPasswordsBuildWrapper', varPasswordPairs: [[var: 'node_hostname', password: node_hostname]], varMaskRegexes: []]) {
|
| |
- node_sh 'cat /etc/centos-release'
|
| |
- }
|
| |
- }
|
| |
+ wrap([$class: 'MaskPasswordsBuildWrapper', varPasswordPairs: [[var: 'node_hostname', password: node_hostname]], varMaskRegexes: []]) {
|
| |
+ node_sh 'cat /etc/centos-release'
|
| |
+ }
|
| |
+ }
|
| |
|
| |
- stage('prepare') {
|
| |
- node_sh 'yum install -y podman'
|
| |
+ stage('prepare') {
|
| |
+ node_sh 'yum install -y make podman'
|
| |
|
| |
- withCredentials([file(credentialsId: quay_secret_name, variable: 'quay_secret_json')]) {
|
| |
- node_sh 'mkdir -p /.docker'
|
| |
+ if (image_push) {
|
| |
+ withCredentials([file(credentialsId: push_secret_name, variable: 'push_secret_json')]) {
|
| |
+ node_sh 'mkdir -p /.docker'
|
| |
|
| |
- dir("/tmp/${env.node_hostname}") {
|
| |
- writeFile file: 'config.json', text: readFile(quay_secret_json)
|
| |
- wrap([$class: 'MaskPasswordsBuildWrapper', varPasswordPairs: [[var: 'node_hostname', password: node_hostname]], varMaskRegexes: []]) {
|
| |
- sh "scp -o StrictHostKeyChecking=no -i /duffy-ssh-key/ssh-privatekey ./config.json root@${node_hostname}:/.docker"
|
| |
+ dir("/tmp/${env.node_hostname}") {
|
| |
+ writeFile file: 'config.json', text: readFile(push_secret_json)
|
| |
+ wrap([$class: 'MaskPasswordsBuildWrapper', varPasswordPairs: [[var: 'node_hostname', password: node_hostname]], varMaskRegexes: []]) {
|
| |
+ sh "scp -o StrictHostKeyChecking=no -i /duffy-ssh-key/ssh-privatekey ./config.json root@${node_hostname}:/.docker"
|
| |
+ }
|
| |
+ deleteDir()
|
| |
+ }
|
| |
}
|
| |
- deleteDir()
|
| |
}
|
| |
}
|
| |
- }
|
| |
|
| |
- stage('checkout') {
|
| |
- dir('koji-operator') {
|
| |
- git branch: git_refs, url: git_url
|
| |
+ stage('checkout') {
|
| |
+ dir('repository') {
|
| |
+ git branch: git_refs, url: git_url
|
| |
|
| |
- node_sh "mkdir -p /tmp/${chdir}"
|
| |
+ node_sh "mkdir -p /tmp/${chdir}"
|
| |
|
| |
- wrap([$class: 'MaskPasswordsBuildWrapper', varPasswordPairs: [[var: 'node_hostname', password: node_hostname]], varMaskRegexes: []]) {
|
| |
- sh "scp -o StrictHostKeyChecking=no -i /duffy-ssh-key/ssh-privatekey -r ${chdir}/* root@${node_hostname}:/tmp/${chdir}"
|
| |
+ wrap([$class: 'MaskPasswordsBuildWrapper', varPasswordPairs: [[var: 'node_hostname', password: node_hostname]], varMaskRegexes: []]) {
|
| |
+ sh "scp -o StrictHostKeyChecking=no -i /duffy-ssh-key/ssh-privatekey -r ${chdir}/* root@${node_hostname}:/tmp/${chdir}"
|
| |
+ }
|
| |
}
|
| |
}
|
| |
- }
|
| |
|
| |
- stage('build') {
|
| |
- node_sh "podman build -t ${image_name} -f /tmp/${chdir}/Dockerfile /tmp/${chdir}"
|
| |
- }
|
| |
+ stage('build') {
|
| |
+ node_sh "(cd /tmp/${chdir}; make image/build IMAGE=${image_name} ${image_build_extra_args};)"
|
| |
+ }
|
| |
|
| |
- stage('push') {
|
| |
- node_sh "podman push --authfile /.docker/config.json ${image_name}"
|
| |
+ stage('push') {
|
| |
+ if (image_push) {
|
| |
+ node_sh "podman push --authfile /.docker/config.json ${image_name}"
|
| |
+ }
|
| |
}
|
| |
|
| |
- stage('cleanup') {
|
| |
- sh "cico node done ${node_ssid}"
|
| |
+ stage('cleanup') {
|
| |
+ wrap([$class: 'MaskPasswordsBuildWrapper', varPasswordPairs: [[var: 'node_hostname', password: node_hostname]], varMaskRegexes: []]) {
|
| |
+ sh "cico -q node done ${node_ssid}"
|
| |
+ }
|
| |
+ }
|
| |
+
|
| |
+ } catch (Exception e) {
|
| |
+ stage('fail') {
|
| |
+ sh "cico node done ${node_ssid}"
|
| |
+ error '[ERROR] ' + e.toString()
|
| |
+ }
|
| |
}
|
| |
- }
|
| |
+ }
|
| |
+
|
| |
Adding re-usable "container image and push job" + resultsdb pagure ci job.