Mrono / step-elastic-beanstalk-deploy

11 stars 16 forks source link

Deployment fail #3

Closed joaom182 closed 8 months ago

joaom182 commented 9 years ago

Hello,

A few time ago this step works perfectly, but now is throwing the following errors

Pushing to AWS eb servers.
remote: processing .............ote: error: Encountered corrupt pack file: Git command exited with status code 128: error: unable to find cf6805c003ffa7b3b9ff1e97d502c4d847df82e2ote: fatal: object of unexpected typeote: 
remote: 
To https://AKIAJFCDPL6KDAVBYVWQ:20150322T142300Z7ec2680c49140f4c893a236969dee8f3eb9ad09a5850215c072f4e1174c17217@git.elasticbeanstalk.sa-east-1.amazonaws.com/v1/repos/73717569642d617069/commitid/38633339653363313463393830383465316465376466613637306333656630656233643339363463/environment/73717569642d6170692d656e76
 ! [remote rejected] HEAD -> master (hook declined)
error: failed to push some refs to 'https://AKIAJFCDPL6KDAVBYVWQ:20150322T142300Z7ec2680c49140f4c893a236969dee8f3eb9ad09a5850215c072f4e1174c17217@git.elasticbeanstalk.sa-east-1.amazonaws.com/v1/repos/73717569642d617069/commitid/38633339653363313463393830383465316465376466613637306333656630656233643339363463/environment/73717569642d6170692d656e76'
failed: Unable to push to Amazon Elastic Beanstalk

Any idea?

Mrono commented 9 years ago

Interesting, I haven't seen any issues like this. Have you tried pushing to another environment? Have you tried pushing manually through git aws.push from your local machine?

joaom182 commented 9 years ago

I will try this..

joaom182 commented 9 years ago

Using git aws.push localy works fine... using eb deploy works too..

joaom182 commented 9 years ago

After is run git aws.push wercker step throw another error

Checking if eb exists and can connect.
Warning. File "config" has incorrect access permission and can be accessed by other users.
The current branch "(no" is not associated with an Elastic Beanstalk environment. Call "eb branch" to set up a new environment for this branch. 
Proceeding with default settings.
URL     : squid-api-env.elasticbeanstalk.com
Status      : Ready
Health      : Green
Pushing to AWS eb servers.
/pipeline/build/.git/AWSDevTools/aws/dev_tools.rb:105:in `signed_uri': Unable to find AWS Secret Key. Please run git aws.config to add it. (RuntimeError)
    from .git/AWSDevTools/aws.elasticbeanstalk.push:86:in `<main>'
failed: Unable to push to Amazon Elastic Beanstalk
Mrono commented 9 years ago

If you set 'debug' to true (in the step settings in wercker.xml) then it will dump the contents of the config file out to the deployment log. Can you turn that on and post the full contents of the EB deployment step (obfuscating sensitive data of course)?

joaom182 commented 9 years ago

wercker.xml or wercker.yml?

Mrono commented 9 years ago

wercker.yml, sorry. Same place as app_name: My Application

joaom182 commented 9 years ago

The result after I put debug: true

cd $WERCKER_SOURCE_DIR
$ export WERCKER_STEP_ROOT="/wercker/steps/mrono/elastic-beanstalk-deploy/1.0.0"
$ export WERCKER_STEP_ID="9aec9b9d-cdfa-451c-b7cf-dc50f1cdf262"
$ export WERCKER_STEP_NAME="elastic-beanstalk-deploy"
$ export WERCKER_REPORT_NUMBERS_FILE="$WERCKER_REPORT_DIR/$WERCKER_STEP_ID/numbers.ini"
$ export WERCKER_REPORT_MESSAGE_FILE="$WERCKER_REPORT_DIR/$WERCKER_STEP_ID/message.txt"
$ export WERCKER_REPORT_ARTIFACTS_DIR="$WERCKER_REPORT_DIR/$WERCKER_STEP_ID/artifacts"
$ mkdir -p $WERCKER_REPORT_ARTIFACTS_DIR
$ export WERCKER_STEP_TEMP="/tmp/$WERCKER_STEP_ID"
$ source '/wercker/wercker-build-essentials/init.sh'
$ mkdir -p $WERCKER_STEP_TEMP
$ export WERCKER_ELASTIC_BEANSTALK_DEPLOY_KEY="$AMAZON_KEY"
$ export WERCKER_ELASTIC_BEANSTALK_DEPLOY_SECRET="$AMAZON_SECRET_KEY"
$ export WERCKER_ELASTIC_BEANSTALK_DEPLOY_APP_NAME="$AMAZON_APP_NAME"
$ export WERCKER_ELASTIC_BEANSTALK_DEPLOY_ENV_NAME="$AMAZON_ENV_NAME"
$ export WERCKER_ELASTIC_BEANSTALK_DEPLOY_REGION="sa-east-1"
$ export WERCKER_ELASTIC_BEANSTALK_DEPLOY_DEBUG="true"
$ source "$WERCKER_STEP_ROOT/run.sh"
Debug mode turned on, this can dump potentially dangerous information to log files.
Change back to the source dir.
Setting up credentials.
Dumping Credential file.
AWSAccessKeyId= <MY KEY ID>
AWSSecretKey= <MY SECRET KEY>
Setting up config file.
Dumping config file.
[global]
ApplicationName=squid-api
DevToolsEndpoint=git.elasticbeanstalk.sa-east-1.amazonaws.com
EnvironmentName=squid-api-env
Region=sa-east-1
AwsCredentialFile=c:/Users/joao.mainka\.elasticbeanstalk\aws_credential_file
[global]
ApplicationName=squid-api
DevToolsEndpoint=git.elasticbeanstalk.sa-east-1.amazonaws.com
Region=sa-east-1
ServiceEndpoint=https://elasticbeanstalk.sa-east-1.amazonaws.com
AwsCredentialFile=/home/ubuntu/.elasticbeanstalk/aws_credential_file
EnvironmentName=squid-api-env
[branches]
dev=squid-api-env
[branch:dev]
ApplicationVersionName=dev
EnvironmentName=squid-api-env
InstanceProfileName=aws-elasticbeanstalk-ec2-role
Checking if eb exists and can connect.
Warning. File "config" has incorrect access permission and can be accessed by other users.
The current branch "(no" is not associated with an Elastic Beanstalk environment. Call "eb branch" to set up a new environment for this branch. 
Proceeding with default settings.
URL     : squid-api-env.elasticbeanstalk.com
Status      : Ready
Health      : Green
Pushing to AWS eb servers.
/pipeline/build/.git/AWSDevTools/aws/dev_tools.rb:105:in `signed_uri': Unable to find AWS Secret Key. Please run git aws.config to add it. (RuntimeError)
    from .git/AWSDevTools/aws.elasticbeanstalk.push:86:in `<main>'
failed: Unable to push to Amazon Elastic Beanstalk

I suspect this line is incorrect

AwsCredentialFile=c:/Users/joao.mainka\.elasticbeanstalk\aws_credential_file

The credentials file must be at project folder?

Mrono commented 9 years ago

@joaom182 I suspect the config file exists in your repo already, that is how that line is making it into the config. Does the file .elasticbeanstalk/config exist in your committed repo file (it should be ignored by git)

joaom182 commented 9 years ago

I removed the folder .elasticbeanstalk of source control. And now is back the initial error, see the log.

cd $WERCKER_SOURCE_DIR
$ export WERCKER_STEP_ROOT="/wercker/steps/mrono/elastic-beanstalk-deploy/1.0.0"
$ export WERCKER_STEP_ID="ca536f0c-3577-4b13-900d-92f3e554dc7c"
$ export WERCKER_STEP_NAME="elastic-beanstalk-deploy"
$ export WERCKER_REPORT_NUMBERS_FILE="$WERCKER_REPORT_DIR/$WERCKER_STEP_ID/numbers.ini"
$ export WERCKER_REPORT_MESSAGE_FILE="$WERCKER_REPORT_DIR/$WERCKER_STEP_ID/message.txt"
$ export WERCKER_REPORT_ARTIFACTS_DIR="$WERCKER_REPORT_DIR/$WERCKER_STEP_ID/artifacts"
$ mkdir -p $WERCKER_REPORT_ARTIFACTS_DIR
$ export WERCKER_STEP_TEMP="/tmp/$WERCKER_STEP_ID"
$ source '/wercker/wercker-build-essentials/init.sh'
$ mkdir -p $WERCKER_STEP_TEMP
$ export WERCKER_ELASTIC_BEANSTALK_DEPLOY_KEY="$AMAZON_KEY"
$ export WERCKER_ELASTIC_BEANSTALK_DEPLOY_SECRET="$AMAZON_SECRET_KEY"
$ export WERCKER_ELASTIC_BEANSTALK_DEPLOY_APP_NAME="$AMAZON_APP_NAME"
$ export WERCKER_ELASTIC_BEANSTALK_DEPLOY_ENV_NAME="$AMAZON_ENV_NAME"
$ export WERCKER_ELASTIC_BEANSTALK_DEPLOY_REGION="sa-east-1"
$ export WERCKER_ELASTIC_BEANSTALK_DEPLOY_DEBUG="true"
$ source "$WERCKER_STEP_ROOT/run.sh"
Debug mode turned on, this can dump potentially dangerous information to log files.
Change back to the source dir.
Setting up credentials.
Dumping Credential file.
AWSAccessKeyId=****
AWSSecretKey=*****
Setting up config file.
Dumping config file.
[global]
ApplicationName=squid-api
DevToolsEndpoint=git.elasticbeanstalk.sa-east-1.amazonaws.com
Region=sa-east-1
ServiceEndpoint=https://elasticbeanstalk.sa-east-1.amazonaws.com
AwsCredentialFile=/home/ubuntu/.elasticbeanstalk/aws_credential_file
EnvironmentName=squid-api-env
[branches]
dev=squid-api-env
[branch:dev]
ApplicationVersionName=dev
EnvironmentName=squid-api-env
InstanceProfileName=aws-elasticbeanstalk-ec2-role
Checking if eb exists and can connect.
Warning. File "config" has incorrect access permission and can be accessed by other users.
The current branch "(no" is not associated with an Elastic Beanstalk environment. Call "eb branch" to set up a new environment for this branch. 
Proceeding with default settings.
URL     : squid-api-env.elasticbeanstalk.com
Status      : Ready
Health      : Green
Pushing to AWS eb servers.
remote: processing .................................ote: error: Encountered corrupt pack file: Git command exited with status code 128: error: unable to find 42cbe3c57c843848bbc883dc0875943cc49ba172ote: fatal: object of unexpected typeote: 
remote: 
To https://AKIAJFCDPL6KDAVBYVWQ:20150408T171129Zc71997fed087f0462ed1794691c4d2fcd3fc25e0afc03fd4bfedf2c1ba3d5bf7@git.elasticbeanstalk.sa-east-1.amazonaws.com/v1/repos/73717569642d617069/commitid/31383565393364323766313634326663396361396132346530376430343661643136353637616537/environment/73717569642d6170692d656e76
 ! [remote rejected] HEAD -> master (hook declined)
error: failed to push some refs to 'https://AKIAJFCDPL6KDAVBYVWQ:20150408T171129Zc71997fed087f0462ed1794691c4d2fcd3fc25e0afc03fd4bfedf2c1ba3d5bf7@git.elasticbeanstalk.sa-east-1.amazonaws.com/v1/repos/73717569642d617069/commitid/31383565393364323766313634326663396361396132346530376430343661643136353637616537/environment/73717569642d6170692d656e76'
failed: Unable to push to Amazon Elastic Beanstalk

At

Encountered corrupt pack file: Git command exited with status code 128: error: unable to find 42cbe3c57c843848bbc883dc0875943cc49ba172ote: fatal: object of unexpected typeote:
Mrono commented 9 years ago

@joaom182 Does the same wercker app work with another EB app?

joaom182 commented 9 years ago

I've tried deleting and creating a new application in ElasticBeanstalk, but did not work.

Mrono commented 9 years ago

@joaom182 Aside from looking at the specific repository, wercker app, and EB instance myself I am not sure where to go from here as I am unable to duplicate this issue. Please let me know if you are interested.

joaom182 commented 9 years ago

I'm currently doing the deploy manually, but it's a shame we can not identify the problem. I think the problem is in the repository.

I researched about the error 'Encountered corrupt pack file', but I'm not sure if this is a problem of git or deployment script.

Mrono commented 9 years ago

What version of the EB cli are you running locally, since you said it worked there

joaom182 commented 9 years ago

EB CLI 3.2.2 (Python 2.7.9)

Mrono commented 9 years ago

Hmm, the deployment step is running 2.6.0. Do you mind running the aws.push using that version to see if it duplicates the issue on your machine? It's located at https://aws.amazon.com/code/6752709412171743

I recommend copying the repo folder and removing the .elasticbeanstalk folder