aws-toolkit-azure-devops icon indicating copy to clipboard operation
aws-toolkit-azure-devops copied to clipboard

AWS subcommand requireInput required: awsSubCommand

Open Silve2611 opened this issue 2 years ago • 2 comments

Describe the bug

We want to use awscodeartifact to retrieve a token that can later be used to access private aws repositorys. Therefore we run a aws command that should save the output to AWS_CODEARTIFACT_AUTH_TOKEN for later use in the build process.

However following error appears. ##[error]Error: Input required: awsSubCommand

To reproduce Add AWS connection to codeartifact from amazon (you need to set up codeartifact at aws)

  • task: AWSCLI@1 inputs: awsCredentials: 'AWS Connection' regionName: 'eu-central-1' awsCommand: 'aws codeartifact get-authorization-token --domain mydomain --domain-owner 1234... --query authorizationToken --output text' awsArguments: '$(AWS_CODEARTIFACT_AUTH_TOKEN)'

Run code

Expected behavior

Save retrieved token to paramater AWS_CODEARTIFACT_AUTH_TOKEN for later use

Your Environment

Using latest azure Pipelines

Additional context

This problem is crucial to anyone use codeartifact to build with azure pipelines. The token has to be received before building and save to a variable.

Silve2611 avatar Apr 13 '22 08:04 Silve2611

I also get the error : "Input required: awsSubCommand" according to the documentation (here: https://docs.aws.amazon.com/vsts/latest/userguide/awsshell.html) the awsSubCommand should not be required

How can I workaround this issue in the meantime?

avolcoff avatar Apr 19 '22 09:04 avolcoff

Looks like a discrepancy between documentation and implementation. The documentation is also confusing: awsSubCommand refers to the 2nd argument you would pass into the AWS CLI.

For example, aws codeartifact get-authorization-token --domain mydomain should be structured as follows:

    awsCommand: 'codeartifact'
    awsSubCommand: 'get-authorization-token'
    awsArguments: '--domain mydomain'

I'm thinking we should deprecate awsSubCommand and awsArguments. Having to fill out three different fields is confusing.

JadenSimon avatar Apr 26 '22 18:04 JadenSimon