Updated to clean and add git restore mtime

Modified the pipeline to build and push on the same stage
Added a catch error to stop the stage that has an issue but not the rest
This commit is contained in:
Ben 2023-01-29 22:42:53 +01:00
parent a883bb99f1
commit ef580e0e5d

@ -13,74 +13,69 @@ pipeline {
agent any
environment {
DOCKER_GIT_TAG="$AWS_ECR_URL/web3-proxy:${GIT_COMMIT.substring(0,8)}"
DOCKER_LATEST_TAG="$AWS_ECR_URL/web3-proxy:latest"
DOCKER_BUILDKIT=1
}
stages {
stage('build') {
stage('build and push') {
parallel {
stage('Build amd64 image') {
agent {label 'amd64_jenkins_agent'}
stage('Build and push amd64 image') {
agent {
label 'amd64_jenkins_agent'
}
steps {
script {
DOCKER_GIT_TAG_AMD="$DOCKER_GIT_TAG" + "_amd64"
restoreMTime()
amd_image = docker.build("$DOCKER_GIT_TAG_AMD")
}
}
}
stage('Build arm64 image') {
agent {label 'arm64_jenkins_agent'}
steps {
script {
DOCKER_GIT_TAG_ARM="$DOCKER_GIT_TAG" + "_arm64"
restoreMTime()
arm_image = docker.build("$DOCKER_GIT_TAG_ARM")
}
}
}
stage('Build intel image') {
agent {label 'intel_jenkins_agent'}
steps {
script {
DOCKER_GIT_TAG_INTEL="$DOCKER_GIT_TAG" + "_intel_sky_lake"
restoreMTime()
intel_image = docker.build("$DOCKER_GIT_TAG_INTEL")
}
}
}
}
}
stage('push') {
parallel {
stage('push amd64 image') {
agent {label 'amd64_jenkins_agent'}
steps {
script {
try {
amd_image = docker.build("$DOCKER_GIT_TAG_AMD")
} catch (e) {
def err = "amd64 build failed: ${e}"
error(err)
}
amd_image.push()
amd_image.push('latest_amd3')
}
}
}
stage('push arm64 image') {
agent {label 'arm64_jenkins_agent'}
stage('Build and push arm64 image') {
agent {
label 'arm64_jenkins_agent'
}
steps {
script {
DOCKER_GIT_TAG_ARM="$DOCKER_GIT_TAG" + "_arm64"
restoreMTime()
try {
arm_image = docker.build("$DOCKER_GIT_TAG_ARM")
} catch (e) {
def err = "arm64 build failed: ${e}"
error(err)
}
arm_image.push()
arm_image.push('latest_graviton2')
}
}
}
stage('push intel image') {
agent {label 'intel_jenkins_agent'}
stage('Build and push intel image') {
agent {
label 'intel_jenkins_agent'
}
steps {
script {
DOCKER_GIT_TAG_INTEL="$DOCKER_GIT_TAG" + "_intel_sky_lake"
restoreMTime()
try {
intel_image = docker.build("$DOCKER_GIT_TAG_INTEL")
} catch (e) {
def err = "intel_sky_lake build failed: ${e}"
error(err)
}
intel_image.push()
intel_image.push('latest')
}
}
}
}
}
}
}
}