2

I am trying to deploy Jenkins using Helm on a Kubernetes Cluster behind a firewall. I have downloaded the Jenkins image and copied it to our internal repo. I am able to bring up Jenkins using this image from the internal repo. Is there a way to do the same for Plugins as well.

I am having hard time with plugin installation offline. I don't want to manually upload the .hpi files into the container every time or from the GUI. I am looking for more of an automated way where I can tell Jenkins which repo/location to look for the Jenkins plugins as well.

Typically we mention the plugins in the "installPlugins" section of values.yaml file, like below:

installPlugins:
    - kubernetes:1.18.2

Is there a way I can provide our entire repo/location path instead like:

installPlugins:
    - http:MY_INTERNAL_REPO/kubernetes:1.18.2

Basically, I am ok with downloading the plugins and copying them to a specific location. But I want helm to pick up plugins from this internal location automatically.

user3542540
  • 21
  • 1
  • 2

1 Answers1

2

You can specify custom URLs by export some variables in the copy-default-config container by edit your chart as follow:

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

Here is the description for each environment:

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

You can find more info here

Once when you add your URL and run the helm chart, you can check the logs kubectl logs -f jenkins-7c444fc67-vkcrk -c copy-default-config You will see logs like these:

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