在 Gitlab 中找不到文件-CI
File not found in Gitlab-CI
我已经在此处看到这个 ,但该解决方案不适用于我正在处理的 Flutter 项目。
这是我的 yaml 文件:
image: cirrusci/flutter
variables:
before_script:
- flutter channel beta
- flutter upgrade
stages:
# - build
- test
#build:
# stage: build
# script:
# - flutter build apk
unitTests:
stage: test
script:
# - ls -la /opt/application/
# - ls -la ~/
- bash -c "echo \"$APP_VARS\" > ./cfg/env.json"
- flutter test test/widget_test.dart
ls -la /opt/application/
和 bash -c "echo \"$APP_VARS\" > ./cfg/env.json"
都产生了 cannot access <filename/directory>: File or Directory Not Found
错误
她是 ls -la ~/
的输出:
$ ls -la ~/
total 72
drwxr-xr-x. 1 cirrus cirrus 4096 Jul 9 19:16 .
drwxr-xr-x. 1 root root 4096 Mar 7 2018 ..
drwxr-xr-x. 1 cirrus cirrus 4096 Jul 9 19:17 .android
-rw-r--r--. 1 cirrus cirrus 220 May 15 2017 .bash_logout
-rw-r--r--. 1 cirrus cirrus 3526 May 15 2017 .bashrc
-rw-r--r--. 1 cirrus cirrus 24 Jul 9 19:16 .flutter
-rw-r--r--. 1 cirrus cirrus 675 May 15 2017 .profile
drwxr-xr-x. 1 cirrus cirrus 4096 Jul 9 19:16 .pub-cache
drwxr-xr-x. 1 cirrus cirrus 4096 Jul 9 19:16 sdks
我的意图是通过 CI 注入环境变量,以便在测试期间使用(并希望部署,尽管我还没有做到这一点)。
解决方案分为两部分:
首先,/builds/**/cfg/
目录实际上并不存在。要解决此问题,您有两个选择——在存储库中执行 mkdir
或 commit/push 文件。我在我的 cfg
目录中添加了一个空的 .gitignore
。
然后,产生了 Permission Denied
错误。为了解决这个问题,我首先尝试 sudo
我的命令(让我执行上面提到的 mkdir
)。当这不起作用时,我做了 chmod -R 777 /builds/
,这解决了我的问题。
展望未来,我计划改用 chmod [-R] 644
或 chmod [-R] 755
,并通过 shell 对我需要 运行 的任何文件执行 chmod +x
脚本。
我也将我的环境配置脚本移动到 gitlab YAML 中的 before_script:
部分,但我认为没有必要。
See 有关 chmod
.
的信息
我已经在此处看到这个
这是我的 yaml 文件:
image: cirrusci/flutter
variables:
before_script:
- flutter channel beta
- flutter upgrade
stages:
# - build
- test
#build:
# stage: build
# script:
# - flutter build apk
unitTests:
stage: test
script:
# - ls -la /opt/application/
# - ls -la ~/
- bash -c "echo \"$APP_VARS\" > ./cfg/env.json"
- flutter test test/widget_test.dart
ls -la /opt/application/
和 bash -c "echo \"$APP_VARS\" > ./cfg/env.json"
cannot access <filename/directory>: File or Directory Not Found
错误
她是 ls -la ~/
的输出:
$ ls -la ~/
total 72
drwxr-xr-x. 1 cirrus cirrus 4096 Jul 9 19:16 .
drwxr-xr-x. 1 root root 4096 Mar 7 2018 ..
drwxr-xr-x. 1 cirrus cirrus 4096 Jul 9 19:17 .android
-rw-r--r--. 1 cirrus cirrus 220 May 15 2017 .bash_logout
-rw-r--r--. 1 cirrus cirrus 3526 May 15 2017 .bashrc
-rw-r--r--. 1 cirrus cirrus 24 Jul 9 19:16 .flutter
-rw-r--r--. 1 cirrus cirrus 675 May 15 2017 .profile
drwxr-xr-x. 1 cirrus cirrus 4096 Jul 9 19:16 .pub-cache
drwxr-xr-x. 1 cirrus cirrus 4096 Jul 9 19:16 sdks
我的意图是通过 CI 注入环境变量,以便在测试期间使用(并希望部署,尽管我还没有做到这一点)。
解决方案分为两部分:
首先,/builds/**/cfg/
目录实际上并不存在。要解决此问题,您有两个选择——在存储库中执行 mkdir
或 commit/push 文件。我在我的 cfg
目录中添加了一个空的 .gitignore
。
然后,产生了 Permission Denied
错误。为了解决这个问题,我首先尝试 sudo
我的命令(让我执行上面提到的 mkdir
)。当这不起作用时,我做了 chmod -R 777 /builds/
,这解决了我的问题。
展望未来,我计划改用 chmod [-R] 644
或 chmod [-R] 755
,并通过 shell 对我需要 运行 的任何文件执行 chmod +x
脚本。
我也将我的环境配置脚本移动到 gitlab YAML 中的 before_script:
部分,但我认为没有必要。
See 有关 chmod
.