圆CI "Could not ensure that workspace directory exists"
CircleCI "Could not ensure that workspace directory exists"
我正在使用 CircleCI 来构建一个 Unity 项目。构建有效,但我正在尝试使用 github-release orb 以便在 GitHub 上为构建创建一个版本。我为此创建了一个新的单独作业,因此我需要在作业之间共享数据。我正在使用 persist_to_workspace 来执行此操作,如文档中所述,但该解决方案似乎不起作用 - 我收到以下错误:“无法确保工作区目录 /root/project/Zipped 存在” .
对于工作区持久逻辑,我在 config.yml 文件中添加了以下代码行:
working_directory: /root/project
- 在主作业的执行器内部
persist_to_workspace
- 作为我主要工作步骤中的最后一个命令
attach_workspace
- 作为我第二份工作步骤中的开始命令
这是我的完整 config.yml 文件:
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
有人可以帮我解决这个问题吗?
如果有人遇到同样的问题,请尽量避免使用 /root 路径。我已将工件存储在 /tmp/ 中的某处,在存储工件之前,我使用 mkdir
和 -m
标志手动创建了 chmod 777 文件夹以指定 chmod 权限。
我正在使用 CircleCI 来构建一个 Unity 项目。构建有效,但我正在尝试使用 github-release orb 以便在 GitHub 上为构建创建一个版本。我为此创建了一个新的单独作业,因此我需要在作业之间共享数据。我正在使用 persist_to_workspace 来执行此操作,如文档中所述,但该解决方案似乎不起作用 - 我收到以下错误:“无法确保工作区目录 /root/project/Zipped 存在” .
对于工作区持久逻辑,我在 config.yml 文件中添加了以下代码行:
working_directory: /root/project
- 在主作业的执行器内部persist_to_workspace
- 作为我主要工作步骤中的最后一个命令attach_workspace
- 作为我第二份工作步骤中的开始命令
这是我的完整 config.yml 文件:
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
有人可以帮我解决这个问题吗?
如果有人遇到同样的问题,请尽量避免使用 /root 路径。我已将工件存储在 /tmp/ 中的某处,在存储工件之前,我使用 mkdir
和 -m
标志手动创建了 chmod 777 文件夹以指定 chmod 权限。