aws / aws/aws-toolkit-azure-devops

CodeDeploy Task does not work with Lambda or ECS deployment

Open
#288 6 comments 1 reaction 0 assignees View on GitHub
bug
Dominant language
TypeScript
Stars
258
Forks
114
PR merge metrics
No merged PRs in 30d

Description

Attempting to use the CodeDeploy task type results in the following error:

Depending on selected parameters the task may also require permissions to verify your deployment bundle exists in S3 or upload your application bundle to the specified Amazon S3 bucket. Depending on the size of the application bundle, either PutObject or the S3 multi-part upload APIs may be used.
2019-08-17T16:41:15.6465824Z ==============================================================================
2019-08-17T16:41:16.2934161Z Configuring credentials for task
2019-08-17T16:41:16.2937690Z dd302d74-04b2-4282-9141-d236b04a4a44 exists true
2019-08-17T16:41:16.2938083Z ...configuring AWS credentials from service endpoint 'dd302d74-04b2-4282-9141-d236b04a4a44'
2019-08-17T16:41:16.2938316Z ...endpoint defines standard access/secret key credentials
2019-08-17T16:41:16.2956669Z Configuring region for task
2019-08-17T16:41:16.2958387Z ...configured to use region us-east-1, defined in task.
2019-08-17T16:41:17.2782616Z Request to deploy new revision returned error: For Lambda and ECS deployment, fileExistsBehavior can not be specified { InvalidFileExistsBehaviorException: For Lambda and ECS deployment, fileExistsBehavior can not be specified
2019-08-17T16:41:17.2782844Z Configuring credentials for task
2019-08-17T16:41:17.2788160Z at constructor.extractError (D:\a\_tasks\CodeDeployDeployApplication_2ff35748-7800-409d-9511-a0a37ff0d348\1.4.0\CodeDeployDeployApplication.js:5:4968)
2019-08-17T16:41:17.2789647Z at constructor.callListeners (D:\a\_tasks\CodeDeployDeployApplication_2ff35748-7800-409d-9511-a0a37ff0d348\1.4.0\CodeDeployDeployApplication.js:5:64577)
2019-08-17T16:41:17.2789781Z at constructor.emit (D:\a\_tasks\CodeDeployDeployApplication_2ff35748-7800-409d-9511-a0a37ff0d348\1.4.0\CodeDeployDeployApplication.js:5:64287)
2019-08-17T16:41:17.2789862Z at constructor.emitEvent (D:\a\_tasks\CodeDeployDeployApplication_2ff35748-7800-409d-9511-a0a37ff0d348\1.4.0\CodeDeployDeployApplication.js:17:42573)
2019-08-17T16:41:17.2790361Z at constructor.e (D:\a\_tasks\CodeDeployDeployApplication_2ff35748-7800-409d-9511-a0a37ff0d348\1.4.0\CodeDeployDeployApplication.js:17:38146)
2019-08-17T16:41:17.2790513Z at r.runTo (D:\a\_tasks\CodeDeployDeployApplication_2ff35748-7800-409d-9511-a0a37ff0d348\1.4.0\CodeDeployDeployApplication.js:17:44409)
2019-08-17T16:41:17.2790631Z at D:\a\_tasks\CodeDeployDeployApplication_2ff35748-7800-409d-9511-a0a37ff0d348\1.4.0\CodeDeployDeployApplication.js:17:44614
2019-08-17T16:41:17.2790733Z at constructor. (D:\a\_tasks\CodeDeployDeployApplication_2ff35748-7800-409d-9511-a0a37ff0d348\1.4.0\CodeDeployDeployApplication.js:17:38415)
2019-08-17T16:41:17.2790997Z at constructor. (D:\a\_tasks\CodeDeployDeployApplication_2ff35748-7800-409d-9511-a0a37ff0d348\1.4.0\CodeDeployDeployApplication.js:17:42628)
2019-08-17T16:41:17.2791104Z at constructor.callListeners (D:\a\_tasks\CodeDeployDeployApplication_2ff35748-7800-409d-9511-a0a37ff0d348\1.4.0\CodeDeployDeployApplication.js:5:64683)
2019-08-17T16:41:17.2792372Z message: 'For Lambda and ECS deployment, fileExistsBehavior can not be specified',
2019-08-17T16:41:17.2792450Z code: 'InvalidFileExistsBehaviorException',
20

**To reproduce**
Attempting to use the Code Deployment module by referencing either a "Archive file in Amazon S3" or a "Folder or archive file in the workspace" results in the same error.

Use an "AWS Lambda" compute type for the CodeDeploy application.

The role executing this task has been granted the following code deployment rights:
"codedeploy:GetDeploymentGroup",
"codedeploy:CreateDeployment",
"codedeploy:RegisterApplicationRevision",
"codedeploy:GetDeploymentConfig",
"codedeploy:GetDeployment",
"codedeploy:StopDeployment",
"codedeploy:CreateDeploymentGroup",
"codedeploy:ContinueDeployment",
"codedeploy:GetApplication"

I also attempted this with by granting the user right all rights available (codedeploy:*) and got the same behavior.
I did validate that the referenced application and deployment group exists.

After reviewing the following documentation:
https://docs.aws.amazon.com/cli/latest/reference/deploy/create-deployment.html

I suspect that there the CodeDeploy API has changed and the way the CodeDeploy task is integrating with it needs to be updated.

**Expected behavior**
A successful push to CodeDeploy.

**Your Environment**
- Azure DevOps running Unbuntu deployment agent
- AWS VSTS Tools version: 1.4.0

**Additional context**
I also verified that I am installing the CodeDeploy Agent in a prior step in my release pipeline.

Contributor guide

Open the contributing guide

Research direction

Start at the CodeDeploy task integration in AWS VSTS Tools 1.4.0 and reproduce the Lambda or ECS deployment using the parameters described in the issue. Compare the task's create-deployment request with the linked AWS CLI documentation, then verify that a deployment succeeds without the fileExistsBehavior error.

Written by the indexing model from the issue text.

Assessment

Tech stack
aws, azure, typescript
Domain
cloud, devops
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.