$ java -jar jenkins-cli.jar -s http://localhost:8080/
Adds jobs to view.
Builds a job, and optionally waits until its completion.
Cancel the effect of the "quiet-down" command.
Clears the build queue.
Reconnect to a node(s)
Retrieves console output of a build.
Copies a job.
Create Credential by XML
Create Credentials Domain by XML
Creates a new job by reading stdin as a configuration XML file.
Creates a new node by reading stdin as a XML configuration.
Creates a new view by reading stdin as a XML configuration.
Validate a Jenkinsfile containing a Declarative Pipeline
Deletes build record(s).
Delete a Credential
Delete a Credentials Domain
Disables a job.
Disconnects from a node.
Enables a job.
Enables one or more installed plugins transitively.
Get a Credentials as XML (secrets redacted)
Get a Credentials Domain as XML
Dumps the job definition XML to stdout.
Dumps the node definition XML to stdout.
Dumps the view definition XML to stdout.
Executes the specified Groovy script.
Runs an interactive groovy shell.
Lists all the available commands or a detailed description of single command.
Import credentials as XML. The output of "list-credentials-as-xml" can be used as input here as is, the only needed change is to set the actual Secrets which are redacted in the output.
Installs a plugin either from a file, an URL, or from update center.
Performs automatic tool installation, and print its location to stdout. Can be only called from inside a build. [deprecated]
Mark the build to keep the build forever.
Dumps the changelog for the specified build(s).
Lists the Credentials in a specific Store
Export credentials as XML. The output of this command can be used as input for "import-credentials-as-xml" as is, the only needed change is to set the actual Secrets which are redacted in the output.
List Credentials Context Resolvers
List Credentials Providers
Lists all jobs in a specific view or item group.
Outputs a list of installed plugins.
Saves the current credentials to allow future commands to run without explicit credential information. [deprecated]
Deletes the credentials stored with the login command. [deprecated]
Reads stdin and sends that out as an e-mail.
Stop using a node for performing builds temporarily, until the next "online-node" command.
Resume using a node for performing builds, to cancel out the earlier "offline-node" command.
Quiet down Jenkins, in preparation for a restart. Don’t start any builds.
Discard all the loaded data in memory and reload everything from file system. Useful when you modified config files directly on disk.
Removes jobs from view.
Replay a Pipeline build with edited script taken from standard input
Restart a completed Declarative Pipeline build from a given stage.
Safely restart Jenkins.
Puts Jenkins into the quiet mode, wait for existing builds to be completed, and then shut down Jenkins.
Outputs the session ID, which changes every time Jenkins restarts.
Sets the description of a build.
Sets the displayName of a build.
Update/set the build parameter of the current build in progress. [deprecated]
Sets the result of the current build. Works only if invoked from within a build. [deprecated]
Immediately shuts down Jenkins server.
Update Credentials by XML
Update Credentials Domain by XML
Updates the job definition XML from stdin. The opposite of the get-job command.
Updates the node definition XML from stdin. The opposite of the get-node command.
Updates the view definition XML from stdin. The opposite of the get-view command.
Outputs the current version.
Wait for a node to become offline.
Wait for a node to become online.
Reports your credential and permissions.
Jenkins has a section to manage plugins, with sections, updates, available, installed and advanced.
After logging in as admin
Manage Jenkins > Manage Plugins shows you all things "plugin". This the plugins allow you to configure you job with various tasks. For example the gradle plugin allows you to run gradle scripts. The image below show the build section calling the gradle plugin.
The number of jenkins plugins is what makes Jenkins very popular. You can find all the plugins on their website: https://plugins.jenkins.io
A Jenkins pipe line is a collection of jobs, you saw what makes up a job in the What is jenkins framework made up of? article. The jobs in the pipe line can run in sequence or in parallel, or both. It is used in continuous integration & continuous delivery.
Here's a example pipeline from the Jenkins wiki website, the green arrows show the direction of the workflow.
The boxes change color during execution, successful completion, or failure.
Jenkins is made up from many technologies via the clever use of plugins, there are more plugins for Jenkins CI than other CI tool. Jenkins is an orchestrator and referred to as an orchestration tool. Jenkins is open source software and very powerful, It is used for Continuous Integration (CI), Continuous Delivery (CD), Continuous Deployment (CD), a lot of the times Continuous Deploy to production/live is usually a step taken with human interaction, this is not a limitation of Jenkins, it is because many companies using Jenkins require a controlled deployment into production.
Jenkins is made up of Jobs, Builds, Parameters, Pipelines and Plugins The image below show the types of jobs you can have. In case you are wondering why it has project, a job & project are the same thing. You can create a job from scratch or copy from an existing job and edit it as you like.
When you are creating a new job the actual linke is called "New Item"
When you click New Item you get the Job selection screen below:
Enter a name > Choose the type of job you need > Click OK.
Then you see this screen for a Freestyle Job, The tabs are to quickly jump to that part of the configuration. Initially you think it is a different set of options when you click the tab, but the tabs enable ease of navigation as the job can be lengthy the tabs are a good separation of the configuration sections and it is all one job, pulling in plugins where needed. Some sections have many subsections. The different sections & subsections can have parameters, you can see the different headings for the build, build environment, and what to do after the build, with a post-build section.
There is a plugin manager via a link in Manage Jenkins, it's called Manage Plugins The main menu should look something like this for administrator.
Click Manage Jenkins you will see another menu here is the link that takes you to the plugins manager.
What's the talk about a pipeline in continuous delivery? Is it really rocket science?
A jenkins pipeline is essentially a workflow, in fact before it was called a pipeline it was called a workflow, a workflow is a series of actions (jobs) that happen one after another in an ordered and structured way, with potential dependencies, with the pseudo logic, "Is this finished or does this exist, before i continue"
A jenkins pipeline has intelligence, it's resilient, can be paused, can wait for human input, it has state built in, so can continue from a point in time, the pipeline is visual, it shows the status via a dashboard.
Jenkins is a very good choice for CI/CD, because of the large amount of plugins it has, this makes it very powerful. The pipeline feature is just another plugin, it is called the Build Pipeline Plugin
What is Continuous Integration? (CI)
Multiple developers working on their apps or infrastructure code, regularly merge code changes into central SCM repositories. git is one the most popular source code management tools to enable this. After code is merged/committed, a build of the code occurs.
The idea mainly being during the build process errors & bugs are identified quicker and so fixed quicker and ready for testing again, this cycle is repeated until a successful build is produced.
What is Continuous Delivery? (CD)
Mentioned in the same breath as CI, because it is part of a pipeline, starting with CI and going onto CD. Continuous Delivery means code changes are built, staged (various tests), then upon approval process only goes into live/production. Do not confuse Continuous Delivery with Continuous Deployment
The idea being the bugs & new features are deployed in a controlled manner after all types of testing is done and after developer approval.
What is Continuous Deployment? (CD)
The difference between this and Continuous Delivery is Continuous Deployment automatically deploys the tested code/app/application into production without the developer approval.
The idea being the bugs & new features are deployed as soon as tested without developer approval, users benefit from quicker bug fixes and new features.
Good Diagram showing the workflow.