Quiero implementar aws lamda .net core project utilizando bit bucket pipeline
bitbucket-pipelines.yml como se muestra a continuación, pero después de ejecutar la compilación, aparece un error:
MSBUILD : error MSB1003: Specify a project or solution file. The current working directory does not contain a project or solution file.
código de archivo -
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'la estructura del proyecto es así:
El problema está aquí:
PROJECT_NAME=TestAWS/AWSLambda1/AWSLambda1.sln
Este es el camino incorrecto. Bitbucket Pipelines usará una ruta especial en la imagen de Docker, algo así como /opt/atlassian/pipelines/agent/build/YOUR_PROJECT , para hacer un clon Git de su proyecto.
Puede ver esto cuando hace clic en el paso "Configuración de compilación" en la consola web de Pipelines:
Cloning into '/opt/atlassian/pipelines/agent/build'... Puede usar una variable de entorno predefinida para recuperar esta ruta: $BITBUCKET_CLONE_DIR , como se describe aquí: https://support.atlassian.com/bitbucket-cloud/docs/variables-in-pipelines/
Considere algo como esto en su script de compilación yml:
script: - echo $BITBUCKET_CLONE_DIR # Debug: Print the $BITBUCKET_CLONE_DIR - pwd # Debug: Print the current working directory - find "$(pwd -P)" -name AWSLambda1.sln # Debug: Show the full file path of AWSLambda1.sln - export PROJECT_NAME="$BITBUCKET_CLONE_DIR/AWSLambda1.sln" - echo $PROJECT_NAME - if [ -f "$PROJECT_NAME" ]; then echo "File exists" ; fi # Try this if the file path is not as expected - export PROJECT_NAME="$BITBUCKET_CLONE_DIR/AWSLambda1/AWSLambda1.sln" - echo $PROJECT_NAME - if [ -f "$PROJECT_NAME" ]; then echo "File exists" ; fi