我有一个孤立的Gitlab服务器和Gitlab跑步者,他们缺乏互联网连接。我试图在Docker容器中运行“语义版本控制”(一个node.js应用程序),以便它能够为我的GitLab存储库处理自动版本控制。
我必须将所有依赖项构建到一个高级的Docker容器中,因为它们在运行时无法到达internet,而且我必须手动将容器移动到Gitlab Runner,以便手动加载Docker。
我已经解决了所有的令牌问题,并将所有的部分连接在一起,最后我得到了一个积极的结果(稍微增加了一个版本),但是在一个几乎为空的存储库上运行花费了1660秒(这个回购只是为了测试)。
花费最多时间和进程挂起的步骤是"npx语义释放“何时执行。从那里开始,它可能需要40分钟才能完成。然而,一旦npx语义发布步骤完成,分析回购的实际“工作”只需几秒钟。这让我认为这与Dockerfile的准备方式有关,而不是与语义发布本身的配置问题有关。
下面这一步走的时间最长:
$ npx语义发布版
npx:在1660.75s中安装了575
Executing "step_script" stage of the job script
Using docker image sha256:d0733317abd6fbce07dcf85b1aff35d82f986e7de9ff56fdf5b985504bf3e9f4 for semantic:1 ...
$ npx semantic-release
npx: installed 575 in 1660.75s
[6:03:29 PM] [semantic-release] › ℹ Running semantic-release version 17.4.4
[6:03:29 PM] [semantic-release] › ✔ Loaded plugin "verifyConditions" from "@semantic-release/gitlab"
[6:03:29 PM] [semantic-release] › ✔ Loaded plugin "analyzeCommits" from "@semantic-release/commit-analyzer"
[6:03:29 PM] [semantic-release] › ✔ Loaded plugin "generateNotes" from "@semantic-release/release-notes-generator"
[6:03:29 PM] [semantic-release] › ✔ Loaded plugin "publish" from "@semantic-release/gitlab"
[6:03:29 PM] [semantic-release] › ✔ Run automated release from branch main on repository http://gitlab-ci-token:[secure]@[internal_IP]/gitlab-instance-937dde58/my_second_project.git
[6:03:30 PM] [semantic-release] › ✔ Allowed to push to the Git repository
[6:03:30 PM] [semantic-release] › ℹ Start step "verifyConditions" of plugin "@semantic-release/gitlab"
[6:03:30 PM] [semantic-release] [@semantic-release/gitlab] › ℹ Verify GitLab authentication (http://[internal_IP]/api/v4)
[6:03:30 PM] [semantic-release] › ✔ Completed step "verifyConditions" of plugin "@semantic-release/gitlab"
[6:03:30 PM] [semantic-release] › ℹ Found git tag v1.0.0 associated with version 1.0.0 on branch main
[6:03:30 PM] [semantic-release] › ℹ Found 32 commits since last release
[6:03:30 PM] [semantic-release] › ℹ Start step "analyzeCommits" of plugin "@semantic-release/commit-analyzer"
[6:03:30 PM] [semantic-release] [@semantic-release/commit-analyzer] › ℹ Analyzing commit: new stuff很可能是我的Dockerfile需要进一步检查。然而,我在这方面还是很新的,我需要关于什么东西需要这么长时间的建议(我能不能让dockerfile预先预装语义发布的575个依赖项呢?)
以下是我的Dockerfile (我将其构建为“语义:1”)
FROM node:13
RUN npm config set strict-ssl false
RUN npm install semantic-release@17.4.4
RUN npm install @semantic-release/gitlab@6.2.2这是我的gitlab-ci.yml
---
release:
image: "semantic:1"
only:
refs:
- main
- alpha
- "/^(([0-9]+)\\.)?([0-9]+)\\.x/"
- "/^([0-9]+)\\.([0-9]+)\\.([0-9]+)(?:-([0-9A-Za-z-]+(?:\\.[0-9A-Za-z-]+)*))?(?:\\+[0-9A-Za-z-]+)?$/"
script:
- "npx semantic-release"
stage: release
stages:
- release还有我的.releaserc.yml
plugins:
- "@semantic-release/commit-analyzer"
- "@semantic-release/release-notes-generator"
- "@semantic-release/gitlab"
branches:
- "main"
- "+([0-9])?(.{+([0-9]),x}).x"
- name: "alpha"
prerelease: "alpha"谢谢!
发布于 2021-08-17 16:22:41
信用归功于这个回购:https://github.com/caos/semantic-release
基本上,只需查看此人的Dockerfile,并添加严格的版本,这样就不会搜索最新的更新(因为我的安装程序是孤立的)。
FROM node:13
RUN npm config set strict-ssl false
RUN npm install -g semantic-release@17.4.5
RUN npm install -g @semantic-release/gitlab@6.2.2
RUN npm config set registry http://registry.npmjs.org/
ENTRYPOINT ["npx"]
CMD ["semantic-release@17.4.5"]干杯!
https://stackoverflow.com/questions/68817051
复制相似问题