Your first Jenkins Job
Go to Jenkins top page, select "New Job", then choose "Build a free-style software project". This job type consists of the following elements:
- Optional SCM, such as CVS or Subversion where your source code resides.
- Optional triggers to control when Jenkins will perform builds.
- Some sort of build script that performs the build (ant, maven, shell script, batch file, etc.) where the real work happens
- Optional steps to collect information out of the build, such as archiving the artifacts and/or recording javadoc and test results.
- Optional steps to notify other people/systems with the build result, such as sending e-mails, IMs, updating issue tracker, etc.
Required files
General Tab
- Project Name
Set a name for this project.
Source Code Management Tab
- Repositories
Select "Git", add your Repository URL and your credentials. - Branches to build
Type the branch you want to build.
Build Triggers Tab
Check "Build when a change is pushed to TFS/Team Services", this will build when master branch get updated.
You must configure the Hook on your Git Repository, all documentation here
Build Environment
Check "Inject environment variables to the build process"
Properties file path
Useful for save all environment variables in a file. The file format must be the standard Java property file formatProperties Content
Insert a set of key/ value (one per line) environment variable. KEY=VALUE
Check "Inject passwords to the build as environment variables"
- Job passwords
Define job passwords and inject them as environment variables. (All values will remain encrypted).
Build tab
All steps will execute one by one.
Add one "Execute shell script on remote host using ssh" step.
- "SSH Site"
Select the ssh site. - "Command"
Add all commands you want to run on specified machine.
Post-build Actions
You can use that tab if you need to run something after the build.