I'm trying to create a CI/CD pipeline using buildkite where the build steps runs on a Virtual Machine (Ubuntu). However, an npm package called keytar
which is a dependency of tedious
library is causing issues in the pipeline.
When running one of the steps from using the buildkite-agent, it tries to clean up an existing repository. And during the command git clean -fxdq
it fails to remove keytar.node
file due to a Permission denied
Error.
Here's a full log of the step:
> Running global environment hook
> Setting up plugins
> Preparing working directory
$ cd /var/lib/buildkite-agent/builds/build-server-1/someorg/some-repo
# Host "bitbucket.org" already in list of known hosts at "/var/lib/buildkite-agent/.ssh/known_hosts"
$ git remote set-url origin git@bitbucket.org:someorg/some-repo.git
$ git clean -fxdq
warning: failed to remove node_modules/keytar/build/Release/keytar.node: Permission denied
# Removing /var/lib/buildkite-agent/builds/build-server-1/someorg/some-repo
⚠️ Warning: Checkout failed! Error running `/usr/bin/git clean -fxdq`: exit status 1 (Attempt 1/3 Retrying in 2s)
# Host "bitbucket.org" already in list of known hosts at "/var/lib/buildkite-agent/.ssh/known_hosts"
$ git clone -v -- git@bitbucket.org:someorg/some-repo.git .
fatal: destination path '.' already exists and is not an empty directory.
# Removing /var/lib/buildkite-agent/builds/build-server-1/someorg/some-repo
⚠️ Warning: Checkout failed! Error running `/usr/bin/git clone -v -- git@bitbucket.org:someorg/some-repo.git .`: exit status 128 (Attempt 2/3 Retrying in 2s)
# Host "bitbucket.org" already in list of known hosts at "/var/lib/buildkite-agent/.ssh/known_hosts"
$ git clone -v -- git@bitbucket.org:someorg/some-repo.git .
fatal: destination path '.' already exists and is not an empty directory.
# Removing /var/lib/buildkite-agent/builds/build-server-1/someorg/some-repo
⚠️ Warning: Checkout failed! Error running `/usr/bin/git clone -v -- git@bitbucket.org:someorg/some-repo.git .`: exit status 128 (Attempt 3/3 Retrying in 2s)
# Skipping artifact upload, no checkout
Error: Error running `/usr/bin/git clone -v -- git@bitbucket.org:someorg/some-repo.git .`: exit status 128
Upon examining the permissions on the folder /some-repo
using the ls -l
command the permissions seem to be drwxr-xr-x
and the owner is buildkite-agent
. I'm stumped as how this file does not get deleted while all other files get deleted without any issue.