【问题标题】:Azure DevOps CICD build pipeline fails with error: specified command or file was not foundAzure DevOps CICD 构建管道失败并出现错误:找不到指定的命令或文件
【发布时间】:2020-09-01 10:11:13
【问题描述】:

我在 Azure Devops 中有一个 CICD 构建管道,用于构建 .NET Core AWS API Gateway 无服务器应用程序。管道正在使用托管的 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% 的时间管道工作正常。这可能是什么,我该如何解决?

【问题讨论】:

  • 请将变量system.debug设置为True,查看日志中是否有更多信息。另外,你什么时候有这个问题?你以前遇到过这样的问题吗?
  • 这个问题有什么更新吗? Krzysztof Madej 的建议对您有帮助吗?
  • 您好 Cece,我以前遇到过这个问题,它是间歇性的。我今天已经添加了 Krzysztof 的建议,并将进行监控。
  • 任何更新,请告诉我们。如果 Krzysztof Madej 的建议对您有帮助,您可以 Accept it as an Answer,这可能对阅读此主题的其他社区成员有所帮助。
  • 您的问题进展如何?

标签: build aws-lambda azure-devops azure-pipelines aws-api-gateway


【解决方案1】:

你可以尝试在你的步骤之前添加这个吗:

powershell: |
   dotnet tool install --global Amazon.Lambda.Tools --version 3.1.1
   dotnet tool update -g Amazon.Lambda.Tools

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 2019-10-06
    • 2020-12-02
    • 2021-03-06
    • 2021-01-03
    • 2020-01-01
    • 2022-12-09
    • 1970-01-01
    相关资源
    最近更新 更多