User Tools

Site Tools


jenkins_setup

Jenkins setup for Web-Deployment

Project build steps

  1. GIT: Clone repository
  2. Shell script for build itself
    1. Delete '.git' files
    2. Delete unnecessary files
    3. Upload changed files to remote using rsync
  3. Do some fancy stuff to let DEVs know about the build state

Create Jenkins Project Template

Tomcat is running as “tomcat” user

Make sure you have a working SSH connection using a public key

On local machine (Jenkins installation)

Create key:

ssh-keygen -t rsa -f /home/tomcat/.ssh/YOUR_KEY_FILE

Copy public key:

cat /home/tomcat/.ssh/YOUR_KEY_FILE.pub

On remote/destination machine

Login via SSH as the user you want to use for public key authentication

Edit authorized_keys and add YOUR_KEY_FILE.pub content to it

nano ~/.ssh/authorized_keys

Template setup

Login to Jenkins and click “New Item”

  • Item name: set a name without spaces
  • Choose “Freestyle project”
  • If you want to copy a existing project set the name of the project you want to copy in “Copy existing Item”
  • Source Code Management: Select GIT
    • Set “Repository URL
    • Credentials: Choose user, setup in Jenkins → Credentials
    • Branches to build: */master
  • Build: Add Build Step → Execute shell (Make sure you have specified “Shell executable” in global config)
jenkins_setup.txt · Last modified: 2014/09/17 10:28 by admin