Jenkins offline installation and configuration procedure
1. Summary
This procedure provides a complete guide for installing Jenkins offline on a Windows machine as part of the T4C installation process. It is intended for deployments where the target server hosting the Scheduler has no internet access. For context on the execution of this procedure, please refer to the following documents:
This procedure consists of four steps:
-
The first step describes the prerequisites necessary for an offline installation of Jenkins.
-
The second step involves downloading, preparing, and packaging the necessary assets for installation from a host that is connected to the internet.
-
The third step involves deploying the scheduler server (Jenkins) on the offline host using the assets packaged in the previous step.
-
The last step involves preparing for needed plugin installation through an automatic procedure.
2. Prerequisites
To complete this procedure, you will need two hosts:
-
Target_Host: This is the host on which Jenkins will be installed. It must be offline (i.e., not connected to the internet) and must have already been prepared using the T4C procedure, with Capella already deployed (see Client Installation section). Admin rights are required on this host to install Jenkins. The following variable must be known on this host:
-
TEAMFORCAPELLA_APP_HOME: This variable contains the absolute path of the T4C and Capella installation folder (which contains the folders capella, lic-server, samples, server, tools, updateSite, etc.). Example:
C:\T4C\
-
WORKING_PATH: This variable contains the absolute path of a temporary folder used to copy and extract assets.
This host need to have a tools to create a
zip
archive (Example:7-zip
) -
Windows integrated (un)archiver tools is not recommended for managing Capella related archives. Contrary to recent versions of the File Explorer, the tool is not able to manage long file paths yet. |
If administrator rights are not available on the Target_Host, an alternative is available in section Non administrator alternative. |
-
Download_Station: This is the workstation from which you will download all the elements needed to install the Jenkins server. Admin rights are not required on this host. This host must be connected to the internet and have access to the following resources:
-
Jenkins MSI installer download URL: https://get.jenkins.io/windows-stable/
-
Jenkins plugins download URL: https://updates.jenkins.io/download/plugins/
The following variable must be known on this host:
-
T4C_BUNDLE: Local path of the T4C bundle extracted on the host.
-
DDL_PATH: Local path of an empty folder used to download assets. This folder must have the name
t4c_jenkins_assets
This host need to have a tools to extract a
zip
archive -
-
On the procedure, some values are used between chevron. This values are described here :
-
JENKINS_VERSION: version of Jenkins to use, we recommend to use the version on which Team for Capella has been tested and validate: the LTS version 2.440.3. If you choose to deploy a more recent version, we strongly recommend to use a release from the LTS (Long Term Support) stable releases stream available at Jenkins.io. In case of a newer LTS, it recommended to take the shortname plugin list. This list might be incomplete for a non tested version: some plugins might have renamed, or have new dependencies. They can me manually downloaded and installed afterwards. The errors while loading plugins will be displayed in Jenkins.
-
3. Procedure
3.1. Step 1: Check of prerequisites
-
On the Download_Station :
-
Check the access of the listed websites.
-
Download or get the Jenkins plugins list provided in the T4C bundle from the file
<T4C_BUNDLE>/tools/resources/scheduler/requiredPlugins_Jenkins_LTS_<*JENKINS_VERSION*>.txt
.
-
-
On the Target_Host :
-
Check that the available disk space is greater than 200 MB.
-
Create the folder DDL_PATH if it does not exist.
-
Create the folder DDL_PATH\plugins if it does not exist.
-
3.2. Step 2: Download assets
On the Download_Station :
-
Download the Jenkins MSI installer file from the url: https://get.jenkins.io/windows-stable/<*JENKINS_VERSION*>/jenkins.msi
-
Copy the downloaded jenkins.msi file on the folder DDL_PATH
The jenkins.msi file checksum (SHA-256) can be verified using the provided checksum given from the url: https://get.jenkins.io/windows-stable/<*JENKINS_VERSION*>/jenkins.msi.sha256 and the Windows command :
-
using cmd.exe:
certutil -hashfile jenkins.msi SHA256
-
using PowerShell:
Get-FileHash jenkins.msi
The signature of the jenkins.msi file can also be verified using the procedure described in the following url: https://www.jenkins.io/download/verify/
-
-
Download the needed plugins using the file
requiredPlugins_Jenkins_LTS_<*JENKINS_VERSION*>.txt
given in the T4C bundle on path<T4C_BUNDLE>\tools\resources\scheduler\
.These plugins can be manually downloaded using the URLs provided in the file.
The plugins download step can be automated using this PowerShell script:
# Set the path to the file containing the URLs $url_file = "C:\Path\To\requiredPlugins_Jenkins_LTS_.*.txt" # Set the directory where the downloaded files will be saved $output_directory = "C:\Path\To\DDL_PATH\plugins" # Read the contents of the URL file and store each URL in an array $url_array = Get-Content $url_file | Where-Object { $_ -notmatch "^\s*#.*" -and $_ -ne "" } # Iterate through the array and download each file foreach ($url in $url_array) { $output_file = Join-Path $output_directory ([System.IO.Path]::GetFileName($url)) Invoke-WebRequest $url -OutFile $output_file }
To execute this script, copy it in a file with the ".ps1" file and adapt the file paths. On execute, if you have an error that the script "cannot be loaded because running scripts is disabled on this system", then you need to execute the command "Set-ExecutionPolicy RemoteSigned" in PowerShell.
Check that the number of resulting plugins in the target folder corresponds to the number of plugins in the list.
The checksum (SHA-256) of each plugin file can be verified using the provided checksum given on the plugin description page for the selected version. (https://updates.jenkins.io/download/plugins/<plugin name>/) and the windows command:
-
using cmd.exe:
certutil -hashfile <plugin file>.hpi SHA256
. -
using PowerShell:
Get-FileHash <plugin file>.hpi
.
-
-
Package the DDL_PATH folder on a zip archive named
t4c_jenkins_assets.zip
.The zip archive generated must contain the folder
t4c_jenkins_assets
, and inside this folder, all downloaded assets. -
Get the checksum of this archive with the following Windows commands:
-
using cmd.exe:
certutil -hashfile t4c_jenkins_assets.zip SHA256
. -
using PowerShell:
Get-FileHash t4c_jenkins_assets.zip
.
-
-
Copy the generated zip file on a media available from the Target_Host.
3.3. Step 3: Deploy offline Jenkins
On the Target_Host :
-
Copy the previously generated zip from the media on the Target_Host on the WORKING_PATH.
-
Extract the zip archive on the WORKING_PATH to have the folder structure :
WORKING_PATH * t4c_jenkins_assets ** jenkins.msi ** plugins *** <plugin name>.hpi *** <plugin name>.hpi *** ...
-
Install Jenkins by running the jenkins.msi file following the official documentation: https://www.jenkins.io/doc/book/installing/windows/
There are some recommendations for this Jenkins installation :
-
Use the port 8036 for the service.
-
Use the JRE provided by the T4C deployment:
TEAMFORCAPELLA_APP_HOME\capella\jre\
. -
Activate the Start Service.
-
Activate the Firewall Exceptioin.
On the Post-installation setup wizard :
-
Use the port 8036 for the url to access your Jenkins instance.
-
During Jenkins installation, choose the option to "Skip Plugin Installations" to indicate that the installation is offline.
-
3.4. Step 4: Prepare plugins installation
On the Target_Host :
-
Create a
TEAMFORCAPELLA_APP_HOME\tools\resources\scheduler\plugins
folder -
Populate this folder by copying all
WORKING_PATH\t4c_jenkins_assets\plugins\*.hpi
files in it. -
Generate the plugins file list
TEAMFORCAPELLA_APP_HOME\tools\resources\scheduler\requiredPlugins_Jenkins_local.txt
with the local relative path fromTEAMFORCAPELLA_APP_HOME\tools\resources\scheduler
path of each plugin file. The file create must have this look :C:\...\plugins\<plugin name>.hpi C:\...\plugins\<plugin name>.hpi C:\...\plugins\<plugin name>.hpi ...
This file can be created with this PowerShell command
# Set the path to the folder containing the plugins files $folder_path = "*TEAMFORCAPELLA_APP_HOME*\tools\resources\scheduler\plugins" # Set the target file that list the plugins files $output_file = "*TEAMFORCAPELLA_APP_HOME*\tools\resources\scheduler\requiredPlugins_Jenkins_local.txt" # List files and generate the list on the file Get-ChildItem $folder_path -File | foreach { "file:" + $_.FullName } | Set-Content $output_file
-
Update the plugin installation script to use this newly generated plugin file list :
-
Edit the file
TEAMFORCAPELLA_APP_HOME/tools/resources/scheduler/install-TeamForCapellaAppsOnJenkins.properties
-
replace the variable PLUGINS_LIST_FILE value with
requiredPlugins_Jenkins_local.txt
instead ofrequiredPlugins_Jenkins_LTS_<*JENKINS_VERSION*>.txt
-
All needed plugins will be now installed by the install-TeamForCapellaAppsOnJenkins.bat
script on the System Administrator Guide > Jenkins Installation > Install Jenkins plugins and jobs required for Team for Capella section.
The execution of the
|
4. Non administrator alternative
This section explain how to adapt the previous procedure to use a Target_Host without administrative rights.
In this alternative, there are some constraints :
|
On this alternative, define a folder to store the Jenkins home: JENKINS_HOME
on an availlable space to the used users.
4.1. Step 2: Download assets
-
Replace the download of the jenkins.msi file by the WAR alternative: https://get.jenkins.io/war-stable/<*JENKINS_VERSION*>/jenkins.war
The checksum of this file is available from the url https://get.jenkins.io/war-stable/<*JENKINS_VERSION*>/jenkins.war.sha256
4.2. Step 3: Deploy offline Jenkins
-
Prepare the Jenkins execution folder :
Create the folder
TEAMFORCAPELLA_APP_HOME\jenkins
-
Copy the
jenkins.war
file on this folder*TEAMFORCAPELLA_APP_HOME\jenkins
-
Create the Jenkins temporary folder :
-
Create the folder
TEAMFORCAPELLA_APP_HOME\jenkins\temp
-
-
Create a
startScheduler.bat
script to start the Jenkins product with the following content (prepared using System Administrator Guide > Jenkins Installation)REM Set env var needed to run Jenkins SET JENKINS_HOME=*TEAMFORCAPELLA_APP_HOME*\jenkins SET PATH=%PATH%;*TEAMFORCAPELLA_APP_HOME*\capella\jre\bin REM Start Jenkins webserver java -jar *TEAMFORCAPELLA_APP_HOME*\jenkins.war -Djava.io.tmpdir=%JENKINS_HOME%\temp --httpPort=8036 --extractedFilesFolder="%JENKINS_HOME%\temp
-
To start the Jenkins server, run the script startScheduler.bat from a Windows terminal (cmd.exe or PowerShell)
Continue this step by following the "Post-Installation" recommendations of the standard procedure. |
4.3. Step 4: Prepare plugins installation
This step is not affected by the use of a non-administrator user.