[英]Azure DevOps CICD build pipeline fails with error: specified command or file was not found
I have a CICD build pipeline in Azure Devops for building a .NET Core AWS API Gateway Serverless application.我在 Azure Devops 中有一个 CICD 构建管道,用于构建 .NET Core AWS API Gateway 无服务器应用程序。 The Pipeline is using hosted Windows 2019. The step that fails is:管道使用托管的 Windows 2019。失败的步骤是:
steps:
- task: AmazonWebServices.aws-vsts-tools.LambdaNETCoreDeploy.LambdaNETCoreDeploy@1
displayName: 'Build solution and generate CloudFormation template. '
inputs:
awsCredentials: 'AWS - Development (Infrastructure)'
regionName: 'ap-southeast-2'
command: deployServerless
packageOnly: true
packageOutputFile: '$(Build.ArtifactStagingDirectory)\serverless-output.yaml'
lambdaProjectPath: testapi/LCSApi.csproj
s3Bucket: 'api-dev-xxxxxxxx-s3'
s3Prefix: 'azure_devops_builds/lcs/'
additionalArgs: '-template serverless.template '
All I get from the error is the following:我从错误中得到的只是以下内容:
Beginning Serverless Deployment
Performing package-only build of serverless application, output template will be placed in D:\a\1\a\serverless-output.yaml
"C:\Program Files\dotnet\dotnet.exe" lambda package-ci -ot D:\a\1\a\serverless-output.yaml --region ap-southeast-2 --s3-bucket api-dev-xxxxxx-s3 --s3-prefix azure_devops_builds/lcs/ --disable-interactive true -template serverless.template
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 Core program, but dotnet-lambda 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.
##[error]Error: The process 'C:\Program Files\dotnet\dotnet.exe' failed with exit code 1
Finishing: Build solution and generate CloudFormation template.
However, if I re-run the pipeline straight after this failure, it works fine.但是,如果我在此失败后立即重新运行管道,则它可以正常工作。 Additionally, it does not always fail with this error.此外,它并不总是因此错误而失败。 Around 70-80% of the time the pipeline works fine.大约 70-80% 的时间管道工作正常。 What could this be and how can i address it?这可能是什么,我该如何解决?
Can you try adding this before your step:你可以尝试在你的步骤之前添加这个:
powershell: |
dotnet tool install --global Amazon.Lambda.Tools --version 3.1.1
dotnet tool update -g Amazon.Lambda.Tools
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.