Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

jenkins: add documentation for update center #2

Open
wants to merge 2 commits into
base: main
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
32 changes: 32 additions & 0 deletions local/jenkins/jenkins.zh.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
Jenkins 是一个开源 CI&CD 平台,主要用于持续、自动的构建/测试软件项目、监控外部任务的运行。Jenkins 可以运行为系统软件包、Docker 或独立的 Java 程序。

Jenkins 插件通过升级中心(Update Center)进行发布。可以按以下步骤将 Jenkins 升级中心更改为 TUNA 镜像:

- 如果你已经安装了 Jenkins,可以在 系统管理->插件管理->高级设置 中更改升级中心地址为

<tmpl>
{{endpoint}}/updates/update-center.json
</tmpl>

- 如果你使用 Jenkins Configuration as Code(JCasC)进行配置,可以在配置文件中添加如下内容:

<tmpl z-lang="yaml">
jenkins:
updateCenter:
sites:
- id: "default"
url: "https://mirrors.tuna.tsinghua.edu.cn/jenkins/updates/update-center.json"
</tmpl>

- 如果你需要在 Docker 构建时使用以便安装自定义插件,可以在 Dockerfile 中设置下列环境变量:

<tmpl>
ENV JENKINS_UC {{endpoint}}/updates
ENV JENKINS_UC_EXPERIMENTAL {{endpoint}}/updates/experimental
ENV JENKINS_UC_DOWNLOAD {{endpoint}}
ENV JENKINS_PLUGIN_INFO {{endpoint}}/updates/current/plugin-versions.json
</tmpl>

注意,Jenkins 官方镜像源 `mirrors.jenkins-ci.org` 与官方更新中心 `updates.jenkins.io` 路径布局有差异,若保留默认的 `JENKINS_UC_DOWNLOAD=$JENKINS_UC/download` 会导致插件下载失败,因此所有 Jenkins 镜像使用者都需要配置 `JENKINS_UC_DOWNLOAD`。此外,环境变量只会影响 Docker 构建时的插件更新,不会影响 Jenkins 运行时的插件更新。

参考文档:https://github.com/jenkinsci/docker/?tab=readme-ov-file#setting-update-centers