Weird errors running a simple one step pipeline on a hosted Linux agent

Viewed 39

My pipeline has a single Powershell step with the following code:

$pat = ConvertTo-SecureString $env:System_AccessToken -AsPlainText -Force
$AzureDevOpsCredentialArg = @{ Credential = [Management.Automation.PSCredential]::New("user", $pat) }
$Uri = $env:SYSTEM_TEAMFOUNDATIONCOLLECTIONURI.Replace("/dev.azure.com/", "/pkgs.dev.azure.com/")
$Uri = "$Uri/_packaging/dayforce/nuget/v2"
Register-PSRepository -Name 'Dayforce-QA' -SourceLocation $Uri -PublishLocation $Uri -InstallationPolicy Trusted @AzureDevOpsCredentialArg

There is no other code in the pipeline. This is on the ubuntu-latest hosted agent. Here is the output:

Could not execute because the specified command or file was not found.
Possible reasons for this include:
  * You misspelled a built-in dotnet command.
  * You intended to execute a .NET program, but dotnet--V does not exist.
  * You intended to run a global tool, but a dotnet-prefixed executable with this name could not be found on the PATH.
Could not execute because the specified command or file was not found.
Possible reasons for this include:
  * You misspelled a built-in dotnet command.
  * You intended to execute a .NET program, but dotnet--V does not exist.
  * You intended to run a global tool, but a dotnet-prefixed executable with this name could not be found on the PATH.
Could not execute because the specified command or file was not found.
Possible reasons for this include:
  * You misspelled a built-in dotnet command.
  * You intended to execute a .NET program, but dotnet--V does not exist.
  * You intended to run a global tool, but a dotnet-prefixed executable with this name could not be found on the PATH.
Could not execute because the specified command or file was not found.
Possible reasons for this include:
  * You misspelled a built-in dotnet command.
  * You intended to execute a .NET program, but dotnet--V does not exist.
  * You intended to run a global tool, but a dotnet-prefixed executable with this name could not be found on the PATH.

It seems some code invokes dotnet -V several times. But it does not fail the step! It is still green. Nonetheless it bothers me and I want to eliminate the root cause for this output.

Here is the pipeline link - https://dev.azure.com/MarkKharitonov0271/Demo/_build/results?buildId=36&view=logs&j=ca395085-040a-526b-2ce8-bdc85f692774&t=319cc4f9-2fdf-5261-34c0-5e64584fddb0

What am I doing wrong?

EDIT 1

I have rewritten it to use YAML. Also, added an extra step to show that dotnet command line exists and that dotnet --version returns 6.0.400, but dotnet -V produces exactly the same output as in the problematic step.

Right now the step also fails with an error that seems bogus to me as well. The URL it complains about seems totally valid.

1 Answers
Related