如何将正确的项目路径传递到bitbucket管道?

Neo*_*Neo 7 bitbucket amazon-web-services continuous-deployment aws-lambda bitbucket-pipelines

我想aws lamda .net core project使用部署bit bucket pipeline

我已经创建bitbucket-pipelines.yml如下,但构建运行后出现错误 -

MSBUILD : error MSB1003: Specify a project or solution file. The current working directory does not contain a project or solution file.

文件代码-

image: microsoft/dotnet:sdk

pipelines:
  default:
    - step:
        caches:
          - dotnetcore
        script: # Modify the commands below to build your repository.
          - export PROJECT_NAME=TestAWS/AWSLambda1/AWSLambda1.sln
          - dotnet restore
          - dotnet build $PROJECT_NAME
          - pipe: atlassian/aws-lambda-deploy:0.2.1
            variables:
              AWS_ACCESS_KEY_ID: ${AWS_ACCESS_KEY_ID}
              AWS_SECRET_ACCESS_KEY: ${AWS_SECRET_ACCESS_KEY}
              AWS_DEFAULT_REGION: 'us-east-1'
              FUNCTION_NAME: 'my-lambda-function'
              COMMAND: 'update'
              ZIP_FILE: 'code.zip'
Run Code Online (Sandbox Code Playgroud)

项目结构是这样的——

在此输入图像描述

Mr-*_*IDE 9

问题就在这里:

PROJECT_NAME=TestAWS/AWSLambda1/AWSLambda1.sln

这是错误的道路。Bitbucket Pipelines 将使用 Docker 映像中的特殊路径(例如 )/opt/atlassian/pipelines/agent/build/YOUR_PROJECT来对项目进行 Git 克隆。

当您单击 Pipelines Web 控制台中的“Build Setup”步骤时,您可以看到这一点:

Cloning into '/opt/atlassian/pipelines/agent/build'...
Run Code Online (Sandbox Code Playgroud)

您可以使用预定义的环境变量来检索此路径:$BITBUCKET_CLONE_DIR,如下所述: https: //support.atlassian.com/bitbucket-cloud/docs/variables-in-pipelines/

在你的 yml 构建脚本中考虑这样的事情:

Cloning into '/opt/atlassian/pipelines/agent/build'...
Run Code Online (Sandbox Code Playgroud)