我在Azure Devops中有一个用于构建.NET Core AWS API Gateway无服务器应用程序的CICD构建管道。Pipeline正在使用托管的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 '我从这个错误中得到的信息如下:
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.但是,如果我在失败后直接重新运行管道,它工作得很好。此外,它并不总是失败,并出现此错误。在大约70-80%的时间里,管道运行良好。这可能是什么,我如何解决它?
发布于 2020-09-01 18:50:09
你可以试着在你的步骤之前添加这个:
powershell: |
dotnet tool install --global Amazon.Lambda.Tools --version 3.1.1
dotnet tool update -g Amazon.Lambda.Toolshttps://stackoverflow.com/questions/63685654
复制相似问题