Create
cancel
Showing results for 
Search instead for 
Did you mean: 
Sign up Log in

How should I set the LOCAL_PATH variable correctly?

Rodrigo Sarri November 18, 2022

I hope you are doing well! I'm facing a problem when trying to deploy using Bitbucket pipeline.

The project is a React project at version 18.2.0 and its files are in the frontend folder.

 

bitbucket-pipelines.yml

image: atlassian/default-image:3

# Workflow Configuration

pipelines:

  branches:

    staging:

      - parallel:

        - step:

            name: Build and Test

            script:

              - npm install --prefix ./frontend/ --legacy-peer-deps

              - npm audit fix --force --prefix ./frontend/

              - npm audit fix --force --prefix ./frontend/

              - npm run build --prefix ./frontend/

            artifacts:

              - ./frontend/build/**

      - step:

          name: Deploy to Staging

          deployment: Staging

          script:

            - pipe: atlassian/scp-deploy:0.3.3

              variables:

                USER: $USER

                SERVER: $SERVER

                REMOTE_PATH: '/var/www/html'

                LOCAL_PATH: './'
 
The error that I am not able to solve is related to the LOCAL_PATH folder.
./frontend/build/*
No such file or directory
./build/*
No such file or directory
./
error: unexpected filename: .
build
No such file or directory
$BITBUCKET_CLONE_DIR
/var/www/html/build: Permission denied
.
error: unexpected filename: .
/
error: unexpected filename:

 

Thanks in advance for any help

2 answers

1 accepted

0 votes
Answer accepted
Rodrigo Sarri December 15, 2022

I used it like this and it worked:

 

artifacts:
  - frontend/build/**
...
LOCAL_PATH: 'frontend/build/*'
0 votes
Ben
Atlassian Team
Atlassian Team members are employees working across the company in a wide variety of roles.
November 20, 2022

Hey Rodrigo,

When you run a pipelines build, the working directory is the clone directory of the repository itself: /opt/atlassian/pipelines/agent/build

If you need to access files within a folder called "react" for instance, I'd suggest using the following format "/react".

If you are still having issues navigating to the correct folder, I'd suggest running the following command in the build so you can view the folder structure accordingly:

ls -lah

Cheers!

- Ben (Bitbucket Cloud Support)

Suggest an answer

Log in or Sign up to answer
DEPLOYMENT TYPE
CLOUD
TAGS
AUG Leaders

Atlassian Community Events