Jenkins tip

Start Jenkins

java -jar jenkins.war

Run as background on Linux

nohup java -jar jenkins.war &

Jenkins will run at http://localhost:8080/

Configure Admin account

Manage Jenkins > Configure Global Security

Check: Enable security
Check: Project-based Matrix Authorization Strategy
Create a user "admin" in: User/group to add:
Check All rules for the user

Sign up a user with username "admin" above.
Log in with "admin".


Get token
- Login into Jenkins
- Go to http://JENKINS_URL:8080/user/YOUR_USER_ID/configure
- Show and get the API Token

Get the build status with curl

# Ubuntu - install the jq command-line JSON processor
sudo apt-get install jq

export JENKINS_URL="http://JENKINS_URL:8080/job/YOUR_JOB_NAME/lastCompletedBuild/api/json"
BUILD_STATUS=$(curl --silent --user ${USER}:${TOKEN} ${JENKINS_URL} | jq -r '.result')

Get build time with format
Example: Use the curl to get a job info or trigger it via HTTP. Get the recently build time to check for code change: 11-Jul-2015.16:30:54

Last Successful Build:


Last Stable Build:


Useful plugins

- This plugin adds a markup formatter that's unsafe but allows more powerful HTML manipulation.

- A buildstep wrapping any number of other buildsteps, controlling their execution based on a defined condition (e.g. BuildParameter).

Email Extension Plugin
- This plugin is a replacement for Jenkins's email publisher

Environment Injector Plugin
- This plugin makes it possible to set an environment for the builds.

Hudson Post build task
- This plugin allows to execute a batch/shell task depending on the build log output.

JUnit Plugin
- Allows JUnit-format test results to be published.

Multijob plugin
- This plugin is a MultiJob plugin.

Parameterized Trigger plugin
- This plugin lets you trigger new builds when your build has completed, with various ways of specifying parameters for the new build.

Post-Build Script Plug-in
- PostBuildScript makes it possible to execute a set of scripts at the end of the build.

Run Condition Plugin
- Core conditions to select whether to execute a build step or publisher. Used by the [Flexible Publish Plugin] and the [Conditional BuildStep Plugin].

Test Results Analyzer Plugin
- A plugin that shows history of test execution results in a tabular format.

TextFinder plugin
- This plugin is used to search for strings in workspace files. The outcome of this search can be used to mark the build as normal or failed.

Token Macro Plugin
- This plug-in adds reusable macro expansion capability for other plug-ins to use.