Skip to content

Jenkins Node Build for EMS

Jenkins Node Build for EMS rhel8 environment

1. Java installation

yum install java-17-openjdk -y

2. Fapolicyd security setting

vi /etc/fapolicyd/rules.d/20-wbxbuilds.rules  
chown root:fapolicyd /etc/fapolicyd/rules.d/20-wbxbuilds.rules  
chmod 644 /etc/fapolicyd/rules.d/20-wbxbuilds.rules  
systemctl restart fapolicyd
cat /etc/fapolicyd/rules.d/20-wbxbuilds.rules
# The following paths are for nomal operations.
# If you need to operate path out of the followings, ADD path here.
allow perm=any uid=50290 : dir=/home/wbxbuilds/
allow perm=any uid=50290 : dir=/usr/bin/
allow perm=any uid=50290 : dir=/usr/share/
allow perm=any uid=50290 : dir=/usr/local/bin/
allow perm=any uid=50290 : dir=/usr/local/lib64/
allow perm=any uid=50290 : dir=/lib64/

# The following pathes are for operating git
allow perm=any uid=50290 : dir=/usr/share/git-core/

# The following pathes are for jenkins.
allow perm=any uid=50290 : dir=/jenkins/
allow perm=any uid=50290 : dir=/jenkins/workspace/
allow perm=any uid=50290 : dir=/home/wbxbuilds/jenkins/workspace/

# The following path is for rpmbuild.
allow perm=any uid=50290 : dir=/var/tmp/

# The following path is for /tmp/ usages
allow perm=any uid=50290 : dir=/tmp/

# The following patch is for ansible
allow perm=any uid=50290 : dir=/home/wbxbuilds/.ansible/

allow perm=any uid=50290 : dir=/usr/lib

allow perm=open exe=/ : dir=/usr/lib64/ all trust=1

3. Create jenkins build folder

mkdir jenkins
cd jenkins
mkdir workspace
chown -R wbxbuilds:wbxbuilds /jenkins
chmod -R 755 /jenkins

4. Create SSH key creat for Jenkins service connection

ssh-keygen -m PEM -t rsa -b 4096 -C "mthf1rhel8-build-01@webex.com"
touch ~/.ssh/authorized_keys
cat ~/.ssh/id_rsa.pub >> ~/.ssh/authorized_keys
chmod 700 ~/.ssh
chmod 400 ~/.ssh/id_rsa
chmod 644 ~/.ssh/id_rsa.pub
chmod 600 ~/.ssh/authorized_keys
cat ~/.ssh/id_rsa
cat ~/.ssh/id_rsa.pub

5. Set SSH key into GitHub and Jenkins service

5.1. Set SSH key into github

https://sqbu-github.cisco.com/settings/ssh/new Copy ssh-rsa into key box.

5.2 Set SSH key into Jenkins service

Need create a ticket to Jenkins team and work with the support manber via Webex Teams.
https://codeops.cisco.com/case
Click [All Areas]:
Impacted Area: Jenkins
Select a category: Dedicated build Agent (create a new jenkins node)
Please select a location: GPK
Jenkins Folder/Job Url: https://engci-jenkins-gpk.cisco.com/jenkins/job/team_mas/
Host Name: [Jenkins build server’s Host Name]
Java Installation path (JDK11 or above required): JDK17
Workspace path on server Jenkins can utilize (Recommended /opt/Jenkins): /Jenkins/workspace
Contact Preferences: Webex Teams

Copy the #4 id_rsa to Jenkins supports and they will config the jenkins connection with zhe build node.

6. Git installation and configuration

Install git and test the github connection with the build node

yum install git
git ls-remote -h ssh://git@bitbucket-eng-chn-sjc1.cisco.com:7999/cctgcloud/cloudtools-ems.git

7. Set up depandents components

yum install gcc --allowerasing -y
mount -t proc proc /proc
mount -t sysfs sysfs /sys
yum install sshd -y
yum install pam