circlecicircleci-workflows

circleci permission denied error when using machine executor


I would like to use the machine executor so that I can run some component tests with docker-compose. My workflow fails on the checkout step and throws this error: Making checkout directory "/opt/my-app" Error: mkdir /opt/my-app: permission denied

Here is the yaml for the component_test stage in my workflow:

component_test:
  machine: true
  working_directory: /opt/my-app
  steps:
    - checkout

If I use docker instead of the machine executor then I don't get any permission issues:

component_test:
  machine: true
  working_directory: /opt/my-app
  steps:
    - checkout

But, I'd like to be able to use docker-compose and thus need to be able to run the machine executor. Has anyone seen a permission issue like this before?


Solution

  • You need to either change the working directory into something in /home/circleci or just exclude it complete as it's optional.

    Right now, the circleci user runs the checkout step, which doesn't have permission to git clone to the working directory you choose.

    Also, I wouldn't use machine: true as that is deprecated. Specify an image: https://circleci.com/docs/2.0/configuration-reference/#available-machine-images