Blame container-build/linux8/Jenkinsfile

Brian Stinson fb04cd
arches = ['amd64', 'arm64v8', 'ppc64le'] as Set
Brian Stinson fb04cd
imagepushorg = 'quay.io/centos'
Brian Stinson fb04cd
manifestpushrepo = 'quay.io/centos/centos'
Brian Stinson fb04cd
imagetags = ['8', '8.3.2011', 'centos8', 'latest'] as Set
Brian Stinson fb04cd
Brian Stinson fb04cd
node('aws'){
Brian Stinson fb04cd
    for (arch in arches) {
Brian Stinson fb04cd
        stage("push-$arch") {
Brian Stinson fb04cd
            for (tag in imagetags) {
Brian Stinson fb04cd
                withEnv(['TAG='+tag, 'ARCH='+arch, 'IMAGEPUSHORG='+imagepushorg]){
Brian Stinson fb04cd
                    withCredentials([usernamePassword(credentialsId: 'QUAY_PUSH', passwordVariable: 'QUAY_PUSH_PASS', usernameVariable: 'QUAY_PUSH_USERNAME')]){
Brian Stinson fb04cd
                        sh '''sudo skopeo login -u=${QUAY_PUSH_USERNAME} -p ${QUAY_PUSH_PASS} quay.io'''
Brian Stinson fb04cd
                        sh '''sudo skopeo copy --format v2s2 docker://docker.io/${ARCH}/centos:${TAG} docker://${IMAGEPUSHORG}/${ARCH}:${TAG}'''
Brian Stinson fb04cd
                    }
Brian Stinson fb04cd
                }
Brian Stinson fb04cd
            }
Brian Stinson fb04cd
        }
Brian Stinson fb04cd
    }
Brian Stinson fb04cd
Brian Stinson fb04cd
    stage('Create Manifests'){
Brian Stinson fb04cd
        for (tag in imagetags) {
Brian Stinson fb04cd
            withEnv(['MANIFESTPUSHREPO='+manifestpushrepo, 'TAG='+tag, 'IMAGEPUSHORG='+imagepushorg]){
Brian Stinson fb04cd
                withCredentials([usernamePassword(credentialsId: 'QUAY_PUSH', passwordVariable: 'QUAY_PUSH_PASS', usernameVariable: 'QUAY_PUSH_USERNAME')]){
Brian Stinson fb04cd
                    sh '''sudo podman login -u=${QUAY_PUSH_USERNAME} -p ${QUAY_PUSH_PASS} quay.io'''
Brian Stinson fb04cd
                    try{
Brian Stinson fb04cd
                        sh '''sudo podman rmi ${MANIFESTPUSHREPO}:${TAG}'''
Brian Stinson fb04cd
                    } catch (err) {
Brian Stinson fb04cd
                    }
Brian Stinson fb04cd
                    sh '''sudo podman manifest create ${MANIFESTPUSHREPO}:${TAG}'''
Brian Stinson fb04cd
                }
Brian Stinson fb04cd
            }
Brian Stinson fb04cd
        }
Brian Stinson fb04cd
    }
Brian Stinson fb04cd
    stage('Annotate Manifests'){
Brian Stinson fb04cd
        for (tag in imagetags) {
Brian Stinson fb04cd
            for (arch in arches) {
Brian Stinson fb04cd
                withEnv(['MANIFESTPUSHREPO='+manifestpushrepo, 'TAG='+tag, 'ARCH='+arch, 'IMAGEPUSHORG='+imagepushorg]){
Brian Stinson fb04cd
                    sh '''sudo podman manifest add ${MANIFESTPUSHREPO}:${TAG} docker://${IMAGEPUSHORG}/${ARCH}:${TAG}'''
Brian Stinson fb04cd
                }
Brian Stinson fb04cd
            }
Brian Stinson fb04cd
        }
Brian Stinson fb04cd
    }
Brian Stinson fb04cd
    stage('Push Manifests'){
Brian Stinson fb04cd
        for (tag in imagetags) {
Brian Stinson fb04cd
            withEnv(['MANIFESTPUSHREPO='+manifestpushrepo, 'TAG='+tag]){
Brian Stinson fb04cd
                sh '''sudo podman manifest push -f v2s2 --purge --all ${MANIFESTPUSHREPO}:${TAG} docker://${MANIFESTPUSHREPO}:${TAG}'''
Brian Stinson fb04cd
            }
Brian Stinson fb04cd
        }
Brian Stinson fb04cd
    }
Brian Stinson fb04cd
}
Brian Stinson fb04cd