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

AWSShellScript Task doesnt work with filePath

Open ck3mp opened this issue 3 years ago • 4 comments

Describe the bug

To reproduce

When the task entry is using an inline script like this:

      - task: AWSShellScript@1
        displayName: "Environment Setup"
        inputs:
          awsCredentials: ${{ parameters.serviceConnection }}
          scriptType: inline
          script: echo $(aws sts get-caller-identity) | cat -v
          failOnStandardError: true

It executes without issue.

image

When the code is in a .sh file and I use the following:

      - task: AWSShellScript@1
        displayName: "Environment Setup"
        inputs:
          awsCredentials: ${{ parameters.serviceConnection }}
          scriptType: file
          filePath: /DevOps/scripts/Environment_Setup.sh

The pipeline hangs. It seems the script is never passed to the bash shell so I assume it hangs as its just an open shell.

image

Expected behavior

The script is passed to the bash shell and executes.

Screenshots Included above for clarity.

Your Environment

  • On-prem or cloud based?: Cloud
  • Azure DevOps version: Current agent version: '2.189.0'
  • AWS Toolkit for Azure DevOps version: 1.11.0

Additional context

I've tried to work back through the repo to spot any issues but can't spot any. Never used TS.

ck3mp avatar Jul 30 '21 18:07 ck3mp

I am seeing this error:

- task: AWSShellScript@1
   displayName: 'aws s3 ls'
   inputs:
     awsCredentials:'$(Build.ServiceConnection)'
     regionName: '$(Build.awsRegion1)'
     scriptSource: inline
     inlineScript: 'aws s3 ls'
     continueOnError: true

Error:

####Task Permissions
Permissions for this task to call AWS service APIs depend on the activities in the supplied script.
==============================================================================
Configuring credentials for task
...configuring AWS credentials from service endpoint 'sfadfasdfsdfadsfsdfsdfasd'
...endpoint defines standard access/secret key credentials
Configuring region for task
...configured to use region ap-xxxxx-1, defined in task.
/usr/bin/bash /home/vsts/work/1/s
/home/vsts/work/1/s: /home/vsts/work/1/s: Is a directory
##[error]Error: The process '/usr/bin/bash' failed with exit code 126

ssala7 avatar May 11 '22 11:05 ssala7

The problem is in your configuration for the task--you need to pass scriptType: filePath, not scriptType: file. See the implementation here.

brynnflynn avatar Dec 08 '22 20:12 brynnflynn

I am seeing this error:

- task: AWSShellScript@1
   displayName: 'aws s3 ls'
   inputs:
     awsCredentials:'$(Build.ServiceConnection)'
     regionName: '$(Build.awsRegion1)'
     scriptSource: inline
     inlineScript: 'aws s3 ls'
     continueOnError: true

Error:

####Task Permissions
Permissions for this task to call AWS service APIs depend on the activities in the supplied script.
==============================================================================
Configuring credentials for task
...configuring AWS credentials from service endpoint 'sfadfasdfsdfadsfsdfsdfasd'
...endpoint defines standard access/secret key credentials
Configuring region for task
...configured to use region ap-xxxxx-1, defined in task.
/usr/bin/bash /home/vsts/work/1/s
/home/vsts/work/1/s: /home/vsts/work/1/s: Is a directory
##[error]Error: The process '/usr/bin/bash' failed with exit code 126

Use ScriptType instead of scriptSource.

sankha342 avatar Apr 19 '23 14:04 sankha342

   displayName: 'aws s3 ls'
   inputs:
     awsCredentials:'$(Build.ServiceConnection)'
     regionName: '$(Build.awsRegion1)'
     scriptType: 'inline'
     inlineScript: |
        aws s3 ls

I think this way must work properly.

glejnhithi avatar May 29 '23 08:05 glejnhithi