Coder Social home page Coder Social logo

beanstalk-deploy's People

Contributors

capaj avatar davecarlson avatar dyatko avatar gzur avatar ibrasho avatar keevie avatar micaeljarniac avatar n-hebert avatar noahshuart avatar phamtriduy avatar weddleben avatar yahyabmx avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar

beanstalk-deploy's Issues

Feature Request: Output if deployed existing version

I think it'd be useful to know if we created a new application version or if this action used a version that already existed.

In my case, I have a deployment pipeline that also increments the version. It'd be useful to use the same pipeline to redeploy old versions, but not increment the version if this action didn't deploy any new artifacts.

[feature] possibility to use custom s3 bucket name

You guys don't mind if I implement this?

Faced with a situation when I'm migrating the project to GithubActions, and our s3 bucket where we upload zip-files exists already. I want to use the same bucket, but so far, this is not possible

How to deploy to different ELB environments based on code pushed to branch

@einaregilsson My concern is how can I deploy my application to different environments on the AWS Beanstalk based on which branch the code is being pushed.

For example - I have two environment prod and staging having respective branches master and staging. I want to trigger the CI/CD procedure whenever the code is pushed to these branches.

The only thing that needs to be taken care of is that when code pushed to staging branch the application should be deployed to staging environment and if pushed to master branch the build for prod environment should be triggered.

Travis CI has the same thing like below:

deploy:
  - provider: elasticbeanstalk
    access_key_id: $AWS_ACCESS_KEY
    secret_access_key: $AWS_SECRET_KEY
    region: "ap-south-1"
    app: "my-app"
    env: "my-app-staging"
    bucket_name: "<s3_bucket_name>"
    on:
      branch: staging

  - provider: elasticbeanstalk
    access_key_id: $AWS_ACCESS_KEY
    secret_access_key: $AWS_SECRET_KEY
    region: "ap-south-1"
    app: "my-app"
    env: "my-app-production"
    bucket_name: "<s3_bucket_name>"
    on:
      branch: master

So, how can I implement the same thing in github action using your action?

Failed even with Green health

Deploy the app fails with this message:

Deployment failed: Error: Deployment failed! Current State: Version: test2, Health: Green, Health Status: Info

Is it a problem with the action or with my EBS?

Failed deployments due to throttling

I've been getting intermittent failed deployments, apparently due to the API requests being throttled. The output is:

Created new application version d00348b in Beanstalk.
Starting deployment of version d00348b to environment ***
Deployment started...

03:05:18 INFO: Environment update is starting.
##[error]Deployment failed: Error: Status: 400. Code: Throttling, Message: Rate exceeded
##[error]Node run failed with exit code 2

Has anybody else come across this issue or have any suggestions on how to rectify it?

Sometimes occurs even when doing the first deployment of the day.

deployBeanstalkVersion throttled

Hey again, thanks again for this action.

I ran into a throttling issue when deploying multiple environments on the deploy step. I'm guessing it has to do with deployBeanstalkVersion being throttled. Was wondering if we could add similar retry-logic as exists in the check environment health call.

Image: https://kceb.d.pr/hFd4dC

Use of `aws_session_token`

I'm trying to use a temporary access token with:

  uses: einaregilsson/beanstalk-deploy@v17
  with:
      aws_access_key: ${{ secrets.AWS_ACCESS_KEY_ID }}
      aws_secret_key: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
      aws_session_token: ${{ github.event.inputs.session_token }}

But I get:

Error: Deployment failed: Error: Status: 403. Code: InvalidClientTokenId, Message: The security token included in the request is invalid.

I also printed out ${{ github.event.inputs.session_token }} just to be sure the string is correctly managed by GitHub runner.
With eb cli I can access of course.

Any idea?
Thank you.

Get AWS EB Env after deploying

Can we get the env of the env that we deployed the file ? or use an argument to get the env something like this:

      with:
        aws_access_key: ${{ secrets.AWS_ACCESS_KEY_ID }}
        aws_secret_key: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
        application_name: MyApplicationName
        environment_name: MyApplication-Environment
        version_label: 12345
        region: us-west-2
        deployment_package: deploy.zip
        deployment_env: true

The purpose is to get the CNAM from the Env and do an integration test based on it.

Thank you.

Deployment failed: Error: ENOENT: no such file or directory

Running this GitHub action always throws an error for me saying that my deployment package does not exist:

Screenshot 2020-07-16 16 31 06

I've confirmed that the file exists using ls -l right before running the deployment step:

Screenshot 2020-07-16 16 32 15

My workflow file looks like this:

name: Test & Deploy Packages
on:
  push:
    branches: [master]

jobs:
  changes:
    runs-on: ubuntu-latest
    # Set job outputs to values from filter step
    outputs:
      apiServer: ${{ steps.filter.outputs.apiServer }}
    steps:
    - name: Checkout source code
      uses: actions/checkout@v2

    - name: Check for changes
      uses: dorny/[email protected]
      id: filter
      with:
        filters: '.github/filters.yml'

  api_server:
    runs-on: ubuntu-latest
    needs: changes
    defaults:
      run:
        working-directory: packages/api-server

    if: ${{ needs.changes.outputs.apiServer == 'true' }}
    steps:
    - name: Checkout source code
      uses: actions/checkout@v1

    - name: Use Node.js 12.x
      uses: actions/setup-node@v1
      with:
        node-version: "12.x"

    - name: Install dependencies
      run: yarn

    - name: Tests
      run: yarn test

    - name: Generate deployment package
      run: zip -r api-server-deploy.zip . -x "node_modules/*"

    - name: List files
      run: ls -l

    - name: Deploy to Elastic Beanstalk
      uses: einaregilsson/beanstalk-deploy@v10
      with:
        aws_access_key: ${{ secrets.AWS_ACCESS_KEY_ID }}
        aws_secret_key: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
        application_name: tilt-api-server
        environment_name: alpha
        version_label: 12345
        region: ap-south-1
        deployment_package: api-server-deploy.zip

I'm unable to determine the cause for this. Would be great if someone can take a look at it to see if this is a bug with this GitHub action! Thanks.

Error: Status 307, Message:

When I try to deploy my nodejs application to ELB I'm getting this error but i cannot recognize what's my mistake.

image

My yml file

name: CD Testing ELB

on:
  push:
    branches:
      - master

jobs:
  build:
    runs-on: ubuntu-latest
    strategy:
      matrix:
        node-version: [10.x]

    steps:
      - uses: actions/checkout@v1

      - name: Setup NodeJS ${{ matrix.node-version }}
        uses: actions/setup-node@v1
        with:
          node-version: ${{ matrix.node-version }}

      - name: Install Packages
        run: npm install --production

      - name: Generate Deployment Pacakge
        run: zip -r deploy.zip * -x "**node_modules"

      - name: Get Timestamp
        uses: gerred/actions/current-time@master
        id: current-time

      - name: Run string replace
        uses: frabert/replace-string-action@master
        id: format-time
        with:
          pattern: '[:\.]+'
          string: "${{ steps.current-time.outputs.time }}"
          replace-with: "-"
          flags: "g"

      - name: Deploy on Beanstalk
        uses: einaregilsson/beanstalk-deploy@v9
        with:
          aws_access_key: ${{secrets.AWS_ACCESS_KEY}}
          aws_secret_key: ${{secrets.AWS_SECRET_KEY}}
          application_name: carrinho-digital-web-api
          environment_name: CarrinhoDigitalWebApi-env
          region: us-east-2
          version_label: "carrinho-digital-web-api-${{ steps.format-time.outputs.replaced }}"
          deployment_package: deploy.zip
          use_existing_version_if_available: true

Deployment failed: TypeError [ERR_INVALID_ARG_TYPE]: The "data" argument must be one of type string, Buffer, TypedArray, or DataView. Received type undefined

Hey @einaregilsson
I have an Angular application which needs to be deployed to Elastic Beanstalk using GitHub Actions. I'm following this guideline to deploy by application to ELB.

I'm getting an error:

No filename given, deploying existing version 1
[error]Deployment failed: TypeError [ERR_INVALID_ARG_TYPE]: The "data" argument must be one of type string, Buffer, TypedArray, or DataView. Received type undefined
[error]Node run failed with exit code 2

Here is the screenshot of Actions on GitHub:
image

I've also opened the question on stack overflow here

No Application named 'aws-backend'

Run einaregilsson/beanstalk-deploy@v13
Beanstalk-Deploy: GitHub Action for deploying to Elastic Beanstalk.
https://github.com/einaregilsson/beanstalk-deploy

 ***** Input parameters were: ***** 
         Application: aws-backend
         Environment: Awsbackend-env
       Version Label: b2c9b111300de097271b341ec7fa63fbdbff4f16
 Version description: 
          AWS Region: us-east-1
                File: data-0.0.1-SNAPSHOT.jar
      AWS Access Key: 20 characters long, starts with A
      AWS Secret Key: 40 characters long, starts with 3
 Wait for deployment: true
  Recovery wait time: 30

Uploading file to bucket elasticbeanstalk-us-east-1-002446295643
New build successfully uploaded to S3, bucket=elasticbeanstalk-us-east-1-002446295643, key=/aws-backend/b2c9b111300de097271b341ec7fa63fbdbff4f16.zip
Error: Deployment failed: Error: Status: 400. Code: InvalidParameterValue, Message: No Application named 'aws-backend' found.

invalid-not-found

env-naming

Issues deploying from GitHub Actions (Locally works fine)

Just wondering if anyone has an idea on where the issue lies with this, I've tried to replicate this locally, but only have an issue with the beanstalk-deploy script running in GitHub. I am still unsure if the issues lies with Beanstalk, Github, or this Action.

Here are the logs from the failed deployment, I made all the sensitive information X.

From Beanstalk, the error is this, it always expects the old version. Locally running beanstalk-deploy from CLI, it works just fine, though.

Incorrect application version "X-1607792162" (deployment 29). Expected version "X-1607790305" (deployment 27).

Action logs:

Beanstalk-Deploy: GitHub Action for deploying to Elastic Beanstalk.
https://github.com/einaregilsson/beanstalk-deploy

 ***** Input parameters were: ***** 
         Application: X
         Environment: X-env
       Version Label: X-1607789180
 Version description: 
          AWS Region: us-east-2
                File: /home/runner/work/core/core/backend/X/build.zip
      AWS Access Key: 20 characters long, starts with X
      AWS Secret Key: 40 characters long, starts with X
 Wait for deployment: true
  Recovery wait time: 30

Uploading file to bucket elasticbeanstalk-us-east-2-606767603402
New build successfully uploaded to S3, bucket=elasticbeanstalk-us-east-2-606767603402, key=/X/X-1607789180.zip
Created new application version X-1607789180 in Beanstalk.
Starting deployment of version X-1607789180 to environment X-env
Deployment started, "wait_for_deployment" was true...

16:07:20 INFO: Environment update is starting.
16:07:25 INFO: Deploying new version to instance(s).
16:07:28 INFO: Deleted log fragments for this environment.
16:07:29 INFO: Instance deployment found a runtime-dependent .NET Core application in your source bundle.
16:07:31 ERROR: Instance deployment failed. For details, see 'eb-engine.log'.
16:07:35 ERROR: [Instance: i-X] Command failed on instance. Return code: 1 Output: Engine execution has encountered an error..
16:07:35 INFO: Command execution completed on all instances. Summary: [Successful: 0, Failed: 1].
16:07:36 ERROR: Unsuccessful command execution on instance id(s) 'i-X'. Aborting the operation.
16:07:36 ERROR: Failed to deploy application.
16:07:36 ERROR: During an aborted deployment, some instances may have deployed the new application version. To ensure all instances are running the same version, re-deploy the appropriate application version.
16:07:42 ERROR: Deployment failed! Current State: Version: X-1607561434, Health: Yellow, Health Status: Warning

every step must define a uses or run key

Hey there
Thank you for this plugin. I've tried taking it and commiting it to my repo, adding the AWS secrets etc but github refuses to run it. The error is

every step must define a uses or run key

image

I have literally the same file as in the documented sample except for lines 23 to 25 where I made some obvious string literal changes to suit my env - the version_label is hardcoded to 1

        application_name: MyApplicationName
        environment_name: MyApplication-Environment
        version_label: 12345

Any suggestions?

Deployment failed: Error: Status: 403. Message: Node run failed with exit code 2

I'm having troubles getting beanstalk-deploy to work inside my GitHub Actions, keep getting 403 error.

Run einaregilsson/beanstalk-deploy@v1
  with:
    aws_access_key: ABC123
    aws_secret_key: XYZ789
    application_name: our-beanstalk-app
    environment_name: our-beanstalk-app-env
    region: ca-central-1
    version_label: 8
    deployment_package: deploy.zip
  env:
    CI: true
    AWS_ACCESS_KEY_ID: ABC123
    AWS_SECRET_ACCESS_KEY: XYZ789
Uploading file to bucket elasticbeanstalk-ca-central-1-302080953439
##[error]Deployment failed: Error: Status: 403. Message: 
##[error]Node run failed with exit code 2

I installed the package locally and able to successfully run it from the command line:

AWS_ACCESS_KEY_ID=ABC123 AWS_SECRET_ACCESS_KEY=XYZ789 beanstalk-deploy our-beanstalk-app our-beanstalk-app-env 8 ca-central-1 deploy.zip

Any ideas why it's working from the command line but not via GitHub Actions?

use_existing_version_if_available not detecting existing version

Config

      - name: Deploy to EB
        uses: einaregilsson/beanstalk-deploy@v16
        with:
          aws_access_key: ${{ secrets.STAGING_AWS_ACCESS_KEY_ID }}
          aws_secret_key: ${{ secrets.STAGING_AWS_SECRET_ACCESS_KEY }}
          application_name: 'Cloud Backup'
          environment_name: st-tb-cb-webapp-v3
          version_label: rewind-app-${{github.SHA}}
          version_description: Commit ${{github.SHA}} deployed by github actions
          region: us-east-1
          deployment_package: deploy.zip
          use_existing_version_if_available: true
          wait_for_deployment: true
          wait_for_environment_recovery: 60

When running 2 deploys from the same job, i'm getting

Deployment failed: Error: Version rewind-app-07b8f5987797bb85fc36d8219679bb081cda158b already exists in S3!

I thought this was due to a previous failure but to test this I just put 2 deploys one after the other one. The first one works, but the second fails with the S3 error.

image

I'm wondering if it has something to do with the space in the EB Application name OR that the app name is prepended to the source? This is what shows for app versions - I can see that 07b8f5987797bb85fc36d8219679bb081cda158b is clearly there.

image

IS_GITHUB_ACTION not being set in GitHub Actions

Hi!

This action seems like a great idea! I'm trying to set up my workflow to upload my web application as a zip through GitHub Actions: https://github.com/JackMcKew/docker-react. Please find my relevant Github action logs at: https://github.com/JackMcKew/docker-react/actions.

Although, I've spent hours and no matter the combination of inputs, the action always errors out on https://github.com/einaregilsson/beanstalk-deploy/blob/master/beanstalk-deploy.js#L261 and prints accordingly. From further tracing, this conditional only runs if IS_GITHUB_ACTION is false, which is set by: https://github.com/einaregilsson/beanstalk-deploy/blob/master/beanstalk-deploy.js#L7.

I'm unsure as to why it isn't detecting that it is running as a GitHub action.

Use uploaded file in S3 if it does exist

I'm getting this after trying to rebuild the github's workflow

##[error]Deployment failed: Error: Version ${ APP_NAME  }-${ github.sha } already exists in S3!

Which is normal because the build failed but the package is uploaded the S3 bucket. So is there something to not throw an error but instead of it to use the existing package from the bucket ?

I'm using version 10 (einaregilsson/beanstalk-deploy@v10)

          AWS Region: ${ AWS_REGION }
          File: ${ APP_NAME }-${ github.sha }.zip
          AWS Access Key: 20 characters long, starts with X
          AWS Secret Key: 40 characters long, starts with X
          Wait for deployment: true
          Recovery wait time: 30

Thank you 👍

Beanstalk application unresponsive after deploy a spring boot app (zipped jar)

Basically, after zipping the jar the zip file is sent to deploy to BE, this was working at some point but now after the deploy starts and the command giving a successful response the environment starts and then is on an unresponsive state, not even the bad gateway error.

I already check all the logs from BE and I could not find a root cause any ideas?

Here are the steps I been using

    - name: Generate deployment package
      run: zip  -j app-0.0.1-SNAPSHOT.jar.zip app-0.0.1-SNAPSHOT.jar

    - name: Deploy to EB
      uses: einaregilsson/beanstalk-deploy@v16
      with:
        aws_access_key: ${{ secrets.AWS_ACCESS_KEY_ID }}
        aws_secret_key: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
        application_name: app
        environment_name: dev-api
        region: us-east-1
        version_label: ${{ steps.vars.outputs.sha_short }}
        deployment_package: app-0.0.1-SNAPSHOT.jar

Additional special characters in version_description causing 403 error

I'm getting a 403 error when deploying my application.
The problem seems to be my application version string 0.0.0-dev+440e3f0 which uses the + character to add commit hash metadata to the version number (as permitted by the semver spec)

This looks to be the same issue as #28 (and in particular @einaregilsson's fix mentioned here addresses some special characters, but not +).

Would it be possible to add + to the list of allowed (and escaped) characters?

Re-running failed deployments

I've run today into a case similar to #19, where the deployment failed because I'd just changed the environment configuration, but re-running the job subsequently wouldn't work because that version label already existed. I know I can change the current version manually, but not everyone with commit access to this repo has access to the AWS, so they should be able to re-run the jobs and have it work.

Since this is something not everyone might want, it'd be better to have it as a flag.

Deployments fail if application name has a space in it

If my Elastic Beanstalk application has a space in its name, e.g. "Application Name", and I attempt to run your script then I get the following errors:

Deployment failed: TypeError [ERR_UNESCAPED_CHARACTERS]: Request path contains unescaped characters

Do you reckon you can fix that?

##[error]Deployment failed: Error: Status: 403. Message:

im runing a single container with dockerrun.aws.json

Hello guys in receiving that error when i use a new version label
with:
aws_access_key: ${{ secrets.AWS_ACCESS_KEY_ID }}
aws_secret_key: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
application_name: vennly-player:develop
environment_name: vennly-player-develop-env
version_label: v1
region: us-east-2
deployment_package: deploy.zip

if i remove deployment_package property and use the running version as version label it works

but i need to run a new dockerrun.aws.json with an updated image name which is inside the zip file.

image

Any Ideas?

Environment status not just Green

I wonder if its worth adding an option to specify acceptable environment "states" (colours).

This is useful to be able to deploy to a scaled-down environment. For example; in a staging environment that gets automatically shutdown overnight I would want to deploy the code before any instances have been scaled up. This saves time on deploying new code to such environments, especially when an immutable deployment policy is used. In such a scenario the environment would never get to be green and so the deployment would "fail" but of course it hasn't actually failed at all. Using wait_for_deployment doesnt help because it just fires and forgets.

##[error]Deployment failed: Error: Status: 307

I got a redirect status when uploading file to bucket.

Beanstalk-Deploy: GitHub Action for deploying to Elastic Beanstalk.
https://github.com/einaregilsson/beanstalk-deploy

 ***** Input parameters were: ***** 
         Application: myappname
         Environment: myappname-dev
       Version Label: 85cd20103466b8c87f2bc16c3183351648fe838d
 Version description: 
          AWS Region: us-west-2
                File: deploy.zip
      AWS Access Key: 20 characters long, starts with B
      AWS Secret Key: 40 characters long, starts with x
 Wait for deployment: true
  Recovery wait time: 30

Uploading file to bucket elasticbeanstalk-us-west-2-160185919304
##[error]Deployment failed: Error: Status: 307. Message: 

Probably because I created the app few hours ago (https://aws.amazon.com/premiumsupport/knowledge-center/s3-http-307-response/).

Sounds fine to me that Action handle the redirect, WDYT?

feature: Add support for a AWS China Region API service

Hi, @einaregilsson !

Thanks for creating this tool to create Elastic beanstalk deployments.

I'd like to request a feature that allows the consumer to modify the awsApiRequest function options so that we can modify the host. For global regions this works fine as shown below:

host = options.host || `${service}.${region}.amazonaws.com`,

However in China, regions like cn-north-1 and cn-northwest-1 regions have their API endpoints pointing to ${service}.${region}.amazonaws.com.cn (Note the .cn TLD)

Since I needed this on a project for work, I was wondering if there's a way to be able to implement this on your library. I'll be happy to open a PR.

Deployment url

I've been experimenting with GitHub Environments and it'd be great if this Action returned the deployment url as an output.

This way I can set the GitHub Environment's url so all I have to do is click the environment name in GitHub to view the website.

Option to use existing version if present, otherwise upload deployment-package

From the readme:

You can also use the action to deploy an existing version. To do this simply omit the deployment-package input parameter. The action will then assume that the version you pass in throught version_label already exists in Beanstalk and attempt to deploy that.

I am interested in a solution to the situation where the desired behavior is to:

  1. use the already deployed version if it exists
  2. otherwise, create the version from deployment-package

Basically, ignore deployment-package if the version already exists on s3.

This would address the following error that occurs if you deploy to multiple environments as demonstrated in #5 (comment):

Deployment failed: Error: Version XXXX already exists in S3!

In our case, XXXX is the source commit hash, so we don't have to worry about version being ambiguous.

If i want to deploy using docker with this action what should i make changes in here,Is this action will support docker?

name: Your app name

on:
push:
branches:
- master

jobs:
build:
runs-on: ubuntu-latest
strategy:
matrix:
node-version: [10.x]

steps:
- uses: actions/checkout@v1

- name: Cache node modules
  uses: actions/cache@v1
  with:
    path: ~/.npm
    key: ${{ runner.os }}-node-${{ hashFiles('**/package-lock.json') }}
    restore-keys: |
      ${{ runner.os }}-node-

- name: Node ${{ matrix.node-version }}
  uses: actions/setup-node@v1
  with:
    node-version: ${{ matrix.node-version }}

- name: Installing NPM
  run: npm install

- name: Building application

run: npm run build

- name: Generate deployment package
  run: zip -r deploy.zip * -x "**node_modules**"

- name: Get timestamp
  uses: gerred/actions/current-time@master
  id: current-time

- name: Run string replace
  uses: frabert/replace-string-action@master
  id: format-time
  with:
    pattern: '[:\.]+'
    string: "${{ steps.current-time.outputs.time }}"
    replace-with: '-'
    flags: 'g'
- name: docker build
  run: sudo docker build -f Dockerfile .
- name: Beanstalk Deploy for app
  uses: einaregilsson/beanstalk-deploy@v9
  with:
    aws_access_key: ${{secrets.AWS_ACCESS_KEY}}
    aws_secret_key: ${{secrets.AWS_SECRET_KEY}}
    application_name: node-js-for-ebs
    environment_name: node-js-for-ebs-dev
    region: us-west-2
    version_label: "my-app-${{ steps.format-time.outputs.replaced }}"
    deployment_package: deploy.zip

- name: Deployed!
  run: echo App deployed to ELB

Cannot read property 'DescribeApplicationVersionsResult' of undefined

I have the following error Cannot read property 'DescribeApplicationVersionsResult' of undefined.
I checked the code and it seems that it breaks at beanstalk-deploy.js:243.

I tried with aws elasticbeanstalk describe-application-versions --application-name {my-app} and I have a successful response, so, it seems that the bug is related to beanstalk-deploy.

Deployment failed: Error: Status: 403. Code: SignatureDoesNotMatch

When deploying with a multi-lined description, it always raises a 403 error like:

Beanstalk-Deploy: GitHub Action for deploying to Elastic Beanstalk.
https://github.com/einaregilsson/beanstalk-deploy

 ***** Input parameters were: ***** 
         Application: xxx
         Environment: xxx-develop
       Version Label: xxx-20201217-114430
 Version description: Feature/marketing (#55)

* fix FacebookCreative columns

* [AD-190] ad on/off

* [AD-191] PUT /ads/{id}
          AWS Region: ap-northeast-2
                File: xxx.zip
      AWS Access Key: 20 characters long, starts with A
      AWS Secret Key: 40 characters long, starts with z
 Wait for deployment: true
  Recovery wait time: 30

Uploading file to bucket elasticbeanstalk-ap-northeast-2-xxx
New build successfully uploaded to S3, bucket=elasticbeanstalk-ap-northeast-2-xxx, key=/xxx/xxx-20201217-114430.zip
Error: Deployment failed: Error: Status: 403. Code: SignatureDoesNotMatch, Message: The request signature we calculated does not match the signature you provided. Check your AWS Secret Access Key and signing method. Consult the service documentation for details.

It is because our team merges PR by squashing commits as shown:

 Version description: Feature/marketing (#55)

* fix FacebookCreative columns

* [AD-190] ad on/off

* [AD-191] PUT /ads/{id}

Of course, we can modify the merge message when deploying the app by deleting an auto-generated message, and I'm not sure the action or Beanstalk itself causes the error.

Deploying to beanstalk error: command hooks failed

I am seeing this error in the Elastic Beanstalk logs:

2019-11-17 21:27:22,941 [ERROR] Command hooks (HooksExecutor.exe appdeploy\enact) failed
2019-11-17 21:27:22,941 [ERROR] Error encountered during build of Hook-EnactAppDeploy: Command hooks failed
Traceback (most recent call last):
File "cfnbootstrap\construction.pyc", line 544, in run_config
File "cfnbootstrap\construction.pyc", line 138, in run_commands
File "cfnbootstrap\command_tool.pyc", line 117, in apply
ToolError: Command hooks failed
2019-11-17 21:27:22,941 [ERROR] -----------------------BUILD FAILED!------------------------
2019-11-17 21:27:22,941 [ERROR] Unhandled exception during build: Command hooks failed
Traceback (most recent call last):
File "cfn-init", line 171, in
File "cfnbootstrap\construction.pyc", line 129, in build
File "cfnbootstrap\construction.pyc", line 530, in build
File "cfnbootstrap\construction.pyc", line 544, in run_config
File "cfnbootstrap\construction.pyc", line 138, in run_commands
File "cfnbootstrap\command_tool.pyc", line 117, in apply
ToolError: Command hooks failed

I am honestly lost as to why it is not working for me. Here is the deploy job in my yml:

   - name: Deploy to EB
      uses: einaregilsson/beanstalk-deploy@v3
      with:
        aws_access_key: ${{ secrets.AWS_ACCESS_KEY_ID }}
        aws_secret_key: ${{ secrets.AWS_SECRET_ACCESS_KEY_ID }}
        application_name: BudgeIt
        environment_name: dev-budgeit
        version_label: 11202013717
        region: us-east-1
        deployment_package: deployment.zip

License for repository.

Hi @einaregilsson ,

Are you planning to add license to this repository? I am planning on using/contributing to this package so just thought licensing makes things much easier.

Regards,
Bhautik

Deployment fails on merge only

Deployment is failing on merge commit.

Deployment settings:

      - name: Deploy to EB
        uses: einaregilsson/beanstalk-deploy@v11
        with:
          aws_access_key: ${{ secrets.AWS_ACCESS_KEY_ID }}
          aws_secret_key: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
          application_name: <removed>
          environment_name: production
          region: ${{ secrets.AWS_DEFAULT_REGION }}
          version_label: ${{ github.sha }}
          version_description:  ${{ github.event.head_commit.message }}
          deployment_package: deploy.zip
          use_existing_version_if_available: true

Error:

Deployment failed: Error: Status: 403. Code: SignatureDoesNotMatch, Message: The request signature we calculated does not match the signature you provided. Check your AWS Secret Access Key and signing method. Consult the service documentation for details.

There is really no issue with access keys or secret as it works perfectly when I commit directly into the branch. It only fails when I merge my dev branch to the master branch.

Logs (partial):

2020-09-22T16:54:00.2446915Z BUILD SUCCESSFUL in 57s
2020-09-22T16:54:00.2447630Z 3 actionable tasks: 3 executed
2020-09-22T16:54:00.5847453Z ##[group]Run cp build/libs/*.jar serverapp.jar & zip -r deploy.zip serverapp.jar Procfile .ebextensions
2020-09-22T16:54:00.5848566Z �[36;1mcp build/libs/*.jar serverapp.jar & zip -r deploy.zip serverapp.jar Procfile .ebextensions�[0m
2020-09-22T16:54:00.5890258Z shell: /bin/bash -e {0}
2020-09-22T16:54:00.5890553Z env:
2020-09-22T16:54:00.5890961Z   JAVA_HOME_8.0.265_x64: /opt/hostedtoolcache/jdk/8.0.265/x64
2020-09-22T16:54:00.5891488Z   JAVA_HOME: /opt/hostedtoolcache/jdk/8.0.265/x64
2020-09-22T16:54:00.5892010Z   JAVA_HOME_8_0_265_X64: /opt/hostedtoolcache/jdk/8.0.265/x64
2020-09-22T16:54:00.5892427Z ##[endgroup]
2020-09-22T16:54:03.9697737Z   adding: serverapp.jar (deflated 10%)
2020-09-22T16:54:03.9698838Z   adding: Procfile (stored 0%)
2020-09-22T16:54:03.9699720Z   adding: .ebextensions/ (stored 0%)
2020-09-22T16:54:03.9700347Z   adding: .ebextensions/options.config (deflated 17%)
2020-09-22T16:54:03.9825004Z ##[group]Run einaregilsson/beanstalk-deploy@v11
2020-09-22T16:54:03.9825502Z with:
2020-09-22T16:54:03.9826586Z   aws_access_key: ***
2020-09-22T16:54:03.9827400Z   aws_secret_key: ***
2020-09-22T16:54:03.9827766Z   application_name: XXX
2020-09-22T16:54:03.9828207Z   environment_name: production
2020-09-22T16:54:03.9828633Z   region: ***
2020-09-22T16:54:03.9829152Z   version_label: bf1ba7ee459838a32b453680880b2f31242d9fd2
2020-09-22T16:54:03.9829887Z   version_description: Merge remote-tracking branch 'origin/master'
2020-09-22T16:54:03.9830475Z   deployment_package: deploy.zip
2020-09-22T16:54:03.9830934Z   use_existing_version_if_available: true
2020-09-22T16:54:03.9831289Z env:
2020-09-22T16:54:03.9831682Z   JAVA_HOME_8.0.265_x64: /opt/hostedtoolcache/jdk/8.0.265/x64
2020-09-22T16:54:03.9832206Z   JAVA_HOME: /opt/hostedtoolcache/jdk/8.0.265/x64
2020-09-22T16:54:03.9832722Z   JAVA_HOME_8_0_265_X64: /opt/hostedtoolcache/jdk/8.0.265/x64
2020-09-22T16:54:03.9833215Z ##[endgroup]
2020-09-22T16:54:04.0357856Z Beanstalk-Deploy: GitHub Action for deploying to Elastic Beanstalk.
2020-09-22T16:54:04.0361263Z https://github.com/einaregilsson/beanstalk-deploy
2020-09-22T16:54:04.0362107Z 
2020-09-22T16:54:04.0362690Z  ***** Input parameters were: ***** 
2020-09-22T16:54:04.0363485Z          Application: XXX
2020-09-22T16:54:04.0364126Z          Environment: production
2020-09-22T16:54:04.0365026Z        Version Label: bf1ba7ee459838a32b453680880b2f31242d9fd2
2020-09-22T16:54:04.0366400Z  Version description: Merge remote-tracking branch 'origin/master'
2020-09-22T16:54:04.0367655Z           AWS Region: ***
2020-09-22T16:54:04.0368299Z                 File: deploy.zip
2020-09-22T16:54:04.0368978Z       AWS Access Key: 20 characters long, starts with A
2020-09-22T16:54:04.0369722Z       AWS Secret Key: 40 characters long, starts with r
2020-09-22T16:54:04.0370392Z  Wait for deployment: true
2020-09-22T16:54:04.0370979Z   Recovery wait time: 30
2020-09-22T16:54:04.0371427Z 
2020-09-22T16:54:05.8511590Z Uploading file to bucket elasticbeanstalk-***-XXX
2020-09-22T16:54:14.1356959Z New build successfully uploaded to S3, bucket=elasticbeanstalk-***-XXX, key=/XXX/bf1ba7ee459838a32b453680880b2f31242d9fd2.zip
2020-09-22T16:54:14.7553847Z ##[error]Deployment failed: Error: Status: 403. Code: SignatureDoesNotMatch, Message: The request signature we calculated does not match the signature you provided. Check your AWS Secret Access Key and signing method. Consult the service documentation for details.

Minimal AWS IAM Policy required to work

I'm getting a variety of permissions errors trying to get this working. Is there an effective minimum IAM policy I need to apply to the AWS User who's keys I'm supplying to this GitHub Action?

Deployment for Go app

Hi.

Please has anyone used this action to deploy a Go app? I am a bit confused about how this action will handle the Go application build.

Thank you.

Fails to deploy printing usage, when all values provided

Not sure why this started failing. Does it not use the aws_access_key although provided perhaps?

Run einaregilsson/beanstalk-deploy@v10
  with:
    aws_access_key: ***
    aws_secret_key: ***
    application_name: myservice
    environment_name: myservice-env
    version_label: ef404dbe438457836316cd4ebe53b2b6afe99874
    region: us-east-1
    deployment_package: build/distributions/my-service.zip
    wait_for_deployment: false
  env:
    JAVA_HOME_8.0.265_x64: /opt/hostedtoolcache/jdk/8.0.265/x64
    JAVA_HOME: /opt/hostedtoolcache/jdk/8.0.265/x64
    JAVA_HOME_8_0_265_X64: /opt/hostedtoolcache/jdk/8.0.265/x64

beanstalk-deploy: Deploy a zip file to AWS Elastic Beanstalk
https://github.com/einaregilsson/beanstalk-deploy

Usage: beanstalk-deploy.js <application> <environment> <versionLabel> <region> [<filename>]

Environment variables AWS_ACCESS_KEY_ID and AWS_SECRET_ACCESS_KEY must be defined for the program to work.
If <filename> is skipped the script will attempt to deploy an existing version named <versionLabel>.

Deployment failed due to invalid state

I am getting the following error in case I push 2 commits in a very small duration. The first commit gets deployed successfully, however, the second commit fails because the EBS state from the first commit is still not in the ready state.

Is there any potential solution to this problem?

[error]Deployment failed: Error: Status: 400. Code: InvalidParameterValue, Message: Environment named bis-prod is in an invalid state for this operation. Must be Ready.

Here is the script I am using

 - name: Beanstalk Deploy
      uses: einaregilsson/beanstalk-deploy@v9
      with:
        # AWS Access Key
        aws_access_key: {{my-key}}
        # AWS Secret Key
        aws_secret_key: {{my-secret}}
        # AWS Region
        region: us-west-1
        # Beanstalk application name
        application_name: {{app-name}}
        # Beanstalk environment name
        environment_name: {{my-env}}
        # Version label for new Beanstalk version
        version_label: "${{ steps.timestamp.outputs.date }}"
        # Zip file with the version to deploy. If skipped the action will deploy existing version.
        deployment_package: {{package-name}}
        # If set to "true" then the action will deploy an existing version with the given version_label if it already exists, but otherwise create the version and deploy it.
        use_existing_version_if_available: false
        # Whether the action should wait for the deployment to finish and log status messages during the wait. Default is "true". If set to "false" the action will start the deployment on Beanstalk and then exit.
#         wait_for_deployment: # optional
        # How many seconds to wait for the environment to return to Green state after deployment is finished. Default is 30 seconds.
        wait_for_environment_recovery: 600

Deployment failed: Error: Status: 400. Code: InvalidParameterValue, Message: No Application Version named '886765199' found.

Everything I try results in an error, it seems impossible to use.
This is my config:

    steps:
      - name: checkout
        uses: actions/checkout@v2

      - name: Generate deployment package
        run: zip -r deploy.zip docker-compose.yml Dockerrun.aws.json

      - name: Deploy to Elastic Beanstalk
        uses: einaregilsson/beanstalk-deploy@v17
        with:
          aws_access_key: ${{ secrets.AWS_ACCESS_KEY_ID }}
          aws_secret_key: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
          application_name: archimedes
          environment_name: dev-archimedes
          region: eu-west-1
          version_label: ${{github.run_id}}
          version_description: none
          deployment_package: deploy.zip

ERROR: Deployment failed: Error: Status: 400. Code: InvalidParameterValue, Message: No Application Version named '886765199' found.


Using existing version

    steps:
      - name: checkout
        uses: actions/checkout@v2

      - name: Generate deployment package
        run: zip -r deploy.zip docker-compose.yml Dockerrun.aws.json

      - name: Deploy to Elastic Beanstalk
        uses: einaregilsson/beanstalk-deploy@v17
        with:
          aws_access_key: ${{ secrets.AWS_ACCESS_KEY_ID }}
          aws_secret_key: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
          application_name: archimedes
          environment_name: dev-archimedes
          region: eu-west-1
          version_label: Sample Application
          version_description: none
          deployment_package: deploy.zip

ERROR: Deployment failed: Version Sample Application already exists. Either remove the "deployment_package" parameter to deploy existing version, or set the "use_existing_version_if_available" parameter to "true" to use existing version if it exists and deployment package if it doesn't.


With use_existing_version_if_available: true

    steps:
      - name: checkout
        uses: actions/checkout@v2

      - name: Generate deployment package
        run: zip -r deploy.zip docker-compose.yml Dockerrun.aws.json

      - name: Deploy to Elastic Beanstalk
        uses: einaregilsson/beanstalk-deploy@v17
        with:
          aws_access_key: ${{ secrets.AWS_ACCESS_KEY_ID }}
          aws_secret_key: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
          application_name: archimedes
          environment_name: dev-archimedes
          region: eu-west-1
          version_label: "Sample Application"
          version_description: none
          deployment_package: deploy.zip
          use_existing_version_if_available: true

ERROR: Error: Deployment failed: TypeError: Cannot read property 'VersionLabel' of undefined

502 Bad Gateway after running this action

I'm currently having issues with my project while deployment.

A Bad Gateway message appears and throws a failed status into the test, but everything was right in terms of artifacts (even the deployment was successfully deployed on the server)

Deployment failed: Error: Status: 502. Message: <html>

Any insights?

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.