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
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
if nano
is not available then use vi
For example
http://deb.debian.org/debian/dists/stable/InRelease // <-- remove this
http://ftp.us.debian.org/debian/dists/stable/InRelease // <-- add this
I solved the problem. Before the update, without specifying any image in .gitlab-ci.yml
, by default it used my company Docker Image .
After the update I noticed it used another one
I added to my .gitlab-ci.yml
the following:
image: myCompanyImage
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.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With