Eva*_*tti 17 docker github-actions
我正在运行 GitHub Actions 工作流程,但由于以下错误而失败。
Unhandled exception:
FileSystemException: Cannot create file, path = '/github/home/.flutter' (OS Error: Permission denied, errno = 13)
Run Code Online (Sandbox Code Playgroud)
我查看了 GitHub Actions 的工作流语法,但找不到任何说明来解决这个问题。
我的构建文件看起来像这样:
name: Flutter CI
on: [push]
jobs:
build:
runs-on: ubuntu-latest
container:
image: cirrusci/flutter:v1.7.8-hotfix.4
steps:
- uses: actions/checkout@v1
- name: Install dependencies
run: flutter pub get
working-directory: my_app
- name: Run tests
run: flutter test
Run Code Online (Sandbox Code Playgroud)
Eva*_*tti 22
终于有时间看看它并添加sudo解决了它。
该图像与 user 一起运行cirrus。还需要提供完整路径:
sudo /home/cirrus/sdks/flutter/bin/flutter pub get
Run Code Online (Sandbox Code Playgroud)
来自 GitHub文档:
Linux 和 macOS 虚拟机都使用无密码 sudo 运行。当您需要执行命令或安装需要比当前用户更多权限的工具时,您可以使用 sudo 而无需提供密码。
M.D*_*.D. 10
您也可以只修改容器配置,而不是将 sudo 添加到所有失败的步骤中:
container:
image: cirrusci/flutter:v1.7.8-hotfix.4
options: --user root
Run Code Online (Sandbox Code Playgroud)
说明:导致此问题的原因是 cirrusci/flutter:v1.7.8-hotfix.4 映像上的默认用户无权访问 github 挂载到此 docker 映像中的某些目录。包括/github给您带来麻烦的目录。添加options: --user root到容器配置可确保默认用户成为 root,这样您就不需要在每一步都执行 sudo。
| 归档时间: |
|
| 查看次数: |
18623 次 |
| 最近记录: |