我正试图使用Helm在防火墙后面的Kubernetes集群上部署Jenkins。我已经下载了詹金斯的图片,并将其复制到我们的内部仓库中。我可以使用内部回购中的这张图片提起詹金斯。插件也有同样的方法吗。
我在离线安装插件时遇到了困难。我不想每次手动将.hpi文件上传到容器中,也不想从GUI手动上传。我正在寻找一种更自动化的方式,我可以告诉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并运行舵图后,您可以查看日志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