Jenkins adds linux nodes and creates tasks

Purpose: Add linux nodes on Jenkins

1. Create a new node

Click on the directory in turn: Home – "System Management – ​​"Node Management – ​​"-" New Node: Enter the node name and choose to create a fixed node or copy an existing node
insert image description here
insert image description here

1.1 Node configuration – working directory

insert image description here

1.2 Node Configuration – Start Mode

insert image description here

Linux node startup method: configure the credentials, the purpose is to connect and operate the linux node system through the credentials
Click on the startup method – "Credentials -" [Add] button to select – "[Jenkins] to enter the interface for adding credentials
insert image description here

After adding the certificate of the linux node, select the certificate, as shown in the figure below, the note can make it easier for us to find the certificate
insert image description here

1.3 Node Configuration – Node Property Settings

Node attributes Here we need to add which ones, the following is the addition of git
insert image description here

1.4 Start the node

1.4.1 Java installation and configuration

参考:https://blog.csdn.net/jc_hook/article/details/127683082

1.4.2 git installation configuration

参考:https://blog.csdn.net/jc_hook/article/details/127683082

1.4.3 maven installation configuration

参考:https://blog.csdn.net/jc_hook/article/details/127683082

1.4.4 Start the node

Home page - "System Management - "Node Management - "Node List - "Select the node we just added and click [Start Agent], the startup is successful as follows:
insert image description here

Two, install the plug-in

Jenkins plug-in installation: Home – “System Management –” Plug-in Management – ​​“Optional Plug-ins: Search and Install

2.1 Install the git plugin

insert image description here

2.2 Install SSH

insert image description here

3. Create a project

Home – "You can choose [New View]
insert image description here

Home – “Select View –” New Task
insert image description here

Enter the view name and select the type of automation task to be created according to the requirements
insert image description here

Set the build content as shown in the figure:
insert image description here

3.1 Node settings

Home – "View – "Tasks – "Settings – "General – "Limit Project Run Node: Select the node we added

3.2 git settings

Home – "View – "Tasks – "Settings – "General – "Source Code Management – ​​"Select git: Enter the git information in the figure
insert image description here

Add git credentials
insert image description here

Select git credentials:

insert image description here

3.3 shell script

In linux, we can use shell scripts to execute commands of linux node machines.
First, we need: #!/bin/bash
Other commands are exactly the same as linux

insert image description here

So far, we have added the linux node to Jenkins and created the project.

Guess you like

Origin blog.csdn.net/qq_32828053/article/details/128905581