我在帶有python:3影像的 Docker 容器(在 Gitlab CI/CD 管道中)中運行以下內容。我使用以下命令安裝了 git:
apt-get update
apt-get install -y git
根據輸出,這甚至沒有必要,因為 git 已經安裝。不幸的是,我得到了以下輸出,指出即使在腳本前面使用了“git”命令,也沒有找到“git”命令。有誰知道這里發生了什么?
$ apt-get update
Get:1 http://security.debian.org/debian-security bullseye-security InRelease [44.1 kB]
Get:2 http://deb.debian.org/debian bullseye InRelease [116 kB]
Get:3 http://deb.debian.org/debian bullseye-updates InRelease [39.4 kB]
Get:4 http://security.debian.org/debian-security bullseye-security/main amd64 Packages [109 kB]
Get:5 http://deb.debian.org/debian bullseye/main amd64 Packages [8183 kB]
Get:6 http://deb.debian.org/debian bullseye-updates/main amd64 Packages [2592 B]
Fetched 8494 kB in 1s (6639 kB/s)
Reading package lists...
$ apt-get install -y git
Reading package lists...
Building dependency tree...
Reading state information...
git is already the newest version (1:2.30.2-1).
0 upgraded, 0 newly installed, 0 to remove and 1 not upgraded.
$ git --version
git version 2.30.2
$ git config --global user.email "${GIT_USER_EMAIL:-$GITLAB_USER_EMAIL}"
$ git config --global user.name "${GIT_USER_NAME:-$GITLAB_USER_NAME}"
$ regex="^report\/[^\/]*\/([^\/]*)\/(.*)"
$ [[ $CI_COMMIT_BRANCH =~ $regex ]]
$ CUSTOMER="${BASH_REMATCH[1]}"
$ PATH="${BASH_REMATCH[2]}"
$ RELPATH=$(.ci/scripts/find_relative.py "${CI_PROJECT_PATH}" "${PATH}")
$ git submodule add ${RELPATH} ${CUSTOMER}
/scripts-530-146123/step_script: line 151: git: command not found
ERROR: Job failed: command terminated with exit code 1
uj5u.com熱心網友回復:
在這一行:
PATH="${BASH_REMATCH[2]}"
你改變PATH變數。我懷疑它不再/usr/bin(或任何地方git)在新路徑中。
轉載請註明出處,本文鏈接:https://www.uj5u.com/qukuanlian/417456.html
標籤:
上一篇:僅在前一個作業完成時執行作業
