blog icon indicating copy to clipboard operation
blog copied to clipboard

Setting up Jenkins on IBM i

Open worksofliam opened this issue 5 years ago • 1 comments

I've been using Jenkins a lot lately and thought it'd be nice to share how to get Jenkins setup easily on your IBM i. I am using wget in this post, which is available through yum.

Installation

  1. use wget to download the Generic Java package (.war) from the Jenkins download page: wget http://mirrors.jenkins.io/war-stable/latest/jenkins.war
  2. Make sure java is on your path. For example, here is where Java is on my system:
bash-4.4$ echo $PATH
/QOpenSys/pkgs/bin:/QOpenSys/pkgs/lib/nodejs10/bin:/QOpenSys/usr/bin:/usr/ccs/bin:.:/usr/bin
bash-4.4$ which java
/QOpenSys/usr/bin/java
  1. Start Jenkins with the java command. Note here I am starting Jenkins on port 9090. If you don't provide that parameter it starts on port 8080:
bash-4.4$ java -jar jenkins.war --httpPort=9090
Running from: /home/BARRY/jenkins.war
webroot: $user.home/.jenkins
...
  1. You can then head to hostname:9090 to access Jenkins:

image

Keeping Jenkins running as a service

Using SBMJOB

  1. A very simple submit-job with a job-name will suffice.
SBMJOB CMD(QSH CMD('java -jar /home/BARRY/jenkins.war --httpPort=9091')) JOB(JENKINS)

Using pm2

  1. Make sure pm2 is setup.
  2. Create an ecosystem file for pm2 which calls Java and has the correct parameters to start Jenkins:
{
  "apps":[
  {
      "name":"jenkins",
      "cwd":".",
      "script":"/QOpenSys/usr/bin/java",
      "args":[
          "-jar",
          "jenkins.war",
          "--httpPort=9090"
      ],
      "exec_interpreter":"",
      "exec_mode":"fork"
   }
 ]
}
  1. Use the pm2 command to launch your ecosystem file, which will start Jenkins up.
bash-4.4$ pm2 start apps.json
[PM2][WARN] Applications jenkins not running, starting...
[PM2] App [jenkins] launched (1 instances)
┌──────────┬────┬─────────┬──────┬─────────┬─────────┬─────────┬────────┬─────┬────────┬───────┬──────────┐
│ App name │ id │ version │ mode │ pid     │ status  │ restart │ uptime │ cpu │ mem    │ user  │ watching │
├──────────┼────┼─────────┼──────┼─────────┼─────────┼─────────┼────────┼─────┼────────┼───────┼──────────┤
│ gonext   │ 1  │ 1.0.0   │ fork │ 0       │ stopped │ 25      │ 0      │ 0%  │ 0 B    │ barry │ disabled │
│ index    │ 0  │ 1.0.0   │ fork │ 0       │ stopped │ 0       │ 0      │ 0%  │ 0 B    │ barry │ disabled │
│ jenkins  │ 3  │ N/A     │ fork │ 1026587 │ online  │ 0       │ 0s     │ 0%  │ 0 B    │ barry │ disabled │
│ rpgfree  │ 2  │ 1.0.0   │ fork │ 18106   │ online  │ 0       │ 2M     │ 0%  │ 0 B    │ barry │ disabled │
└──────────┴────┴─────────┴──────┴─────────┴─────────┴─────────┴────────┴─────┴────────┴───────┴──────────┘
 Use `pm2 show <id|name>` to get more details about an app

worksofliam avatar Feb 19 '20 11:02 worksofliam

Hi, appreciate you left this post a few years back, but found it recently and used it to get Jenkins running on IBM i. However, having an issue where characters are showing up in a funny character set and apart from not being able to read them without getting the Hex code and translating, the unreadable characters seem to be causing errors in the build.

image

Do you know how we could set the encoding or CCSID for Jenkins to have the character set use UTF-8 or something readable?

josulli4 avatar Jun 15 '22 20:06 josulli4