我有以下 GitLab CI 步骤:
lint:
stage: frontend_check
only:
changes:
- frontend/**/*
script:
- cd frontend/ngapp
- npm run lint
- npm run prettier
在 GitLab 上运行此命令将在两个小时后超时。
原始日志:
[0KRunning with gitlab-runner 16.4.0 (6e766faf)[0;m
[0K on runner-192.168.63.53 U-zL7nfx, system ID: s_351d454b0ffc[0;m
section_start:1702987831:prepare_executor
[0K[0K[36;1mPreparing the "docker" executor[0;m[0;m
[0KUsing Docker executor with image node:21.4.0 ...[0;m
[0KAuthenticating with credentials from /root/.docker/config.json[0;m
[0KPulling docker image node:21.4.0 ...[0;m
[0KUsing docker image sha256:b866e35a0dc4df85e168524b368567023eb22b06fe16f2237094e937fcd24d96 for node:21.4.0 with digest node@sha256:52206db44f7bb76dca465a9fae016922b6878c39261c87c9b719ae4d892fecfd ...[0;m
section_end:1702987834:prepare_executor
[0Ksection_start:1702987834:prepare_script
[0K[0K[36;1mPreparing environment[0;m[0;m
Running on runner-u-zl7nfx-project-425-concurrent-0 via gitlab-runner...
section_end:1702987835:prepare_script
[0Ksection_start:1702987835:get_sources
[0K[0K[36;1mGetting source from Git repository[0;m[0;m
[32;1mFetching changes with git depth set to 50...[0;m
Reinitialized existing Git repository in /builds/ivu/landshut/.git/
[32;1mChecking out b6b09e82 as detached HEAD (ref is master)...[0;m
Removing frontend/ngapp/
[32;1mSkipping Git submodules setup[0;m
section_end:1702987841:get_sources
[0Ksection_start:1702987841:download_artifacts
[0K[0K[36;1mDownloading artifacts[0;m[0;m
[32;1mDownloading artifacts for maven_compile (635434)...[0;m
Downloading artifacts from coordinator... ok [0;m host[0;m=gitlab.webvalto.hu id[0;m=635434 responseStatus[0;m=200 OK token[0;m=64_xgXce
[32;1mDownloading artifacts for install_dependencies (635435)...[0;m
Downloading artifacts from coordinator... ok [0;m host[0;m=gitlab.webvalto.hu id[0;m=635435 responseStatus[0;m=200 OK token[0;m=64_xgXce
section_end:1702987878:download_artifacts
[0Ksection_start:1702987878:step_script
[0K[0K[36;1mExecuting "step_script" stage of the job script[0;m[0;m
[0KUsing docker image sha256:b866e35a0dc4df85e168524b368567023eb22b06fe16f2237094e937fcd24d96 for node:21.4.0 with digest node@sha256:52206db44f7bb76dca465a9fae016922b6878c39261c87c9b719ae4d892fecfd ...[0;m
[32;1m$ cd frontend/ngapp[0;m
[32;1m$ npm run lint[0;m
> [email protected] lint
> ng lint --fix
Node.js version v21.4.0 detected.
Odd numbered Node.js versions will not enter LTS status and should not be used for production. For more information, please see https://nodejs.org/en/about/previous-releases/.
section_end:1702995031:step_script
[0K[31;1mERROR: Job failed: execution took longer than 2h0m0s seconds
[0;m
在我的机器上使用相同的 Node 版本运行相同的命令只需 5 秒即可完成。
我认为这是因为你还没有安装
npm
依赖项。所以 ng
命令是未知的。
尝试在 :
之前制作
npm install
或
npm ci
lint:
stage: frontend_check
only:
changes:
- frontend/**/*
script:
- cd frontend/ngapp
- npm install
- npm run lint
- npm run prettier
但您也可以使用以前的工作提供的缓存和工件,例如
.npm
和 node_modules