Self-hosted runner failing with error "no space left on device"
プラットフォームについて: Cloud のみ - この記事は クラウド プラットフォームのアトラシアン製品に適用されます。
要約
The Bitbucket Pipeline build, which is setup to use self-hosted runners, is experiencing a failure due to an issue associated with inadequate disk space. The error message displaying in both the Pipelines UI build logs and the local runner.log file (refer to Reviewing runner logs) is as follows::
no space left on device
環境
原因
When a build configured to run in self-hosted runners is triggered, the runner assigned to execute the step will download several files to the local machine, clone the repository, and download any artifact or cache defined in the step.
More specifically, these files are downloaded and extracted in the local folder configured as the working directory. The runner's working directory can be configured on the runner start command, with the following directories being the default :
- Linux docker self-hosted runner: by default, the working directory is /tmp folder
- Linux Shell/MacOS/Windows runners: by default, the working directory is the temp folder inside the directory where the runner was extracted.
If you are not sure which directory was used when starting the Runner, follow these steps:
- Gather the Runner UUID from the failed step:
List the local containers and grab the Container ID for that runner:
$ docker container ls
- Once you have the container ID, there are two things that need to be checked:
The binded mount for the container:
$ docker inspect -f '{{ .Mounts }}' <containerid>
The env variable for WORKING_DIRECTORY inside the container:
$ docker exec -it <containerid> /bin/bash $ env
The download of these files needed to run the build requires the runner's host to have disk space available. If the Runner's host does not have sufficient disk space available or runs out of disk space during the build, the error "no space left on device" will be thrown, indicating the Runner needs more disk space to complete the execution of the build.
ソリューション
Check the available space for the Runner's host mounted drives :
For Linux and Mac OS
You can run the following command in the terminal of the host machine to check the available space for each mounted drive
and confirm if the Runner's working directory (/tmp by default, if not changed during the Runner start) is close to the limit and how much disk space is assigned to it :$ df -h
For Windows check Microsoft's article Find out how much storage your PC has
- If possible, free up some disk space on the drive where that contains the Runner's working directory folder. Some possibilities are deleting unnecessary and large files, moving some files to another disk or storage solution, or increasing the size of the disk.
- Alternatively, the Runner's working directory can be changed to a different folder where the host has more disk space :
- Linux docker self-hosted Runner: Changing the working directory of your runner | Linux Docker runner.
Linux Shell/macOS/Windows Runners: update the --working-directory argument in the Runner start command :
$ ./start.sh <rest of arguments> --workingDirectory <full path to desired working directory folder>
If you are encountering issues following this documentation - please raise a support ticket or a community support ticket for further assistance.