'How to change directory using hosted runner via Bitbucket pipeline

I have a simple pipeline where I just want to navigate to a specific folder on the server hosting the runner.

My runner is online, I added the host in the SSH Keys section, and my step is:

  - step:
      name: 'Write log to server'
      services:
        - docker
      runs-on:
        - self.hosted
        - linux
      script:
        - export HOST_PROJECT_PATH=/home/project/myproject
        - ls -a
        - cd $HOST_PROJECT_PATH // folder not found but exists

The ls -a shows the content of my Bitbucket repository, and I can't cd to an existing directory (directory exists on the server).

Can I do it using pipeline & runner ? Do I need to use an other service ? Can't find any example or documentation.



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source