【发布时间】:2021-07-28 12:43:05
【问题描述】:
我正在尝试按照 this 教程在 GitLab CI 中使用 black 启用格式检查。
为了简单起见,我将代码从.lint-ci.yml 转移到.gitlab-ci.yml。我正在使用的共享跑步者的标签是gitlab-ci。管道运行时出现以下错误:
bash: line 80: apk: command not found
ERROR: Job failed: exit status 1
显然,apk --no-cache add py3-pip python3-dev gcc linux-headers musl-dev libffi-dev openssl-dev git 行会被抛出。
这是.gitlab-ci.yml 文件:
formatter:
stage: build
tags:
- gitlab-ci
image: alpine
only:
- branches
before_script:
- apk --no-cache add py3-pip python3-dev gcc linux-headers musl-dev libffi-dev openssl-dev git
- pip install black
script:
- black . --check
allow_failure: false
有人可以帮我解决这个问题吗?
根据@slauth 的要求,这是作业的完整输出:
Running with gitlab-runner 11.6.1 (id1)
on gitlab-ci -CzBAN4M
Using Shell executor...
Running on gitserver...
Fetching changes...
HEAD is now at id2 a
From http://gitserver....
Checking out id3 as gitlabci...
Skipping Git submodules setup
$ apk --no-cache add py3-pip python3-dev gcc linux-headers musl-dev libffi-dev openssl-dev git
bash: line 80: apk: command not found
ERROR: Job failed: exit status 1
【问题讨论】:
-
您使用的是 gitlab.com 还是自托管服务器?也许您的跑步者正在使用不支持
image:配置的executor,请参阅this compatibility chart。 -
@slauth 我使用的是自托管服务器,但是查看其他项目中的多个
.gitlab-ci.yml文件,我可以看到image:配置到处弹出,所以我没有认为这就是问题所在。 -
你能发布
formatter工作的完整输出吗? -
@slauth 我已编辑问题以包含
formatter作业的完整输出。 -
注意“Using Shell executor...”这一行。也许还有其他跑步者可用?
标签: gitlab-ci alpine python-black