+91 700 483 5930   +91 810 584 3520    info@scmgalaxy.com
Sign In or Register
Not Registered Yet?

Join Now! It's FREE. Get full access and benefit from this site

Reset My password - Remind Me My username

Remember me
scmGalaxy logo
Build Management

Build Management (36)

Children categories

Apache Continuum (0)
Apache Continuum

Apache Continuum is an enterprise-ready continuous integration server with features such as automated builds, release management, role-based security, and integration with popular build tools and source control management systems. Whether you have a centralized build team or want to put control of releases in the hands of developers, Continuum can help you improve quality and maintain a consistent build environment.

Apache Continuum, a partner to Apache Maven, is a continuous integration server, which runs builds on a configurable schedule. Much like CruiseControl, Continuum emails developers when the build is broken, requesting that the culprit fix the problem. To add a project to Continuum, point to the pom.xml in the source control system, and it automatically does the rest:

  • Check out from source control
  • Run clean build
  • Deploy to integration server
  • Run unit tests


View items...
Bitbucket plugin is designed to offer integration between Bitbucket and Jenkins.

It exposes a single URI endpoint that you can add as a WebHook within each Bitbucket project you wish to integrate with. This single endpoint receives a full data payload from Bitbucket upon push (see their documentation), triggering compatible jobs to build based on changed repository/branch.
Step 1 - Install "Bitbucket Plugin" at your Jenkins
Step 2 - Add a normal Post as Hook to your Bitbucket repository (Settings -> Hooks) and use following url:
and if you have setup authentication on jenkins then URL must be like
https://USERNAME:This email address is being protected from spambots. You need JavaScript enabled to view it.:PORT/bitbucket-hook/
Step 3 - Configure your Jenkins project as follows:
Step 4 - Under build trigger enable Build when a change is pushed to BitBucket
Step 5 - under Source Code Management select GIT; enter your credentials and define Branches to build (like **feature/*)
Note 1 - Make sure to include the slash ('/') on the end of the URL or the hook won't work.
Note 2 - Please read the BitBucket Plugin info page as well https://wiki.jenkins.io/display/JENKINS/BitBucket+Plugin
Reference 1  
Reference 2 - Login issues with Jenkins url
These days in software industry the process of software development very much rely upon best practices of various tools. The software development teams use various tools like project management, release management , test management and various others. As we already discussed about these tools in our previous posts. But, today we are going to discuss about Build management tool. This is one of the most important tool which required in any kind of software development. In this article we are going to discuss about Top Build Management Tools.
But before that let's have a quick overview on Build management.
Build management is actually a process of collecting all the components in a software release, performing all the automated tasks to compile, build and test the system and then deploy onto the development and testing environments in preparation for staging. It has become an important part of software development in testing process.
But you can not simply do build management without tools. it is also important to ensure that tools are selected properly and thoroughly so that each of them provides the desired service.
So, without wasting any time let's have a look on top 10 build management tools
1. Apache Maven
Maven is an open source build management tool which is distributed under Apache License. It is basically used for Java projects. let's have a look on key feature of Maven tool
Key Features
  • Open source
  • Based on Project Object Model or POM
  • Release management and distribution publication
  • Coherent site of project information
  • Instant access to new features
  • Extensible with plugins
  • Works easily with multiple projects simultaneously
  • Simple project setup
2. Gradle


Gradle is also an open source build management tool which is distributed under Apache License. It is written in java and groovy supports cross platform. Let's have a look on key features

Key Features
  • Open source
  • Designed for multiple projects
  • Supports incremental builds
  • Rich API
  • Mature ecosystem of plugins
  • Ease of migration
  • First build integration tool
  • Declarative builds and build-by-convention
3. Apache Ant

Apache Ant is also an open source build automation tool which is distributed under Apache License. It is also a Java based build tool. Let's have a look on key features
Key Features
  • open source
  • Ease of Use
  • Independent Platform
  • Can execute test scripts and test suites
  • Can copy files to at different locations
  • Supports Junit 3, Junit 4, Testing etc.
  • Able to compile java based applications
  • Can check out the code from version control system (SVN, GIT, CVS etc).
4. MSBuild
MsBuild or Microsoft build tools as its name indicates it belongs to Microsoft which is written in C# and supports .Net framework and available under MIT license.
Key features
  • Able to build Visual Studio projects without Visual Studio IDE installed
  • Now bundled with Visual Studio
  • Multitargeting
  • Description language - XML
5. FinalBuilder
Finalbuilder is a build tool which supports Windows platform and it is developed by VSoft Technologies in the year 2000. It is available under Proprietary license.
Key Features
  • It can present your build process in a structured manner 
  • With FinalBuilder you don't need to edit xml, or  write scripts
  • Allows builds to be scheduled to run daily, weekly or whenever you wish
  • Extensive library of pre-written actions to automate every common task in build process
  • Integrated Debugging
  • Detailed Logging
  • Version Control Integration
Do you agree with this list? If not than feel free to respond in the comment box with your own take on the top build management tools. One more thing, I would like to add here, if you need help to learn all these build tools or DevOps courses than scmGalaxy can help you in this. scmGalaxy is a community of DevOps professionals who are well experienced in this domain. So, feel free to reach us.
Jenkins Remote access API Example
Jenkins provides machine-consumable remote access API to its functionalities. Currently it comes in three flavors:
JSON with JSONP support
Remote access API is offered in a REST-like style. That is, there is no single entry point for all features, and instead they are available under the ".../api/" URL where "..." portion is the data that it acts on.
For example, if your Jenkins installation sits at http://ci.jruby.org/, visiting http://ci.jruby.org/api/ will show just the top-level API features available – primarily a listing of the configured jobs for this Jenkins instance.
Or if you want to access information about a particular build, e.g. http://ci.jruby.org/job/jruby-base/lastSuccessfulBuild/, then go to http://ci.jruby.org/job/jruby-base/lastSuccessfulBuild/api/ and you'll see the list of functionalities for that build.
Remote API can be used to do things like these:
Retrieve information from Jenkins for programmatic consumption.
trigger a new build
create/copy jobs
Jobs with parameters, Also see Parameterized Build.
Simple example - sending "String Parameters":
curl -X POST JENKINS_URL/job/JOB_NAME/build \
  --data token=TOKEN \
  --data-urlencode json='{"parameter": [{"name":"id", "value":"123"}, {"name":"verbosity", "value":"high"}]}'
Check Jenkins Job Status via REST API
job_status=`curl https://jenkins/view/job/other-job/lastBuild/api/json | grep "\"result\":\"SUCCESS\""`
if [ -n "$job_status" ]
    # Run your script commands here
  echo "BUILD FAILURE: Other build is unsuccessful or status could not be obtained."
  exit 1
How to restart Jenkins manually?
To restart Jenkins manually, you can use either of the following commands:
(jenkins_url)/safeRestart - Allows all running jobs to complete. New jobs will remain in the queue to run after the restart is complete.
(jenkins_url)/restart - Forces a restart without waiting for builds to complete.

Environment variables and properties defined in jenkins

Jenkins Set Environment Variables

When a Jenkins job executes, it sets some environment variables that you may use in your shell script, batch command, Ant script or Maven POM 1. The following table contains a list of all of these environment variables.

Environment Variable Description
BUILD_NUMBER The current build number, such as "153"
BUILD_ID The current build id, such as "2005-08-22_23-59-59" (YYYY-MM-DD_hh-mm-ss, defunct since version 1.597)
BUILD_URL  The URL where the results of this build can be found (e.g. http://buildserver/jenkins/job/MyJobName/666/)
NODE_NAME The name of the node the current build is running on. Equals 'master' for master node.
JOB_NAME Name of the project of this build. This is the name you gave your job when you first set it up. It's the third column of the Jenkins Dashboard main page.
BUILD_TAG String of jenkins-${JOB_NAME}-${BUILD_NUMBER}. Convenient to put into a resource file, a jar file, etc for easier identification.
JENKINS_URL Set to the URL of the Jenkins master that's running the build. This value is used by Jenkins CLI for example
EXECUTOR_NUMBER The unique number that identifies the current executor (among executors of the same machine) that's carrying out this build. This is the number you see in the "build executor status", except that the number starts from 0, not 1.
JAVA_HOME If your job is configured to use a specific JDK, this variable is set to the JAVA_HOME of the specified JDK. When this variable is set, PATH is also updated to have $JAVA_HOME/bin.
WORKSPACE The absolute path of the workspace.
SVN_REVISION For Subversion-based projects, this variable contains the revision number of the module. If you have more than one module specified, this won't be set. 
CVS_BRANCH For CVS-based projects, this variable contains the branch of the module. If CVS is configured to check out the trunk, this environment variable will not be set.
GIT_COMMIT  For Git-based projects, this variable contains the Git hash of the commit checked out for the build (like ce9a3c1404e8c91be604088670e93434c4253f03) (all the GIT_* variables require git plugin)     
GIT_URL For Git-based projects, this variable contains the Git url (like This email address is being protected from spambots. You need JavaScript enabled to view it.:user/repo.git or [https://github.com/user/repo.git])
GIT_BRANCH  For Git-based projects, this variable contains the Git branch that was checked out for the build (normally origin/master) 


Promoted Build Plugin Environment Variables

If you are using the Promoted Build Plugin, you will have access to the following environment variables. This allows you to access information about your Jenkins build since certain environment variables stated above (such as BUILD_TAG now refer to the Promoted Build Plugin's job.

Environment Variable Replaces Description
PROMOTED_URL BUILD_URL The URL of the original Jenkins job that is involved with the promotion. BUILD_URL now refers to the Promotion's URL
PROMOTED_JOB_NAME JOB_NAME The name of the original Jenkins job that is involved with the promotion. JOB_NAME now refers to the Promotion's job's name
PROMOTED_NUMBER BUILD_NUMBER The Build Number of the job being promoted. BUILD_NUMBER now refer's the the Promotion Number
PROMOTED_ID BUILD_ID The Build ID (ex. "2005-08-22_23-59-59" (YYYY-MM-DD_hh-mm-ss) ) of the original Jenkins job. BUILD_ID now refer's to the Promotion's build ID.

System Properties

Name  ↓ Value   
awt.toolkit sun.awt.X11.XToolkit
com.sun.akuma.Daemon daemonized
executable-war /usr/lib/jenkins/jenkins.war
file.encoding UTF-8
file.encoding.pkg sun.io
file.separator /
java.awt.graphicsenv sun.awt.X11GraphicsEnvironment
java.awt.headless true
java.awt.printerjob sun.print.PSPrinterJob
java.class.path /usr/lib/jenkins/jenkins.war
java.class.version 52.0
java.endorsed.dirs /usr/lib/jvm/java-1.8.0-openjdk-
java.ext.dirs /usr/lib/jvm/java-1.8.0-openjdk-
java.home /usr/lib/jvm/java-1.8.0-openjdk-
java.io.tmpdir /tmp
java.library.path /usr/java/packages/lib/amd64:/usr/lib64:/lib64:/lib:/usr/lib
java.runtime.name OpenJDK Runtime Environment
java.runtime.version 1.8.0_111-b15
java.specification.name Java Platform API Specification
java.specification.vendor Oracle Corporation
java.specification.version 1.8
java.vendor Oracle Corporation
java.vendor.url http://java.oracle.com/
java.vendor.url.bug http://bugreport.sun.com/bugreport/
java.version 1.8.0_111
java.vm.info mixed mode
java.vm.name OpenJDK 64-Bit Server VM
java.vm.specification.name Java Virtual Machine Specification
java.vm.specification.vendor Oracle Corporation
java.vm.specification.version 1.8
java.vm.vendor Oracle Corporation
java.vm.version 25.111-b15
JENKINS_HOME /var/lib/jenkins
jna.loaded true
jna.platform.library.path /usr/lib64:/lib64:/usr/lib:/lib:/usr/lib64/mysql
jnidispatch.path /tmp/jna--1712433994/jna4147775405825940943.tmp
mail.smtp.sendpartial true
mail.smtps.sendpartial true
os.arch amd64
os.name Linux
os.version 3.10.0-514.el7.x86_64
path.separator :
sun.arch.data.model 64
sun.boot.class.path /usr/lib/jvm/java-1.8.0-openjdk-
sun.boot.library.path /usr/lib/jvm/java-1.8.0-openjdk-
sun.cpu.endian little
sun.font.fontmanager sun.awt.X11FontManager
sun.io.unicode.encoding UnicodeLittle
sun.java.command /usr/lib/jenkins/jenkins.war --logfile=/var/log/jenkins/jenkins.log --webroot=/var/cache/jenkins/war --daemon --httpPort=8080 --debug=5 --handlerCountMax=100 --handlerCountMaxIdle=20
sun.java.launcher SUN_STANDARD
sun.jnu.encoding UTF-8
sun.management.compiler HotSpot 64-Bit Tiered Compilers
sun.os.patch.level unknown
svnkit.http.methods Digest,Basic,NTLM,Negotiate
svnkit.ssh2.persistent false
user.country US
user.dir /
user.home /var/lib/jenkins
user.language en
user.name jenkins
user.timezone America/New_York

Environment Variables

Name  ↓ Value   
_ /etc/alternatives/java
HOME /var/lib/jenkins
LOGNAME jenkins
NLSPATH /usr/dt/lib/nls/msg/%L/%N.cat
PATH /sbin:/usr/sbin:/bin:/usr/bin
SHELL /bin/bash
USER jenkins
XFILESEARCHPATH /usr/dt/app-defaults/%L/Dt


Name  ↓ Version    Enabled    Pinned   
ace-editor 1.1 true false
ant 1.4 true false
antisamy-markup-formatter 1.5 true false
bouncycastle-api 2.16.0 true false
branch-api 1.11.1 true false
build-timeout 1.18 true false
cloudbees-folder 5.16 true false
credentials 2.1.10 true false
credentials-binding 1.10 true false
display-url-api 0.5 true false
durable-task 1.12 true false
email-ext 2.53 true false
external-monitor-job 1.7 true false
git 3.0.1 true false
git-client 2.2.0 true false
git-server 1.7 true false
github 1.25.1 true false
github-api 1.84 true false
github-branch-source 1.10.1 true false
github-organization-folder 1.5 true false
gradle 1.25 true false
handlebars 1.1.1 true false
icon-shim 2.0.3 true false
jacoco 2.1.0 true false
javadoc 1.4 true false
jira 2.3 true false
jobConfigHistory 2.15 true false
jquery 1.11.2-0 true false
jquery-detached 1.2.1 true false
junit 1.19 true false
ldap 1.13 true false
mailer 1.18 true false
mapdb-api true false
matrix-auth 1.4 true false
matrix-project 1.8 true false
maven-plugin 2.14 true false
momentjs 1.1.1 true false
pam-auth 1.3 true false
pipeline-build-step 2.4 true false
pipeline-graph-analysis 1.3 true false
pipeline-input-step 2.5 true false
pipeline-milestone-step 1.3 true false
pipeline-rest-api 2.4 true false
pipeline-stage-step 2.2 true false
pipeline-stage-view 2.4 true false
plain-credentials 1.3 true false
resource-disposer 0.3 true false
scm-api 1.3 true false
script-security 1.25 true false
sonar 2.5 true false
ssh-credentials 1.12 true false
ssh-slaves 1.12 true false
structs 1.5 true false
subversion 2.7.1 true false
thinBackup 1.9 true false
timestamper 1.8.7 true false
token-macro 2.0 true false
windows-slaves 1.2 true false
workflow-aggregator 2.4 true false
workflow-api 2.8 true false
workflow-basic-steps 2.3 true false
workflow-cps 2.23 true false
workflow-cps-global-lib 2.5 true false
workflow-durable-task-step 2.7 true false
workflow-job 2.9 true false
workflow-multibranch 2.9.2 true false
workflow-scm-step 2.3 true false
workflow-step-api 2.7 true false
workflow-support 2.12 true false
ws-cleanup 0.32 true false

Useful Plugins




The GitHub plugin for Jenkins is the most basic plugin for integrating Jenkins with GitHub projects. If you are a GitHub user, this plugin enables you to:
  • Schedule your build
  • Pull your code and data files from your GitHub repository to your Jenkins machine
  • Automatically trigger each build on the Jenkins server, after each Commit on your Git repository
This saves you time and lets you incorporate your project into the Continuous Integration (CI) process.

How to Start Working with the GitHub Plugin for Jenkins
Install the Github Jenkins plugin
Go to "Manage Jenkins" --> "Manage Plugins" --> "Available" Tab --> Search for "GitHub plugin" and install it.
Configure the plugin with github accounts and keys
Go to "Manage Jenkins" --> "Configure System" --> Locate "Github" section and "Add Github Server".

API URL - If you server is github.com, your "API URL" would be "https://api.github.com" Otherwise if you use GitHub Enterprise, specify its API endpoint here (e.g., https://ghe.acme.com/api/v3/).

Credentials - You can create your own personal access token in your account GitHub settings. 
Token should be registered with scopes: Refer https://github.com/settings/tokens/new.
Add credentials (your Github token), Apply and "Test Connection".

Open your Jenkins Project
a) Check the GitHub project checkbox and set the Project URL to point to your GitHub Repository

b) Under Source Code Management, check Git and set the Repository URL to point to your GitHub Repository
c) Under Build Triggers, check the “Build when a change is pushed to GitHub” checkbox
4. Install the Jenkins (GitHub plugin) and set a webhook to your Jenkins machine
a) From your GitHub repository, go to Settings and then to Integrations & Services
b) Click on Add Service and add ‘Jenkins (GitHub plugin)’
c) Set the Jenkins hook URL as the URL for your Jenkins machine, and add /github-webhook/

Congratulations! Every time you publish your changes to Github, GitHub will trigger your new Jenkins job.
Another Approach noted by suprakash
Actually if you do the web hook settings from Jenkins -> Github plugin configuration (mentioned above), you will still see webhooks get created in github. So , above two approaches basically doing the same thing.
I personally like it to create webhook from Github, because in this way you don't have to share or store github user info in jenkins.
Steps : 1. Login into Github (with Admin) 2. Go to the repository you want to hook with jenkins 3. Click on settings tab -> webhooks & services 4. Click on Add Webhook 5. Enter payload url : like : http://:8080/github-webhook/ 6. Select content type as json 7. you are done
Now you do the changes and commit , you will see jenkins build get trigger automatically. Don't forget to do the settings in jenkins jobs to start the build when push code in github.

Complete guide to use Jenkins CLI / Command line?
Run Jenkins build from command is very simple in Linux system. If you are using using windows, gitbash is a recommended which has bash shell in built. You can use windows command line as well. Jenkins has support to command line client that allows you to access Jenkins from command line.
To Trigger Jenkins build from command line some prerequisite are there
Jenkins service is running.
Enable security option under “Configure Global Security”
Go to jenkins dashboard in Home page ( e.g http://localhost:8080/ ) -> Manage Jenkins
-> Configure Global Security -> Click on “Enable security” checkbox
You can also configure “Access Control” and “Authorization” option in Global Security page.

Download Jenkins-cli.jar
Download Jenkins-cli.jar from http://<your_jenkins_server_url>/jnlpJars/jenkins-cli.jar. (Here <your_jenkins_server_url> is your respective Jenkins server URL (development or staging))
Go to http://<your_jenkins_server_url>/cli and build your command by following the instructions there.
How to login to Jenkins using commands
If your Jenkins requires authentication, use --username and --password or --password-file options to specify the credentials. To avoid doing this for every command, you can also use the login CLI command once (with the same credentials parameters), and after that you may use other commands without specifying credentials.
Whenever the CLI tries to to connect to the Jenkins server, it offers the before mentioned SSH keys. When the user has those keys but don't want use them to authenticate, preventing being prompted by the key's password, it's possible to use the -noKeyAuth argument. This way the CLI will never try to use the SSH keys available. failure to authenticate by itself does not constitute a fatal error. It will instead try to execute the command anyway, as the anonymous user.
Login Jenkins using username and Password
Jenkins allow us to trigger Jenkins build with any specific user, For that we have to pass username and password in command line.
$ java -jar "/tmp/kitchen/cache/jenkins-cli.jar" -s http://localhost:8080 who-am-i --username jenkins --password foobar
$ java -jar jenkins-cli.jar -s http://myjenkins help --username me --password mypassword
Login Jenkins using public keys
Starting 1.419 (which will be out July 4th), Jenkins CLI supports authentication based on the SSH key pair. Just like CloudBees DEV@cloud (or GitHub, or other similar sites), you interactively login from the web UI, then associate your public keys with your user account. Then CLI will silently authenticates itself using your ~/.ssh/id_rsa, ~/.ssh/id_dsa, or ~/.ssh/identity.
Login Jenkins using private keys
You can also pass the priate key as follows
To use the -i option the syntax is as follows:
$ java -jar jenkins-cli.jar -s http://myjenkins help -i ~/.ssh/id_rsa
$ java -jar jenkins-cli.jar [-s JENKINS_URL] [-i PRIVATE_KEY] command [options...] [arguments...]
For compatibility reasons, unless you use the -i option, 
Login Jenkins using initialAdminPassword
try user "admin" and password from "Jenkins\secrets\initialAdminPassword"
java -jar jenkins-cli.jar -s http://localhost:8080 who-am-i --username admin --password fe3f1e1624ea4be8873b7a35e28b24be
Login Jenkins using passphrase
Go to http://jenkins-serer:8085/user/admin/configure and set the passphrase in "SSH Public Keys" and use the same passphrase with jenkins commands.
E.g 1 - Getting help
The list of the available commands depends on the server you are talking to. Visit https://jenkins.example.com/cli or use 'help' command to list them all:
> java -jar jenkins-cli.jar -s https://jenkins.example.com help [command]
E.g 2 - Run Jenkins Build From Command Line
> java -jar jenkins-cli.jar -s http://<jenkins server>/ build build-name [-c] [-f] [-p] [-r N] [-s] [-v] [-w]
build-name : Name of the job to build
-c  : Check for SCM changes before starting the build, and if there's no change, exit without doing a build
-f  : Follow the build progress. Like -s only interrupts are not passed through to the build.
-p  : Specify the build parameters in the key=value format.
-s  : Wait until the completion/abortion of the command. Interrupts are passed through to the build.
-v  : Prints out the console output of the build. Use with -s
-w  : Wait until the start of the command
Example  - java -jar jenkins-cli.jar -s http://localhost:8080/ build 'my-project-build' --username roop --password roop
E.g 3 - List all jobs under the view: tools
$ java -jar jenkins-cli.jar -s http://jenkins/ list-jobs tools
E.g 4 - Get the configuration of the job: template
$ java -jar jenkins-cli.jar -s http://jenkins/ get-job template > template.xml
E.g 5 - Create a new job based on the configuration
$ java -jar jenkins-cli.jar -s http://jenkins/ create-job new_job_name < new_job_name.xml
E.g 6 - Run groovy script
$ java -jar jenkins-cli.jar -s http://jenkins/ groovy scripts/add_job_to_view.groovy
If there are any parameters in the script, just as:
import jenkins.model.*
if (args.length != 2 ) {
  println "Error on arguments!"
def jobName  = args[0] ?: 'a_job'
def viewName = args[1] ?: 'a_view'
println jobName + ' ' + viewName
def v = Jenkins.instance.getView(viewName)
def i = Jenkins.instance.getItemByFullName(jobName)
if (v && i) {
pass the parameters as:
$ java -jar jenkins-cli.jar -s http://jenkins/ groovy scripts/add_job_to_view.groovy JOB_NAME VIEM_NAME
E.g 7 - Build a job
$ java -jar jenkins-cli.jar -s http://jenkins/ build new_job_name
E.g 8 - Diable a job
$ java -jar jenkins-cli.jar -s http://jenkins/ disable-job new_job_name
E.g 8 - Passing parameters when triggering a job build
Job parameters are a very handy concept. Perhaps you've only ever used Jenkins or another CI system to automatically run builds when a remote SCM/git repo changes. You can also trigger builds manually from within Jenkins. And whilst you're doing that, your job can prompt for parameters to the build.
For example, we have a job named similar to "Deploy XYZ App". It has the git repo hardcoded in the job like a normal build, but when you press "Build", it shows a list of options: string fields, drop-down lists, etc.
When the job runs, you can use these values anywhere within your job's configuration. Its very cool.
But how to pass those same parameters via the CLI? You use the -p key=value flag for each parameter you want to pass.
So our finished product might look like:
$ java -jar jenkins-cli.jar -s http://myjenkins build 'Deploy XYZ App' -i ~/.ssh/id_rsa -s -v -p target_env=api.cloudfoundry.com -p branch=master
Commons problems
Operation timed out
$ java -jar jenkins-cli.jar -s YOUR_SERVER_URL help
Exception in thread "main" java.net.ConnectException: Operation timed out
at java.net.PlainSocketImpl.socketConnect(Native Method)
at java.net.PlainSocketImpl.doConnect(PlainSocketImpl.java:351)
at java.net.PlainSocketImpl.connectToAddress(PlainSocketImpl.java:213)
at java.net.PlainSocketImpl.connect(PlainSocketImpl.java:200)
at java.net.SocksSocketImpl.connect(SocksSocketImpl.java:432)
at java.net.Socket.connect(Socket.java:529)
at java.net.Socket.connect(Socket.java:478)
at java.net.Socket.<init>(Socket.java:375)
at java.net.Socket.<init>(Socket.java:189)
at hudson.cli.CLI.<init>(CLI.java:97)
at hudson.cli.CLI.<init>(CLI.java:82)
at hudson.cli.CLI._main(CLI.java:250)
at hudson.cli.CLI.main(CLI.java:199)
Check that the JNLP port is opened if you are using a firewall on your server. You can configure its value in Jenkins configuration. By default it is set to use a random port.
java.io.IOException: No X-Jenkins-CLI2-Port
java.io.IOException: No X-Jenkins-CLI2-Port among [X-Jenkins, null, Server, X-Content-Type-Options, Connection, X-You-Are-In-Group, X-Hudson, X-Permission-Implied-By, Date, X-Jenkins-Session, X-You-Are-Authenticated-As, X-Required-Permission, Set-Cookie, Expires, Content-Length, Content-Type]
at hudson.cli.CLI.getCliTcpPort(CLI.java:284)
at hudson.cli.CLI.<init>(CLI.java:128)
at hudson.cli.CLIConnectionFactory.connect(CLIConnectionFactory.java:72)
at hudson.cli.CLI._main(CLI.java:473)
at hudson.cli.CLI.main(CLI.java:384)
Suppressed: java.io.IOException: Server returned HTTP response code: 403 for URL: http://citest.gce.px/cli
at sun.net.www.protocol.http.HttpURLConnection.getInputStream0(HttpURLConnection.java:1840)
at sun.net.www.protocol.http.HttpURLConnection.getInputStream(HttpURLConnection.java:1441)
at hudson.cli.FullDuplexHttpStream.<init>(FullDuplexHttpStream.java:78)
at hudson.cli.CLI.connectViaHttp(CLI.java:152)
at hudson.cli.CLI.<init>(CLI.java:132)
... 3 more
Solution: Go to Manage Jenkins -> Configure Global Security -> "TCP port for JNLP agents": choose fixed or random
How to Trigger builds remotely in Jenkins?
1. Create a user - You need to create a user in jenkins using you would like to trigger a jenkins jobs from remote loction or script
How to create users in Jenkins?
Manage Jenkins --> Manage Users --> Create User
2. Assign a right privillage to the specific user?
How to assign privillage to the user?
Manage Jenkins --> Configure Global Security --> Enabled "Anyone can do anything"
Manage Jenkins --> Configure Global Security --> Configure "Matrix-based security" for the specific users and assign atleast following Permissions.
Overall - Read
Job - Build
Job - Read
Job - Workspace
3. Find out jenkins user "API Token"
How to find jenkins user "API Token"?
Click on the user name located at top right(e.g --> Configure --> Locate the "API Token" section.
4. Enabled "Trigger builds remotely" in Jenkins Job Configuration.
Click on the desired job --> Configure --> Locate the "Trigger builds remotely" under "Build Triggers" Tab
Enabled the check box of "Trigger builds remotely"
Provide some Authentication Token e.g - iFBDOBhNhaxL4T9ass93HRXun2JF161Z
$ Save
5. Formulate the command to run using curl. 
> curl --user userid:API-Token http://IP OR HOST:PORT/job/JOB_NAME/build?token=Authentication_Token
eg.curl --user admin1:91367cf0389eaf89669f74c9963c9fb3
Some of other formats which is being tried in google but need to be tested with specific users. there are working with "Anonymous"
> curl -X POST http://admin1:This email address is being protected from spambots. You need JavaScript enabled to view it..1:8080/job/ANT-BUILD/build?token=iFBDOBhNhaxL4T9ass93HRXun2JF161Z
> wget http://admin1:This email address is being protected from spambots. You need JavaScript enabled to view it..1:8080/job/ANT-BUILD/build?token=iFBDOBhNhaxL4T9ass93HRXun2JF161Z

> wget --auth-no-challenge --user=admin --password=5ad344f0518640f62d0483084bb889bc

If you are a Windows User!
‘gitbash’ is a program combined of git and bash. A bash is shell that runs commands once you type the name of command and press enter. :)
Download  the git bash from here https://git-scm.com/download/win and install it.
How to install Team Foundation Server 2015
We need to start installating few things....
Download the SQL Server 2016 Express installer (SQLServer2016-SSEI-Expr) on this page that, when executed, will present options to perform an installation or download media only.
Download - https://www.microsoft.com/en-us/download/details.aspx?id=52679
2. Install TFS 2015
Choose one of these installation options:
Install over the Internet:
On this page, choose the Download button.
Select the .exe option and then choose the Next button.
1. To install now, choose the Run button.
2. To download an installer that you can run later, choose the Save button. (When you install, the computer must be connected to the Internet.)
3. To create a local copy to install offline, choose the Save button, open a command prompt at that location and run the .exe with the /layout switch
To download an image to burn on a DVD:
On this page, choose the Download button.
Select the .iso option and then choose the Next button.
Choose the Save button to download a DVD5 ISO image so that you can burn a DVD later.
Download - https://www.microsoft.com/en-us/download/details.aspx?id=48260
3. Install Team Foundation Server 2015 Update 3
Team Foundation Server 2015 Update 3 provides a set of collaboration tools that work with your existing IDE or editor, so your team can work effectively on software projects of all shapes and sizes. Application Lifecycle Management (ALM), continuous integration, and DevOps tools help your team accomplish more, faster. Automate the software delivery process to seamlessly track work and project artifacts, including requirements, tasks, bugs, source code, and build and test results.
Download - https://beta.visualstudio.com/downloads/
For Step by Step on How to Install Team Foundation Server 2015, please refer the below videos.
Generate Jenkins Job Configuration Automatically?
Job DSL Plugin
The job-dsl-plugin allows the programmatic creation of projects using a DSL. Pushing job creation into a script allows you to automate and standardize your Jenkins installation, unlike anything possible before.
More - 
Multi-Branch Project Plugin
This plugin adds additional project types that create sub-projects for each branch using a shared configuration.
More - https://wiki.jenkins-ci.org/display/JENKINS/Multi-Branch+Project+Plugin
Job Generator Plugin
This plugin adds a new job type "Job Generator" which can generate new projects when executed.
More - https://wiki.jenkins-ci.org/display/JENKINS/Job+Generator+Plugin
Jenkins Job Builder
Jenkins Job Builder takes simple descriptions of Jenkins jobs in YAML or JSON format and uses them to configure Jenkins. You can keep your job descriptions in human readable text format in a version control system to make changes and auditing easier. It also has a flexible template system, so creating many similarly configured jobs is easy.
More - 
Generating New Jenkins Jobs From Templates and Parameterised Builds
We use Jenkins to run our builds in a continuously. This is great, but you still have to do a fair bit of configuration each time you set up a new job. If you have a fairly static set of builds this isn’t a problem. We found ourselves in a situation where we had to create a lot of very similar builds quite regularly. Creating a new job by hand and manually changing the 10 or so tiny little things in each build is a pain and error prone. So…automate that too!
Step 1: Installing Docker
# apt-get install docker (Ubuntu)
# yum install docker  (RHEL/CENTOS)
For more info, please following this http://www.scmgalaxy.com/scm/software-containers/how-to-install-docker-in-linux.html
Step 2:  First, pull the official jenkins image from Docker repository.
# docker pull jenkins
Step 3: Next, run a container using this image and map data directory from the container to the host; e.g in the example below /var/jenkins_home from the container is mapped to jenkins/ directory from the current path on the host. Jenkins 8080 port is also exposed to the host as 49001.

Mapping port 8080 on the host to the container (the web ui), port 50000 to port 50000 (for build agents). Run with `-p 50000:50000` so you can connect JNLP slaves. For port 50000. This is to handle connections from JNLP based build slaves. This will store the workspace in /var/jenkins_home. All Jenkins data lives in there including plugins and configuration.

> docker run -d -p 8080:8080 -p 50000:50000 jenkins
This will store the jenkins data in /your/home on the host. Ensure that /your/home is accessible by the jenkins user in container (jenkins user - uid 1000) or use -u some_other_user parameter with docker run.
> docker run -d -p 8080:8080 -p 50000:50000 -u root -v $PWD/jenkins:/var/jenkins_home jenkins 
Other Example:
docker run -d -p 49001:8080 -v $PWD/jenkins:/var/jenkins_home -t jenkins -u root

This will store the jenkins data in /your/home on the host. Ensure that /your/home is accessible by the jenkins user in container (jenkins user - uid 1000) or use -u some_other_user parameter with docker run. This information is also found in the Dockerfile. So all you need to do is to ensure that the directory $PWD/jenkins is own by UID 1000:
> mkdir jenkins
> chown 1000 jenkins
> docker run -d -p 49001:8080 -v $PWD/jenkins:/var/jenkins_home -t jenkins
How to see the Jenkins log?
> docker exec name tail -f /var/log/jenkins/jenkins.log
Where name = --name

Step 3:  Access to j=Jenkins
As we have successfully run Jenkins Container, we can browse Jenkins Web Interface using our Web Browser by pointint to http://ip-address:49001 or http://localhost:49001 according to the configuration.
  •  Start 
  •  Prev 
  •  1  2  3 
  •  Next 
  •  End 
Page 1 of 3