Skip to content

AWSPowershellModuleScript emits misleading error when specified working directory does not exist #588

@cpr-nwright

Description

@cpr-nwright

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

  1. Create an ADO pipeline with the AWSPowershellModuleScriptTask
  2. Set the working directory to a non-existing path
  3. Set the script type to inline and provide a dummy inline script
  4. 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

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions