I am running my slaves on Ubuntu AMI's, that have docker pre-installed. I am attempting to build a Docker Container on the slave from a DockerFile and push it to a ECR Repo.
I am getting confused because this fails, but I am not seeing why it failed.
node('cicd_ec2') {
try {
stage('Prepare Environment'){
// slackSend color: 'good', message: "Job: ${currentBuild.fullDisplayName} was started \n ${env.BUILD_URL}"
cleanWs()
checkout scm
}
stage('Docker build'){
docker.build('jenkins')
}
stage('Docker Push'){
docker.withDockerRegistry(credentialsId: 'ecr:us-east-1:jenkins_cicd', url: 'https://1account-number.dkr.ecr.us-east-1.amazonaws.com') {
docker.image('jenkins').push('latest')
}
}
}
catch (err) {
currentBuild.result = 'FAILURE'
// slackSend color: 'danger', message: "Job: ${currentBuild.fullDisplayName} Result Was *ERROR* \n ${env.BUILD_URL}"
}
finally {
if ( currentBuild.result == null || currentBuild.result == 'SUCCESS' ) {
// slackSend color: "good", message: "Job: ${currentBuild.fullDisplayName} Result Was *SUCCESS* \n ${env.BUILD_URL}"
}
else if( currentBuild.result == "FAILURE" ) {
slackSend color: "danger", message: "Job: ${currentBuild.fullDisplayName} Result Was *FAILURE* \n ${env.BUILD_URL}"
}
else if( currentBuild.result == "UNSTABLE" ) {
slackSend color: "warning", message: "Job: ${currentBuild.fullDisplayName} Result Was *UNSTABLE* \n ${env.BUILD_URL}"
}
else {
slackSend color: "danger", message: "Job: ${currentBuild.fullDisplayName} Result Was *UNCLEAR* \n ${env.BUILD_URL}"
}
}
}Logs Here: https://pastebin.com/PQXnerVC