Installation and Setup Jenkins for z OS - openmainframeproject/polycephaly GitHub Wiki

Some Jenkins plugin to be installed

Git plugin

Git plugin for the Git server being used. Our example is using BitBucket, so Bitbucket Plugin

Groovy plugin

IBM z/OS Connector

SSH agent plugin

SSH Slaves plugin

Jenkins configurations, directories are used in the samples

Global Tool Configuration

Git for z/OS path to Git executable on z/OS, /usr/lpp/tools/bin/git

Git for DBB path to Git executable on z/OS, /usr/lpp/IBM/dbb/bin/git-jenkins.sh

DBB_Groovy Groovy_Home, /usr/lpp/IBM/dbb/groovy-2.4.12

Manage Nodes

Name anything, maybe the name of the z/OS LPAR

Number of executors, how many Jenkins processes to run concurrently

Labels, zOS, is what is used in our sample

You can use either the Name or Label

By using Name, Jenkins will run on that specific LPAR

By using Label, Jenkins will run on any LPAR with this Label

Remote Root Directory, /usr/lpp/tools/jenkins

Launch method, Launch agent agents via SSH

If Host Key Verification Strategy = "Known host file Verification Strategy", then you will need to follow Jenkins documentation to get the SSH keys added to Jenkins

Port, the port on the z/OS LPAR where SSH is listening

Java Path, full path to the Java executable, /usr/lpp/java/J8.0_64/bin/java

JVM Options, -Dfile.encoding=utf-8 -Xnoargsconversion

default file encoding is utf-8

Don't convert the input arguments

Prefix Start Agent Command '. /usr/lpp/IBM/dbb/conf/gitenv.sh && export JAVA_HOME=/usr/lpp/java/J8.0_64/ && export IBM_JAVA_ENABLE_ASCII_FILETAG=ON && env &&' without the quotes

Note: there is dot as the first parameter.

/usr/lpp/IBM/dbb/conf/gitenv.sh, is the location on the z/OS LPAR for the DBB gitenv.sh script

JAVA_HOME, location of the Java directory

IBM_JAVA_ENABLE_ASCII_FILETAG, enable the ASCII file tag

env, display the environment variables at start up time.

Suffix Start Agent Command, ' -text', without the quotes

Tool Location

List of tool locations

Name: (Git) Git for z/OS
Home: /usr/lpp/IBM/dbb/bin/git-jenkins.sh

Sample start up log:

SSHLauncher{host='zOS Host name', port=22, credentialsId='Credential Token from Jenkins', jvmOptions='-Dfile.encoding=utf-8 -Xnoargsconversion', javaPath='/usr/lpp/java/J8.0_64/bin/java', prefixStartSlaveCmd='. /usr/lpp/IBM/dbb/conf/gitenv.sh && export JAVA_HOME=/usr/lpp/java/J8.0_64/ && export IBM_JAVA_ENABLE_ASCII_FILETAG=ON && env && ', suffixStartSlaveCmd=' -text', launchTimeoutSeconds=210, maxNumRetries=10, retryWaitTime=15, sshHostKeyVerificationStrategy=hudson.plugins.sshslaves.verifiers.KnownHostsFileKeyVerificationStrategy, tcpNoDelay=true, trackCredentials=true}
[01/31/19 12:13:36] [SSH] Opening SSH connection to 'zOS Host Name':22.
[01/31/19 12:13:39] [SSH] SSH host key matches key in Known Hosts file. Connection will be allowed.
[01/31/19 12:13:39] [SSH] Authentication successful.
[01/31/19 12:13:39] [SSH] The remote user's environment is:
@="sh"
ERRNO="0"
HOME=
IFS=" "
LINENO="0"
LOGNAME=
MAIL=
MAILCHECK="600"
OPTIND="1"
PATH="/bin"
PPID="67109137"
PS1="# "
PS2="> "
PS3="#? "
PS4="+ "
PWD=
RANDOM="1817"
SECONDS="0"
SHELL="/bin/sh"
SSH_CLIENT="'client IP address' 49150 22"
SSH_CONNECTION="'Jenkins Server IP address' 49150 'zOS Host IP Address' 22"
TZ="EST5EDT"
USER="UserID of SSH connection"
[01/31/19 12:13:39] [SSH] Starting sftp client.
[01/31/19 12:13:40] [SSH] Copying latest remoting.jar...
[01/31/19 12:13:40] [SSH] Copied 789,285 bytes.
Expanded the channel window size to 4MB
[01/31/19 12:13:40] [SSH] Starting agent process: . /usr/lpp/IBM/dbb/conf/gitenv.sh && export JAVA_HOME=/usr/lpp/java/J8.0_64/ && export IBM_JAVA_ENABLE_ASCII_FILETAG=ON && env && cd "/usr/lpp/tools/jenkins" && /usr/lpp/java/J8.0_64/bin/java -Dfile.encoding=utf-8 -Xnoargsconversion -jar remoting.jar -workDir /usr/lpp/tools/jenkins -text
**** Running /usr/lpp/IBM/dbb/conf/gitenv.sh ****
MAIL=/usr/mail/'UserID of SSH connection'
PATH=/bin:/usr/lpp/tools/bin
_TAG_REDIR_IN=txt
GIT_EXEC_PATH=/usr/lpp/tools/libexec/git-core
GIT_SHELL=/usr/lpp/tools/bin/bash
SSH_CLIENT='zOS Host IP Address' 49150 22
_BPXK_AUTOCVT=ON
SHELL=/bin/sh
IBM_JAVA_ENABLE_ASCII_FILETAG=ON
_CEE_RUNOPTS=FILETAG(AUTOCVT,AUTOTAG) POSIX(ON)
_=/bin/env
LOGNAME='SSH UserID'
LIBPATH=:/usr/lpp/tools/lib/perl5/5.22.0/os390/CORE/
GIT_TEMPLATE_DIR=/usr/lpp/tools/share/git-core/templates
_TAG_REDIR_OUT=txt
GIT_DISCOVERY_ACROSS_FILESYSTEM=1
USER='SSH UserID'
HOME='SSH UserID home'
TOOLS_HOME=/usr/lpp/tools
PERL5LIB=:/usr/lpp/tools/lib/perl5
SSH_CONNECTION='Jenkins Server IP address' 49150 'zOS Host IP address' 22
JAVA_HOME=/usr/lpp/java/J8.0_64/
TZ=EST5EDT
_TAG_REDIR_ERR=txt
MANPATH=:/usr/lpp/tools/man
Running in text mode
Jan 31, 2019 12:13:41 PM org.jenkinsci.remoting.engine.WorkDirManager initializeWorkDir
INFO: Using /usr/lpp/tools/jenkins/remoting as a remoting work directory
Both error and output logs will be printed to /usr/lpp/tools/jenkins/remoting
<===[JENKINS REMOTING CAPACITY]===><===[HUDSON TRANSMISSION BEGINS]===channel started
Remoting version: 3.28
This is a Unix agent
Jan 31, 2019 12:13:46 PM hudson.remoting.UserRequest perform
WARNING: LinkageError while performing UserRequest:jenkins.slaves.StandardOutputSwapper$ChannelSwapper@7148ff22
java.lang.UnsatisfiedLinkError: Native library (com/sun/jna/z/os-s390x/libjnidispatch.so) not found in resource path ([])
at com.sun.jna.Native.loadNativeDispatchLibraryFromClasspath(Native.java:962)
at com.sun.jna.Native.loadNativeDispatchLibrary(Native.java:922)
at com.sun.jna.Native.<clinit>(Native.java:190)
at hudson.util.jna.GNUCLibrary.<clinit>(GNUCLibrary.java:115)
at jenkins.slaves.StandardOutputSwapper$ChannelSwapper.swap(StandardOutputSwapper.java:60)
at jenkins.slaves.StandardOutputSwapper$ChannelSwapper.call(StandardOutputSwapper.java:45)
at jenkins.slaves.StandardOutputSwapper$ChannelSwapper.call(StandardOutputSwapper.java:39)
at hudson.remoting.UserRequest.perform(UserRequest.java:212)
at hudson.remoting.UserRequest.perform(UserRequest.java:54)
at hudson.remoting.Request$2.run(Request.java:369)
at hudson.remoting.InterceptingExecutorService$1.call(InterceptingExecutorService.java:72)
at java.util.concurrent.FutureTask.run(FutureTask.java:277)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1160)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:635)
at java.lang.Thread.run(Thread.java:811)
Agent successfully connected and online

Note: the error 'com/sun/jna/z/os-s390x/libjnidispatch.so' not found is normal. The z/OS Java doesn't contain the Oracle JNI classes. This will not cause any issues.

⚠️ **GitHub.com Fallback** ⚠️