ControlTier CI Loop
From ControlTier
Setting up the ControlTier Continuous Integration Build
Contents |
Assumptions:
JAVA_HOME=/usr/lib/jvm/java-1.6.0 as a result of the installation of rundeck and we will be using this java for building, running Jenkins, and running Rundeck
This CI Environment will be using Jenkins for the Continuous Integration.
rundeck documentation will be added for further automation with respect to the ControlTier release to SourceForge
Install rundeck (from the downloads):
- Install the Rundeck yum repo configuration:
[root@build ~]# rpm -Uvh http://rundeck.org/latest.rpm Retrieving http://rundeck.org/latest.rpm Preparing... ########################################### [100%] 1:rundeck-repo ########################################### [100%]
- Install Rundeck:
[root@build ~]# yum install -y rundeck Loaded plugins: fastestmirror Loading mirror speeds from cached hostfile Setting up Install Process Resolving Dependencies --> Running transaction check ---> Package rundeck.noarch 0:1.2.0-0.43 set to be updated --> Processing Dependency: rundeck-config for package: rundeck --> Running transaction check ---> Package rundeck-config.noarch 0:1.2.0-0.43 set to be updated --> Finished Dependency Resolution Dependencies Resolved ================================================================================================================================================================================================= Package Arch Version Repository Size ================================================================================================================================================================================================= Installing: rundeck noarch 1.2.0-0.43 rundeck-release 44 M Installing for dependencies: rundeck-config noarch 1.2.0-0.43 rundeck-release 7.4 k Transaction Summary ================================================================================================================================================================================================= Install 2 Package(s) Update 0 Package(s) Remove 0 Package(s) Total download size: 44 M Downloading Packages: (1/2): rundeck-config-1.2.0-0.43.noarch.rpm | 7.4 kB 00:00 (2/2): rundeck-1.2.0-0.43.noarch.rpm | 44 MB 00:07 ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- Total 5.7 MB/s | 44 MB 00:07 Running rpm_check_debug Running Transaction Test Finished Transaction Test Transaction Test Succeeded Running Transaction Installing : rundeck 1/2 Installing : rundeck-config 2/2 Installed: rundeck.noarch 0:1.2.0-0.43 Dependency Installed: rundeck-config.noarch 0:1.2.0-0.43 Complete!
- Configure the rundeck user account for appropriate access privileges, become the rundeck user and verify access:
[[root@build ~]# usermod -G root,wheel rundeck [root@build ~]# groups rundeck rundeck : rundeck root wheel [root@build ~]# grep ^%wheel /etc/sudoers %wheel ALL=(ALL) NOPASSWD: ALL [root@build ~]# chmod 440 /etc/shadow [root@build ~]# su - rundeck [rundeck@build ~]$ sudo id uid=0(root) gid=0(root) groups=0(root),1(bin),2(daemon),3(sys),4(adm),6(disk),10(wheel)
- Create the a public/private key pair for the rundeck user:
[rundeck@build ~]$ ssh-keygen -t dsa -N '' Generating public/private dsa key pair. Enter file in which to save the key (/home/rundeck/.ssh/id_dsa): Your identification has been saved in /home/rundeck/.ssh/id_dsa. Your public key has been saved in /home/rundeck/.ssh/id_dsa.pub. The key fingerprint is: 5c:bf:e9:6e:2b:19:54:c8:62:64:6f:a8:ed:38:e1:1c rundeck@build.ctier.dtosolutions.com
Install Jenkins using the redhat rpm (from the jenkins downloads):
- Download the rpm and install (example references version 1.403-1.1)
[rundeck@build ~]$ wget -O /tmp/jenkins.rpm http://jenkins-ci.org/latest/redhat/jenkins-1.403-1.1.noarch.rpm --2011-03-24 13:23:36-- http://jenkins-ci.org/latest/redhat/jenkins.rpm Resolving jenkins-ci.org... 192.18.49.133 Connecting to jenkins-ci.org|192.18.49.133|:80... connected. HTTP request sent, awaiting response... 302 Found Location: http://jenkins-ci.org/downloads/redhat/jenkins-1.403-1.1.noarch.rpm [following] --2011-03-24 13:23:37-- http://jenkins-ci.org/downloads/redhat/jenkins-1.403-1.1.noarch.rpm Connecting to jenkins-ci.org|192.18.49.133|:80... connected. HTTP request sent, awaiting response... 200 OK Length: 38821047 (37M) [text/plain] Saving to: `/tmp/jenkins.rpm' 100%[=======================================================================================================================================================>] 38,821,047 962K/s in 40s 2011-03-24 13:24:16 (957 KB/s) - `/tmp/jenkins.rpm' saved [38821047/38821047] [rundeck@build ~]$ rpm -qp /tmp/jenkins.rpm jenkins-1.403-1.1 [rundeck@build ~]$ sudo rpm -i /tmp/jenkins.rpm
- Adjust jenkins configuration to run as rundeck
[rundeck@build ~]$ sudo vi /etc/sysconfig/jenkins [rundeck@build ~]$ sudo grep JENKINS_USER /etc/sysconfig/jenkins JENKINS_USER="rundeck" [rundeck@build ~]$ sudo chown -R rundeck:rundeck /var/lib/jenkins [rundeck@build ~]$ sudo chown -R rundeck:rundeck /var/log/jenkins
- Optional, move /var/lib/jenkins to a decent storage partition:
[root@build lib]# pwd /var/lib [root@build lib]# mv jenkins /mnt [root@build lib]# ln -s /mnt/jenkins
- Start the Jenkins server:
[rundeck@build ~]$ sudo /etc/rc.d/init.d/jenkins start Starting Jenkins [ OK ]
- Configure Jenkins to use local account authentication and add local account(s) for Jenkins job management
- Configure Jenkins via the UI, example url: http://localhost:8080/configure and check "Enable security", select "Unix user/group database" and for authorization, select "Logged-in users can do anything" and Save
- Add local accounts if necessary:
[rundeck@build ~]$ sudo /usr/sbin/useradd chuck [rundeck@build ~]$ sudo passwd chuck Changing password for user chuck. New UNIX password: Retype new UNIX password: passwd: all authentication tokens updated successfully.
- Verify ability to login
Configure CI jobs:
Refer to the jenkins utility script loadHudsonJob.sh which automates jobs in jenkins config xml format Additionally, refer to the config xml files in hudson ci where the following config xml files are:
ControlTier-3.6.1.zip.config.xml ControlTier-3.6.1-client.rpm.config.xml ControlTier-3.6.1-server.rpm.config.xml
- Load ControlTier jobs:
[chuck@build controltier-3-6-support chuck]$ cat ControlTier-3.6.1.zip.config.xml | ./loadJob.sh ControlTier-3.6.1.zip chuck myPassword [chuck@build controltier-3-6-support chuck]$ cat ControlTier-3.6.1-client.rpm.config.xml | ./loadJob.sh ControlTier-3.6.1-client.rpm chuck myPassword [chuck@build controltier-3-6-support chuck]$ cat ControlTier-3.6.1-server.rpm.config.xml | ./loadJob.sh ControlTier-3.6.1-server.rpm chuck myPassword



