One-step deployment of the Jenkins continuous Integration environment based on Windows systems

Source: Internet
Author: User
Tags jenkins ci

Title : This article describes how to use Jenkins to deploy a continuous integration environment in a Windows environment. This article is written because in recent work, when you learned to use Jenkins, you did encounter some problems, and most of the tutorial documents are based on Mac or Linux platforms. This is a headache, after some groping, finally walked through the Windows platform under a road.

This CI system process : Dev submits code, and merge to Master branch-->jenkns get latest code, start building (parse git trigger response, build Solution,run Automation,get Result is done in this step) and the build finishes sending the message.

First, download the installation jenkins:https://jenkins.io/

After the installation is complete, you can access the Administration page by visiting http://hostname:8080. Choice: Manage Jenkins ".

Select "Configure Global secuity" in the list on the right, and then you can register the account you want to assign permissions in advance. If you do not allow the registration of the new managed account later, cancel this check.

Next, under Agents, expand the Agent protocol and select all. When selected here, the Java Web Start Agent is enabled, otherwise it is not visible when the slave is created. (with this agent, you also need to install Java in advance to download an installation on the Java website)

Go back to "Manage Jenkins" interface, select "Manage node", click "New Node" to create a new slave, here we choose "Permanent Agent", you can also choose to copy the new node from the existing slave. Fill in the name, the remote root directory, and the tag to start the method selection. The remote directory here is used to store the Jenkins client running files. The other settings are the default values:

Okay, here's a node that's created. We can go back to the node management interface, when the new node is not connected, you can visit your Jenkins page on another server, or on this computer, and click "Launch" to connect to node and install it as a local service. If you are a Win10 system, there will be an installation error, then do not worry, first put your IE or the edge of the administrator to restart the way, again visit Jenkins to try to connect and install. When you feel you want to enable this installation of the service, stop the services and then cmd the command window and enter "SC delete servicename" to delete the service. ServiceName can be viewed in the right-click properties of the service.

Now that we've created node, we're connected to one server, and then we need to create the job to do what we need to do.

Go back to the Jenkins homepage and click on "New Item", where I choose to use "Freestyle Project". After editing the project name, we can define a clearly obsolete build. I've defined this as a build that stays within 7 days, and it requires a maximum of 10 builds to be retained.

As described earlier, this CI system responds to the trigger condition returned by git, so you need to set a parameter to receive the returned response, and in this setting on which node to perform this build task, fill in the label that was set when node was created:

In addition to the default settings when creating node, we can also set a custom workspace here, and the obtained code will be stored here:

In the source control item, we choose Git, set the corresponding Git project URL and access the user name and password, branch select the default master:

After obtaining the code, select the trigger method, if the time polling method, select "Poll SCM", set the interval time. Need to respond to each commit, here I choose to remotely trigger "Trigger builds remotely", set a token value to be used.

At this point, we need to go to the GIT Site code management settings page, add a "Hooks & Services", and enable "pull request". The format of the Payload URL is formatted as prompted under the token set above:

After completing the above steps, the job's operating environment is basically set up successfully, and the next step is to build an automated run script.

Go back to the Job edit page, continue down, click "Add Build Step", in the drop-down box you can see that Jenkins supports a very rich scripting language. Here we will use window batch and widows PowerShell. Write your business processing script here and save it for a moment. For example, output "Jenkins CI", in the Windows batch box, enter "Echo Jenkins CI", save, it is OK.

Finally, the message needs to be sent automatically after the script completes. Let's see how it's configured:

Before configuring mail notifications, we need to set up the basic configuration of the mail system in "Configure system".

First, fill in the Jenkins Access address and the sender's email address.

Next, set up the SMTP mail server and some default values, including receiving objects, topics, content, and so on. So, the simplest mail-sending configuration is complete. Follow to set up specific mail notifications.

Return to the Job editor page, find "Post-build Actions" and select "Editable Email Notification". Set the actual recipient, content format, and default theme. and set the default content, you can coordinate with the environment variables (not detailed here) parameterized, formatted content style.

If you need to send an attachment, you can also set the path and name of the attachment. Finally set the message to send the trigger condition is OK.

In this way, the CI system under a complete Windows platform is set up.

One-step deployment of the Jenkins continuous Integration environment based on Windows systems

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.