Shippable / support

Shippable SaaS customers can report issues and feature requests in this repository
101 stars 28 forks source link

Push to Ecr failing #2945

Closed t-botz closed 8 years ago

t-botz commented 8 years ago

I'm trying to use shippable to build and push a custom image to ecr. I have configured ecr integration and my script is the following

language: none

build:
  pre_ci:
    - docker build -t baserustcredstashdocker:latest .
  pre_ci_boot:
    image_name: baserustcredstashdocker
    image_tag: latest
    pull: false
  push:
    - docker commit $SHIPPABLE_CONTAINER_NAME XXXXXX.dkr.ecr.ap-southeast-2.amazonaws.com/rust_credstash_aws:latest
    - docker push XXXXXX.dkr.ecr.ap-southeast-2.amazonaws.com/rust_credstash_aws:latest

integrations:
  hub:
    - integrationName: ECR
      type: ecr
      region: ap-southeast-2

My script fail with this message 'ECR get-login failed\n\n'usage: aws [options] <command> <subcommand> [parameters]'

Link to the build : https://app.shippable.com/runs/57ce6c6aa100830e005f564a/1/console

t-botz commented 8 years ago

Looking at the full issue log it seems that the aws cli version is an old one when ecr wasn't there.

echo 'Configuring aws cli with ECR integration credentials'
Configuring aws cli with ECR integration credentials

echo 'Successfully configured aws cli credentials'
Successfully configured aws cli credentials

echo -e 'ECR get-login failed\n\n'usage: aws [options] <command> <subcommand> [parameters]
aws: error: argument command: Invalid choice, valid choices are:

autoscaling                              | cloudformation                          
cloudfront                               | cloudsearch                             
cloudsearchdomain                        | cloudtrail                              
cloudwatch                               | cognito-identity                        
cognito-sync                             | datapipeline                            
directconnect                            | dynamodb                                
ec2                                      | elasticache                             
elasticbeanstalk                         | elastictranscoder                       
elb                                      | emr                                     
iam                                      | importexport                            
kinesis                                  | logs                                    
opsworks                                 | rds                                     
redshift                                 | route53                                 
route53domains                           | sdb                                     
ses                                      | sns                                     
sqs                                      | storagegateway                          
sts                                      | support                                 
swf                                      | s3api                                   
s3                                       | configure                               
help                                    
/root/87e7370b-a829-41d3-b458-6e1a0d08c70d.sh: eval: line 58: syntax error near unexpected token `<'
/root/87e7370b-a829-41d3-b458-6e1a0d08c70d.sh: eval: line 58: `echo -e 'ECR get-login failed\n\n'usage: aws [options] <command> <subcommand> [parameters]'
manishas commented 8 years ago

@rageshkrishna can we look into this?

t-botz commented 8 years ago

This is critical. If I can't push, I can't use your tool. The fact that you are not reactive to, what looks to me, a critical bug is very concerning to my company. Especially when the solution looks straight forward...

rageshkrishna commented 8 years ago

@thibaultdelor I'm very sorry about the delay in getting back to you.

It looks like your build is running on a docker image that you yourself are building in the build_pre_ci. The subsequent ecr_login step that is failing is being executed inside your image. You will need to ensure that the image contains an up-to-date version of the aws-cli package to make this work.

Let me know if you need any more help with this.

rageshkrishna commented 8 years ago

@thibaultdelor We actually do have a way to do the ECR login and push from outside of the build container. This way you will not need the awscli in your build image at all. The details are at http://docs.shippable.com/integrations/imageRegistries/ecr/, but if you just add agent_only: true to your integration like so:

  integrations:
    hub:
      - integrationName: ECR
        type: ecr
        region: ap-southeast-2
        agent_only: true

Then we will not even attempt to do an ecr login from inside the build container. Your docker push is already placed in the push section of your YML which means the actual push steps will be running outside of your container. Adding agent_only should get your push working without any changes to your image.

t-botz commented 8 years ago

Awesome! That's what I was looking for. I'll try that I was actually wondering why the ecr get-login would be executed in my image...

On Mon, Sep 12, 2016 at 3:34 PM, Ragesh Krishna notifications@github.com wrote:

@thibaultdelor https://github.com/thibaultdelor We actually do have a way to do the ECR login and push from outside of the build container. This way you will not need the awscli in your build image at all. The details are at http://docs.shippable.com/integrations/imageRegistries/ecr/, but if you just add agent_only: true to your integration like so:

integrations: hub:

  • integrationName: ECR type: ecr region: ap-southeast-2 agent_only: true

Then we will not even attempt to do an ecr login from inside the build container. Your docker push is already placed in the push section of your YML which means the actual push steps will be running outside of your container. Adding agent_only should get your push working without any changes to your image.

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/Shippable/support/issues/2945#issuecomment-246253778, or mute the thread https://github.com/notifications/unsubscribe-auth/AAqWJZKwPh6K81TiRb5OqcJOjnpzctKgks5qpOSBgaJpZM4J2dyt .

t-botz commented 8 years ago

I have actually managed to do it in a different way. I was actually confused of what was running outside and inside the container. Thank you for your help