aws-toolkit-azure-devops
aws-toolkit-azure-devops copied to clipboard
AWSShellScript Task doesnt work with filePath
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.
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.
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.
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
The problem is in your configuration for the task--you need to pass scriptType: filePath, not scriptType: file. See the implementation here.
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: trueError:
####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.
displayName: 'aws s3 ls'
inputs:
awsCredentials:'$(Build.ServiceConnection)'
regionName: '$(Build.awsRegion1)'
scriptType: 'inline'
inlineScript: |
aws s3 ls
I think this way must work properly.