unity-game-enginedevopscircleciautomated-deployment

CircleCI "Could not ensure that workspace directory exists"


I am using CircleCI with a GameCI docker image in order to build a Unity project. The build works, but I am trying to make use of the h-matsuo/github-release orb in order to create a release on GitHub for the build. I have created a new separate job for this, so I needed to share data between the jobs. I am using persist_to_workspace in order to do that, as specified in the documentation, but the solution doesn't seem to work. I get the following error:

Could not ensure that workspace directory /root/project/Zipped exists

For the workspace persist logic, I've added the following lines of code in my config.yml file:

Here's my full config.yml file:

version: 2.1
orbs:
  github-release: h-matsuo/github-release@0.1.3

executors:
  unity_exec:
    docker:
      - image: unityci/editor:ubuntu-2019.4.19f1-windows-mono-0.9.0
    environment:
      BUILD_NAME: speedrun-circleci-build
    working_directory: /root/project

.build: &build
  executor: unity_exec
  steps:
    - checkout
    - run: mkdir -p /root/project/Zipped
    - run:
        name: Git submodule recursive
        command: git submodule update --init --recursive
    - run:
        name: Remove editor folder in shared project
        command: rm -rf ./Assets/Shared/Movement/Generic/Attributes/Editor/
    - run: 
        name: Converting Unity license
        command: chmod +x ./ci/unity_license.sh && ./ci/unity_license.sh
    - run:
        name: Building game binaries
        command: chmod +x ./ci/build.sh && ./ci/build.sh
    - run: 
        name: Zipping build
        command: apt update && apt -y install zip && zip -r "/root/project/Zipped/build.zip" ./Builds/
    - store_artifacts:
        path: /root/project/Zipped/build.zip
    - run:
        name: Show all files
        command: find "$(pwd)"
    - persist_to_workspace:
        root: Zipped
        paths:
            - build.zip
jobs:
  build_windows:
    <<: *build
    environment:
      BUILD_TARGET: StandaloneWindows64
  release:
    description: Build project and publish a new release tagged `v1.1.1`.
    executor: github-release/default
    steps:
      - attach_workspace:
          at: /root/project/Zipped
      - run:
          name: Show all files
          command: sudo find "/root/project"
      - github-release/create:
          tag: v1.1.1
          title: Version v1.1.1
          description: This release is version v1.1.1.
          file-path: ./build.zip
          
workflows:
  version: 2
  build:
    jobs:
      - build_windows
      - release:
          requires:
            - build_windows

What can I try to resolve this?


Solution

  • If somebody ever encounters the same issue, try to avoid making use of the /root path. I've stored the artifacts somewhere inside /tmp/, and before storing artifacts, I've manually created the folder with chmod 777 by using mkdir with the -m flag to specify chmod permissions.