String cron_string = BRANCH_NAME == "master" ? "@daily" : "" pipeline { agent { docker { image 'quay.io/buildah/stable' args '--privileged=true' } } options { parallelsAlwaysFailFast() } triggers { cron(cron_string) } environment { PROJECT = 'nvim' IMAGE_NAME = "docker.io/chn2guevara/$PROJECT" } stages { stage('Prepare') { steps { sh 'dnf install git -y' script { env.TAG_NAME = sh( returnStdout: true, script: 'git name-rev --name-only --tags HEAD | sed \'s/^undefined$//\'').trim() } } } stage('Manifest') { steps { sh "buildah manifest create $PROJECT" } } stage('Build') { parallel { stage('arm64/v8 stable') { steps { sh""" buildah build --pull --platform linux/arm64/v8 --network host \ --tag $IMAGE_NAME:stable --build-arg NEOVIM_VERSION=stable \ --manifest $PROJECT . """ } } stage('amd64 stable') { steps { sh""" buildah build --pull --platform linux/amd64 --network host \ --tag $IMAGE_NAME:stable --build-arg NEOVIM_VERSION=stable \ --manifest $PROJECT . """ } } stage('arm64/v8 nightly') { steps { sh""" buildah build --pull --platform linux/arm64/v8 --network host \ --tag $IMAGE_NAME:nightly --build-arg NEOVIM_VERSION=nightly \ --manifest $PROJECT . """ } } stage('amd64 nightly') { steps { sh""" buildah build --pull --platform linux/amd64 --network host \ --tag $IMAGE_NAME:nightly --build-arg NEOVIM_VERSION=nightly \ --manifest $PROJECT . """ } } } } stage('docker.io login') { when { branch 'master' } steps { withCredentials([string( credentialsId: 'dockerhub-personal', variable: 'CREDENTIALS') ]) { sh '''#!/bin/bash IFS=" " read -r username password <<<"$CREDENTIALS" buildah login \ --username "$username" \ --password-stdin <<< "$password" docker.io ''' } } } stage('Push') { when { branch 'master' } parallel { stage('stable') { steps { sh "buildah manifest push --all $PROJECT docker://$IMAGE_NAME:stable" } } stage('nightly') { steps { sh "buildah manifest push --all $PROJECT docker://$IMAGE_NAME:nightly" } } } } } }