-
Notifications
You must be signed in to change notification settings - Fork 11
Jenkins
This wiki will guide you through the Jenkins setup and configuration required for InsightEdge projects.
Assuming you want a fixed version, not the latest one
Installing Jenkins as a service (Linux):
sudo wget -O /etc/yum.repos.d/jenkins.repo http://pkg.jenkins-ci.org/redhat-stable/jenkins.repo
sudo rpm --import https://jenkins-ci.org/redhat/jenkins-ci.org.key
sudo yum install jenkins-1.642.4-1.1Important! Do not install Jenkins into path that contains spaces
Operating Jenkins service:
sudo service jenkins start
sudo chkconfig jenkins on
sudo service jenkins restart
sudo service jenkins stopInsightEdge projects require next tools:
- Git:
install manually, append to PATH - JDK 1.8: Manage Jenkins > Configure System > JDK
- Maven 3.3.9: Manage Jenkins > Configure System > Maven, use
maven-3.3.9as a name - Scala 2.10.6:
install manually, we will add environment variable for it below - SBT 0.13.11:
install manually, we will add it as a tool below
And next environment variables:
| Name | Description / Example |
|---|---|
| SCALA_HOME | Scala 2.10.6 install folder /shared/scala/scala-2.10.6
|
| SPARK_DIST | Full path to Spark 1.6.0 .tgz /shared/spark/spark-1.6.0-bin-hadoop2.6.tgz
|
| XAP_DIST_HOME | Path to folder with XAP .zip files /shared/xap
|
Paths to XAP distributions are hardcoded into Jenkinsfile, e.g.
$env.XAP_DIST_HOME/gigaspaces-xap-premium-12.0.0-ga-b16000.zip.
This simplifies migration process to later XAP builds or releases.
Install plugins with Manage Jenkins > Manage Plugins > Available (tab) > Filter "{plugin name}" > Install:
- Git Plugin wiki
- Pipeline wiki
- Credentials Binding Plugin wiki
- GitHub Organization Folder Plugin wiki
- Custom Tools Plugin wiki
Generate GitHub access token with all permissions under repo.
At Jenkins Credentials > Global > Add Credentials > Advanced create insightedge-dev (use strictly this ID), enter token as a password.
With Custom Tools Plugin you can hook SBT as a custom build tool.
At Manage Jenkins > Configure System > Custom Tool add sbt-0.13.11, specify Installation directory without /bin, e.g., /home/user/sbt-0.13.11.
You can find details on Docker installation here: Integration tests.
Here is a trace of commands to set up and run Docker on AWS Linux instance:
sudo yum install -y docker
# allow user to call docker commands without sudo, relogin to update permissions
sudo usermod -a -G docker ec2-user
exit
# append "-H tcp://127.0.0.1:2375 -H unix:///var/run/docker.sock" to OPTIONS, used by maven plugin
sudo vi /etc/sysconfig/docker
# start and test docker
sudo service docker start
docker info
# allow jenkins to use docker
sudo usermod -a -G docker jenkins
sudo service jenkins stop
sudo service jenkins start
# create /download directory for temp project artifacts
sudo mkdir /download
sudo chmod 777 /download
sudo chmod a+rwx /downloadNow everything should be ready to build all InsightEdge projects with one configuration.
At Jenkins New Item > GitHub Organization:
- put
insightedgeatItem name, clickOK - in
Project Sourceschoose credentials, make sureOwnerisinsightedge - in
Advancedputrefs/pull/*intoExclude branches - in
Build triggersenableBuild periodicallywithH/5 * * * *cron
Important! Do not use spaces in project name
When you build the project now, it should find a bunch of InsightEdge repositories (maybe with additional branches) and start building them. Optionally, you can simplify the view: at insightedge > Edit View tick the Recurse in subfolders.
# interactive bash as jenkins
sudo su -s /bin/bash jenkins
# insightedge workspace
cd /var/lib/jenkins/workspace/insightedge/insightedge
# delete all docker containers
docker rm $(docker ps -a -q)
# delete all docker images
docker rmi $(docker images -a -q)
# delete all files/folder except 'master'
ls | grep -v master | xargs rm -r
# free up space / for docker https://github.com/docker/docker/issues/18867
docker ps -qa | xargs docker inspect --format='{{ .State.Pid }}' | xargs -IZ fstrim /proc/Z/root/Add more space to Device Mapper's Pool: link (we seem to have loop-lvm configuration)
We free up the space every week with cron:
sudo crontab -l5 8 * * 7 /home/ec2-user/space_cleanup.sh