簡體   English   中英

使用 Helm 圖表離線安裝 Jenkins 插件

[英]Install Jenkins Plugins offline using Helm charts

我正在嘗試在防火牆后面的 Kubernetes 集群上使用 Helm 部署 Jenkins。 我已經下載了 Jenkins 映像並將其復制到我們的內部存儲庫。 我可以使用內部存儲庫中的此圖像調出 Jenkins。 有沒有辦法對插件做同樣的事情。

我很難離線安裝插件。 我不想每次或從 GUI 手動將 .hpi 文件上傳到容器中。 我正在尋找更多的自動化方式,我可以告訴 Jenkins 哪個倉庫/位置也可以查找 Jenkins 插件。

通常我們會在 values.yaml 文件的“installPlugins”部分提到插件,如下所示:

installPlugins:
    - kubernetes:1.18.2

有沒有一種方法可以提供我們的整個回購/位置路徑,例如:

installPlugins:
    - http:MY_INTERNAL_REPO/kubernetes:1.18.2

基本上,我可以下載插件並將它們復制到特定位置。 但我希望 helm 自動從這個內部位置獲取插件。

您可以通過在copy-default-config容器中導出一些變量來指定自定義 URL,方法是編輯您的圖表,如下所示:

master:
  initContainerEnv:
    - name: JENKINS_UC
      value: https://test.host.local
    - name: JENKINS_UC_EXPERIMENTAL
      value: https://test.host.local
    - name: JENKINS_INCREMENTALS_REPO_MIRROR
      value: https://test.host.local
    - name: JENKINS_UC_DOWNLOAD
      value: https://test.host.local

以下是每個環境的描述:

Setting update centers
During the download, the script will use update centers defined by the following environment variables:

JENKINS_UC - Main update center. This update center may offer plugin versions depending on the Jenkins LTS Core versions. Default value: https://updates.jenkins.io
JENKINS_UC_EXPERIMENTAL - Experimental Update Center. This center offers Alpha and Beta versions of plugins. Default value: https://updates.jenkins.io/experimental
JENKINS_INCREMENTALS_REPO_MIRROR - Defines Maven mirror to be used to download plugins from the Incrementals repo. Default value: https://repo.jenkins-ci.org/incrementals
JENKINS_UC_DOWNLOAD - Download url of the Update Center. Default value: $JENKINS_UC/download

你可以在這里找到更多信息

添加 URL 並運行 helm 圖表后,您可以查看日志kubectl logs -f jenkins-7c444fc67-vkcrk -c copy-default-config您將看到如下日志:

Downloading plugin: ace-editor from test.host.local/plugins/ace-editor/1.1/ace-editor.hpi
Downloading plugin: ant from test.host.local/plugins/ant/1.11/ant.hpi
Downloading plugin: apache-httpcomponents-client-4-api from test.host.local/plugins/apache-httpcomponents-client-4-api/4.5.10-2.0/apache-httpcomponents-client-4-api.hpi
Downloading plugin: antisamy-markup-formatter from test.host.local/plugins/antisamy-markup-formatter/2.0/antisamy-markup-formatter.hpi
Downloading plugin: authentication-tokens from test.host.local/plugins/authentication-tokens/1.4/authentication-tokens.hpi
Downloading plugin: branch-api from test.host.local/plugins/branch-api/2.5.6/branch-api.hpi
Downloading plugin: aws-java-sdk from test.host.local/plugins/aws-java-sdk/1.11.799/aws-java-sdk.hpi
Downloading plugin: bootstrap4-api from test.host.local/plugins/bootstrap4-api/4.5.0-1/bootstrap4-api.hpi
Downloading plugin: analysis-core from test.host.local/plugins/analysis-core/1.96/analysis-core.hpi

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM