我正在使用gitlab作业来部署工具。下面的代码返回 sudo:找不到命令
。如果我删除 sudo
,我会得到以下内容:
W: Failed to fetch http://deb.debian.org/debian/dists/stable/InRelease Could not connect to deb.debian.org:80 (199.232.138.132), connection timed out
W: Failed to fetch http://security.debian.org/debian-security/dists/stable-security/InRelease Could not connect to security.debian.org:80 (151.101.130.132), connection timed out Could not connect to security.debian.org:80 (151.101.66.132), connection timed out Could not connect to security.debian.org:80 (151.101.2.132), connection timed out Could not connect to security.debian.org:80 (151.101.194.132), connection timed out
W: Failed to fetch http://deb.debian.org/debian/dists/stable-updates/InRelease Unable to connect to deb.debian.org:80:
W: Some index files failed to download. They have been ignored, or old ones used instead.
Reading package lists...
Building dependency tree...
Reading state information...
E: Unable to locate package latex209-bin
E: Unable to locate package texlive-latex-base
E: Unable to locate package texlive-latex-extra
E: Unable to locate package ant
Cleaning up project directory and file based variables
00:01
ERROR: Job failed: exit code 1
这是 .gitlab-ci.yml
文件:
stages:
- deploy
variables:
RA_NAME: "My_project"
default:
before_script:
- sudo apt-get update -qq && sudo apt-get install -y latex209-bin texlive-latex-base texlive-latex-extra ant && sudo apt-get install zip unzip
deploy_Default:
stage: deploy
script:
- sh -x deploy.sh "$RA_NAME" "$(cat RA_VERSION)"
artifacts:
paths:
- "${RA_NAME}_$(cat RA_VERSION).zip"
only:
- master
- dev
- tags
这已经发生了1周(最有可能来自Gitlab 15.0版本)。
在此之前的每项工作都开始发生通过
没有任何问题。现在,没有更改他们都失败的任何东西(即使尝试重播传递
>的旧旧的
我尝试添加
build_image:
script:
- docker build --network host
和几个类似的配置,但它们都没有。
现在我的问题:为什么 sudo
不再使用我的 .gitlab-- ci.yml
以及我该怎么办。
我应该提到,这些作业是由仅仅
中提到的分支触发的。我可以通过运行管道
或重新运行已经运行的来运行它们。我不知道任何其他方式可以运行它们。 Gitlab和Docker的所有工作都是由Gitlab UI完成的
I am using Gitlab Jobs to deploy a tool. The code below returns sudo: command not found
. If I remove the sudo
I get the following:
W: Failed to fetch http://deb.debian.org/debian/dists/stable/InRelease Could not connect to deb.debian.org:80 (199.232.138.132), connection timed out
W: Failed to fetch http://security.debian.org/debian-security/dists/stable-security/InRelease Could not connect to security.debian.org:80 (151.101.130.132), connection timed out Could not connect to security.debian.org:80 (151.101.66.132), connection timed out Could not connect to security.debian.org:80 (151.101.2.132), connection timed out Could not connect to security.debian.org:80 (151.101.194.132), connection timed out
W: Failed to fetch http://deb.debian.org/debian/dists/stable-updates/InRelease Unable to connect to deb.debian.org:80:
W: Some index files failed to download. They have been ignored, or old ones used instead.
Reading package lists...
Building dependency tree...
Reading state information...
E: Unable to locate package latex209-bin
E: Unable to locate package texlive-latex-base
E: Unable to locate package texlive-latex-extra
E: Unable to locate package ant
Cleaning up project directory and file based variables
00:01
ERROR: Job failed: exit code 1
This is the .gitlab-ci.yml
file:
stages:
- deploy
variables:
RA_NAME: "My_project"
default:
before_script:
- sudo apt-get update -qq && sudo apt-get install -y latex209-bin texlive-latex-base texlive-latex-extra ant && sudo apt-get install zip unzip
deploy_Default:
stage: deploy
script:
- sh -x deploy.sh "$RA_NAME" "$(cat RA_VERSION)"
artifacts:
paths:
- "${RA_NAME}_$(cat RA_VERSION).zip"
only:
- master
- dev
- tags
This has been happening for 1 week (most likely from the Gitlab 15.0 release).
Every Job before this started to happen Passed
without any problems. Now, without changing anything they all fail (even trying to rerun old ones that Passed
).
I tried adding
build_image:
script:
- docker build --network host
and a couple of similar configurations but none of them worked.
Now my question: why sudo
doesn't work anymore without changing anything on my .gitlab-ci.yml
and what can I do to solve it.
I should mention that these Jobs are triggered by commits to the branches mentioned in only
. I can run them by running pipeline
or rerun the ones that were already run. I am not aware of any other modality to run them. All the work with Gitlab and this Docker are done by Gitlab UI
发布评论
评论(2)
当实例/服务器有网络问题时,就会发生这种情况。如果跑步者没有自我主持,那么Gitlab应该很快就可以解决问题。如果跑步者是自主的,那么您就会遇到网络问题。这是我可以提出的:
注意:不
sudo
nano /etc/apt/sources.list
编辑来源列表,如果nano
不可用,则使用vi
例如
This happens when the instance/server has networking issues. If the runner isn't self-hosted then Gitlab should fix the problem fairly soon. If the runner is self-hosted then you've got networking issues. Here's what I can propose:
Note: Try this without
sudo
nano /etc/apt/sources.list
ifnano
is not available then usevi
For example
我解决了问题。在更新之前,在不指定
.gitlab-ci.yml
中的任何图像的情况下,默认情况下它使用了我的公司Docker Image。
。
注意到它使用了另一个
我添加到我的
.gitlab-ci.yml
以下:现在像以前一样正常。
如果您遇到这样的问题,请检查其使用的图像以及以前成功运行管道中使用的图像。
I solved the problem. Before the update, without specifying any image in
.
.gitlab-ci.yml
, by default it used my company Docker ImageAfter the update I noticed it used another one
I added to my
.gitlab-ci.yml
the following:and now works fine as before.
If you encounter such a problem, check the image it's using and the image used in a previous successfully run pipeline.