Friday, 1 May 2020

Jenkins Declarative Pipeline code for push Docker images to AMAZON ECR |...

2 comments:

  1. hai bro, i am your subscriber for a long time.. you are doing really wonderful job for us as a DevOps beginner.) I have one small doubt in this video. pushing the docker images to ECR.. for my scenario i am using docker-compose.yml.. i have attached the pipeline script and jenkins job output also... one thing I need know. the question is HOW TO ASSIGN A ('$IMAGE') VARIABLE IN DOCKER COMPOSE LINE? that thing only pending pls help me out..

    here is my script:::

    pipeline {
    agent any
    environment
    {
    VERSION = "${BUILD_NUMBER}"
    PROJECT = 'pluginforec'
    IMAGE = "$PROJECT:$VERSION"
    ECURL = 'https://924136698074.dkr.ecr.us-east-2.amazonaws.com/testautopush'
    ECRCRED = 'ecr:us-east-2:924136698074'
    }
    stages{
    stage('GetSCM') {
    steps {
    git 'https://github.com/charliezadeng/Otherpluginsjuly17.git'
    }
    }
    stage('Image Build'){
    steps{
    script{

    bat """
    docker-compose up --build -d
    """
    }
    }
    }
    stage('Push Image'){
    steps{
    script{
    docker.withRegistry(ECURL, ECRCRED){
    docker.image(IMAGE).push()
    }
    }
    }
    }
    }
    }


    this is my output.
    Successfully built ab5b24b7f9eb
    Successfully tagged auto_pipeline_service:latest
    auto_pipeline_service_1 is up-to-date
    [Pipeline] }
    [Pipeline] // script
    [Pipeline] }
    [Pipeline] // stage
    [Pipeline] stage
    [Pipeline] { (Push Image)
    [Pipeline] script
    [Pipeline] {
    [Pipeline] withEnv
    [Pipeline] {
    [Pipeline] withDockerRegistry (hide)
    $ docker login -u AWS -p ******** https://924136698074.dkr.ecr.us-east-2.amazonaws.com/testautopush
    WARNING! Using --password via the CLI is insecure. Use --password-stdin.
    Login Succeeded
    [Pipeline] {
    [Pipeline] isUnix
    [Pipeline] bat

    C:\Program Files (x86)\Jenkins\workspace\auto_pipeline>docker tag pluginforec:32 924136698074.dkr.ecr.us-east-2.amazonaws.com/pluginforec:32
    Error response from daemon: No such image: pluginforec:32

    ReplyDelete
  2. Las Vegas Hotel and Casino - JT Marriott Resort & Casino
    Search the best 김천 출장안마 hotel deals on 성남 출장마사지 JT Marriott 인천광역 출장안마 Resort & Casino in Las Vegas starting at $104 per night. Save up to 60% 정읍 출장마사지 off with our Hot Rate deals 울산광역 출장마사지 when booking a last

    ReplyDelete