Jenkins
Used as an open-source scheduler ..

The following section is for Reference only.
Jenkins + plugins have been installed and configured.
Run update & upgrade (optional).
sudo apt update -y && sudo apt upgrade -yCreate a Jenkins folder.
cd
mkdir ~/JenkinsCreate docker-compose.yml
cd
cd ~/Jenkins
nano docker-compose.ymlservices:
jenkins:
image: jenkins/jenkins:lts
restart: always
privileged: true
user: root
ports:
- 9080:8080
- 50000:50000
container_name: jenkins-1
volumes:
- /home/pentaho/Jenkins/jenkins_configuration:/var/jenkins_home
- /var/run/docker.sock:/var/run/docker.sockSave.
Create jenkins container.
Verify the logs
Make a note of the password: 3d56d7ddc87c459ebaafe1117f7f56e7
You can also retrieve the password with:
Configure Jenkins
Access Jenkins UI.
Copy and paste the password.

Click 'Continue' & keep the default option 'Install suggested plugins'.


Create Admin User.
Username
admin
Password
Welcome123!
Full name
system admin

Save & Finish. You are now able to access Jenkins with the default admin account.

This section is for Reference only.
Best Practice is to configure a specific system account - Jenkins
Generate an SSH key. This key will allow the controller to access the agent via SSH.
Navigate to your Jenkins dashboard.
Log in as user: Jenkins

Go to
Manage Jenkinsoption in main menu and click onCredentialsbutton.

From the drop down select: Add Credentials

Fill in the form:

Kind
SSH Username with private key
id
jenkins
Description
jenkins ssh key
Username
jenkins - jenkins' user already exists by default in the jenkins_agent-1 container.
Private Key
select Enter directly and press the Add button to insert the content of your private key file at ~/.ssh/jenkins_agent
Paraphrase
fill your passphrase used to generate the SSH key pair.
Click on 'Create'.

Jenkins Agent on Docker
Run the command to start your first agent.
or you can modify the docker-compose.yml to include the agent and public key.
Bring the jenkins-1 container down.
Edit the docker-compose.yml
Add the ~/.ssh/jenkins_agent.pub - the public key that will authentiacte the connection to the agent.
Check that the Jenkins Docker Agent is up and running.

Configure the Agent
Navigate to your Jenkins dashboard.
Log in as user: Jenkins

Go to
Manage Jenkinsoption in main menu and click onNodesbutton.
Or click on the Set Up agent message.

Click on
New Nodebutton.

Enter the following details:

x

Log into Jenkins.
Password
Welcome123!
Click on 'Create a Job' or 'New Item'.
Provide a name - Periodic Build - for the item and then choose: 'Freestyle project' & click: 'OK'

Set the following project options - execute every 5 mins:
Source Management
Branches to build
Branch Specifier
**
Build Triggers
Build periodically
Schedule
H/5 * * * *
Build Steps
Execute shell
Command
curl -H "Content-Type: application/xml" -d @Job1.kjb -X PUT -u admin:password -i http://pentaho.pentaho.lab:8080/pentaho/api/repo/files/:public:Jenkins:Job1.kjb
curl -H "Content-Type: application/xml" -d @Transformation1.ktr -X PUT -u admin:password -i http://pentaho.pentaho.lab:8080/pentaho/api/repo/files/:public:Jenkins:Transformation1.ktr
curl -H "Content-Type: application/xml" -d @Transformation2.ktr -X PUT -u admin:password -i http://pentaho.pentaho.lab:8080/pentaho/api/repo/files/:public:Jenkins:Transformation2.ktr
Source Code Management

Build Triggers


Build Steps

Check the 'Build Status' in the Dashboard.

Click on a build

View the 'Console Ouput'.

Finally .. check the Pentaho Repository.


Log into Jenkins.
Password
Welcome123!
Click on 'New Item'.

Provide a name - Commit Build - for the item and then choose: 'Freestyle project' & click: 'OK'

Set the following project options - Git commit:
Source Management
Branches to build
Branch Specifier
**
Build Triggers
Build periodically
Schedule
H/5 * * * *
Build
Execute shell
Command
curl -H "Content-Type: application/xml" -d @Job1.kjb -X PUT -u admin:password -i http://pentaho.pentaho.lab:8080/pentaho/api/repo/files/:public:Jenkins:Job1.kjb
curl -H "Content-Type: application/xml" -d @Transformation1.ktr -X PUT -u admin:password -i http://pentaho.pentaho.lab:8080/pentaho/api/repo/files/:public:Jenkins:Transformation1.ktr
curl -H "Content-Type: application/xml" -d @Transformation2.ktr -X PUT -u admin:password -i http://pentaho.pentaho.lab:8080/pentaho/api/repo/files/:public:Jenkins:Transformation2.ktr
x
x
Last updated
Was this helpful?
