Describe the bug
The AWSPowerShellModuleScript@1 task fails with a confusing error message when the specified working directory does not exist and the script type is set to inline. Rather than complaining about the directory not existing, it gives the following error:
Cannot bind argument to parameter 'Path' because it is null.
This appears to be because after the assertion that the working directory exists fails, the tasks attempts to clean up the temporary script file. The working directory assertion happens before the file path is defined, hence the misleading error.
To reproduce
- Create an ADO pipeline with the AWSPowershellModuleScriptTask
- Set the working directory to a non-existing path
- Set the script type to inline and provide a dummy inline script
- Run the pipeline
Expected behavior
The temporary script file cleanup should validate the temporary file path exists and points to an existing file before trying to remove it so that previous errors are allowed to surface
Your Environment
- On-prem or cloud based?: Cloud Based
- Azure DevOps version: Version Dev19.M247.1 (AzureDevOps_M247_20241115.7)
- AWS Toolkit for Azure DevOps version: 1.18.0