Troubleshooting Bitbucket Cloud Runner failure after working directory change
Platform Notice: Cloud - This article applies to Atlassian products on the cloud platform.
Summary
After changing the working directory of your Bitbucket Cloud Runner setup, builds on the runner are fail consistently.
Example:
Runner matching labels:
- linux
- test
- self.hosted
Runner name: aws-runner-04
Runner UUID: {492c9ebf-dba2-552e-af56-3b26b975bac2}
Runner labels: self.hosted, test, linux, aws
Runner version:
current: 3.1.0
latest: 3.1.0
mkfifo: /tmp/492c9ebf-dba2-552e-af56-3b26b975bac2/tmp/clone_result: File exists
Cause
Bitbucket Cloud Runner has the following criteria to function accurately:
The local directory on your machine, the directory inside the runner, and the WORKING_DIRECTORY environment variable must all be set to the same value.
If this alignment between the HOST and container path is not present, the builds on the runner will fail.
Solution
To resolve the consistent build failures after changing the working directory, follow these steps:
Ensure that the local directory, the directory inside the runner, and the WORKING_DIRECTORY are set to the same value.
If you want to change the working directory that the runner uses on your host machine, add the following two flags to the
docker run
command when you start the runner:docker run [all existing parameters] -v /localdirectory:/localdirectory -e WORKING_DIRECTORY=/localdirectory [runner image name]
- The first parameter
-v
is the local directory on your machine that functions as the working directory. - The second parameter is the directory inside the container.
- The first parameter