CircleCI-Public / aws-code-deploy-orb

Easily deploy applications to AWS CodeDeploy on CircleCI with the aws-code-deploy orb
https://circleci.com/orbs/registry/orb/circleci/aws-code-deploy
MIT License
9 stars 13 forks source link

Not possible to use "file-exists-behavior" argument #4

Closed zetxek closed 4 years ago

zetxek commented 4 years ago

Orb Version 1.0.0

Describe the bug

When passing an argument that only applies to one of the aws commands, like "file-exists-behavior, which applies to Create Deployment, but not to get application - the deployment will fail.

To Reproduce

Add the argument --file-exists-behaviour OVERWRITE to the deploy job

Expected behavior

The argument is used if it's relevant, and the deployment succeeds at overwriting files.

Additional context

Error in the ensure-application-created step:

#!/bin/bash -eo pipefail
set +e
aws deploy get-application --application-name Drupal-test --file-exists-behavior=OVERWRITE
if [ $? -ne 0 ]; then
  set -e
  echo "No application named Drupal-test found. Trying to create a new one"
  aws deploy create-application --application-name Drupal-test --file-exists-behavior=OVERWRITE
else
  set -e
  echo "Application named Drupal-test already exists. Skipping creation."
fi

usage: aws [options] <command> <subcommand> [<subcommand> ...] [parameters]

To see help text, you can run:

  aws help

  aws <command> help

  aws <command> <subcommand> help

Unknown options: --file-exists-behavior=OVERWRITE

No application named Drupal-test found. Trying to create a new one

usage: aws [options] <command> <subcommand> [<subcommand> ...] [parameters]

To see help text, you can run:

  aws help

  aws <command> help

  aws <command> <subcommand> help

Unknown options: --file-exists-behavior=OVERWRITE

Exited with code exit status 255

CircleCI received exit code 255

Syntax used in my job:

      - deploy-aws-test:
          requires: 
            - build
          filters: 
            branches:
              only: 
              - develop
      - aws-code-deploy/deploy:
          name: Deploy to AWS CodeDeploy (Test)
          requires: 
            - build
          filters: 
            branches:
              only: 
              - develop        
          pre-steps: 
            - queue/until_front_of_line:
              time: '30'
              dont-quit: true

            - attach_workspace:
                at: /tmp/
            - run: 
                name: Untar artifact
                command: | 
                  mkdir /tmp/project/ && tar -xf /tmp/artifacts/*.tar -C /tmp/project/
            - run: 
                name: Remove node_modules and .git
                command: |
                  rm -rf /tmp/project/.git && rm -rf /tmp/project/static/node_modules
            - slack/notify:
              channel: #release-bots
              color: '#3792cb'
              message: Starting deployment to AWS Testing Environment

          application-name: Drupal-test
          bundle-bucket: REDACTED
          bundle-key: REDACTED
          deployment-group: DeploymentGroup-Drupal-test
          service-role-arn: REDACTED
          bundle-source: /tmp/project/  
          arguments: --file-exists-behavior OVERWRITE
zetxek commented 4 years ago

I think this is solved by PR https://github.com/CircleCI-Public/aws-code-deploy-orb/pull/2

lokst commented 4 years ago

@zetxek It should be resolved with circleci/aws-code-deploy@1.0.1. Please let us know if you still encounter issues.