我在k8s上安装了Gitlab和Gitlab runner。Gitlab runner连接到Gitlab示例并正确运行命令。在运行任务发布我的Vuejs项目后,我在npm install命令行中收到了gitlab runner的网络错误。
这是我的gitlab-ci.yaml:
build site:
image: node:lts-alpine
stage: build
script:
- npm install --progress=false
- npm run build
artifacts:
expire_in: 1 week
paths:
- dist
字符串
这是我的Gitlab运行日志:
Running with gitlab-runner 16.6.1 (f5da3c5a)
on lms-git-runner-01 esosuhkgL, system ID: r_SjhlYAhCSRTB
Preparing the "kubernetes" executor
00:00
Using Kubernetes namespace: gitlab-runner
Using Kubernetes executor with image node:lts-alpine ...
Using attach strategy to execute scripts...
Preparing environment
00:06
Using FF_USE_POD_ACTIVE_DEADLINE_SECONDS, the Pod activeDeadlineSeconds will be set to the job timeout: 1h0m0s...
Waiting for pod gitlab-runner/runner-esosuhkgl-project-1-concurrent-0-bgff4642 to be running, status is Pending
Waiting for pod gitlab-runner/runner-esosuhkgl-project-1-concurrent-0-bgff4642 to be running, status is Pending
ContainersNotReady: "containers with unready status: [build helper]"
ContainersNotReady: "containers with unready status: [build helper]"
Running on runner-esosuhkgl-project-1-concurrent-0-bgff4642 via gitlab-runner-8b59c79dc-zmrfb...
Getting source from Git repository
00:03
Fetching changes with git depth set to 20...
Initialized empty Git repository in /builds/frontend/lms-frontend-v3/.git/
Created fresh repository.
Checking out e6aa6709 as detached HEAD (ref is main)...
Skipping Git submodules setup
Executing "step_script" stage of the job script
$ npm install --progress=false
npm ERR! code ECONNRESET
npm ERR! network aborted
npm ERR! network This is a problem related to network connectivity.
npm ERR! network In most cases you are behind a proxy or have bad network settings.
npm ERR! network
npm ERR! network If you are behind a proxy, please make sure that the
npm ERR! network 'proxy' config is set properly. See: 'npm help config'
npm ERR! A complete log of this run can be found in: /root/.npm/_logs/2023-12-26T09_21_54_880Z-debug-0.log
Cleaning up project directory and file based variables
00:00
ERROR: Job failed: command terminated with exit code 1
型
需要正确运行ci/cd没有问题。
1条答案
按热度按时间dgiusagp1#
我的错误是由于这样一个事实,即当npm正在接收包,它无法接收其中一个包,它不会再试一次,按照这些步骤解决了我的问题
首先,我使用npm install和--verbose属性来显示所有的安装日志:
字符串
然后使用--force选项在捕获任何错误时重试npm,并继续安装所有npm包:
型