Saturday, March 26, 2016

Jenkins and Nexus on OSX

https://wiki.jenkins-ci.org/display/JENKINS/Thanks+for+using+OSX+Installer
Read the part about Apple Java...

https://wiki.jenkins-ci.org/display/JENKINS/Thanks+for+using+OSX+Installer

Add some handy aliases to control Jenkins to your .bash_profile
alias jenkins_off='sudo launchctl unload /Library/LaunchDaemons/org.jenkins-ci.plist'

alias jenkins_on='sudo launchctl load /Library/LaunchDaemons/org.jenkins-ci.plist'

Jenkins uses a user named "jenkins" and on the Mac the jenkins home dir is /Users/Shared/Jenkins/Home.

Log in as jenkins from the command line
$ sudo su jenkins -
(no password required)

Setup the jenkins password
sudo passwd jenkins

There are other ways to set up Jenkins and git access but this is the easiest way I have found to do so. 

Create new ssh key that you will use to access git to /Users/Shared/Jenkins/.ssh
ssh-keygen
(DO NOT ADD A PASSWORD TO THE KEY)

Copy the public key to github in your profile


In the following Jenkins page create a new credential with your git username, the path to the ssh file in Jenkins, and NO password



Now make a new project or go to an existing project
Jenkins > > configuration

Source Code Management
Check if git can access the repo

git -c core.askpass=true ls-remote -h HEAD
(returns nothing on success)

**
http://obscuredclarity.blogspot.com/2012/04/continuous-integration-using-jenkins.html
Set up Jenkins security using the instructions from above.

Select this option


Skip to the instructions for the Java and Maven installation below at ****.

Set up the rest of Jenkins using the instructions above @**

****
https://gepreemacdev.wordpress.com/2012/07/20/step-configure-jenkins/
Note: set the MAVEN_HOME to:  /usr/local/Cellar/maven/3.2.5
(Not  /usr/local/Cellar/maven/3.2.5/libexec)
Change the version to match your systems maven version.


http://stackoverflow.com/questions/13512948/configuring-jenkins-email-notification-with-gmail
configure Jenkins to send email

From: https://support.google.com/accounts/answer/6010255
Below are the updated gmail SMTP server configuration :
Gmail SMTP server address: smtp.gmail.com
Gmail SMTP user name: Your full Gmail address (e.g. example@gmail.com)
Gmail SMTP password: Your Gmail password
Gmail SMTP port: 465
Gmail SMTP TLS/SSL required: yes
This configuration is working fine for me .
The above configuration didn't work becase of added security measures by google. An additional configuration is required in the Gmail account from which the mail is being triggered. This step authorizes apps like Jenkins to use the Gmail account.

https://support.google.com/accounts/answer/6010255

After this emails were triggered successfully

http://books.sonatype.com/nexus-book/reference/