Skip to content

Setting up Jenkins on IBM i #43

@worksofliam

Description

@worksofliam

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions