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

-- 
You received this message because you are subscribed to the Google Groups 
"Jenkins Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/jenkinsci-users/8f20f1b2-8d89-443d-9378-dd2a0b655490%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to