Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

Pipeline of jenkins

2025-04-06 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Servers >

Share

Shulou(Shulou.com)06/02 Report--

Continuous integration + automated deployment [code pipeline management and Jenkins and gitlab integration]

1. Code pipeline management

As the name implies, the term Pipeline means assembly line, because the company may have a lot of projects.

If the build using jenkins is completed, the development build project requires a click, which is troublesome.

So the noun pipeline appears.

After the code quality check is complete, we need to deploy the code to the test environment to automatically

Chemical test

88 gitlab-ctl start

89 / etc/init.d/jenkins start

Create a new deployment code project

Click New

Sudo ssh 192.168.1.50 source / root/test.sh

Warm reminder: the execution of the command mainly involves the issue of permissions.

The test machine creates the test script and gives it the right to execute

1.50

[root@localhost ~] # vim test.shrunken pound Bash echo "hello world" [root@localhost ~] # chmod + x test.sh [root@localhost ~] # source test.sh hello world

Jenkins server does secret-free login ssh 1.40

There are two separate cases for us to do unsecret keys:

1. Use jenkins users to distribute the secret key to 192.168.1.50

2. Use root users to distribute the secret key to 192.168.1.50, and visudo authorization is required if root users are used. Because the default user to execute the command on Web is jenkins

(1) use jenkins users to distribute the secret key to 192.168.1.50

[root@localhost ~] # ssh-copy-id root@192.168.1.50 copy user key to test machine [root@localhost ~] # ssh 192.168.1.50 [root@localhost ~] # ssh 192.168.1.50 source / root/test.sh

Testing on Jenkins

(2) use root users to distribute the keys to 192.168.1.50, and visudo authorization if root users are used. Because the default user to execute the command on Web is jenkins

Authorize jenkins users to use visudo or edit configuration file / etc/sudoers

[root@localhost ~] # vim / etc/sudoers

Jenkins ALL= (ALL) NOPASSWD:/usr/bin/ssh # 93

# jenkins authorizes all hosts and does not require a password to execute ssh. Remember not to authorize ALL

Jenkins test build

Now we will connect code quality management to test deployment.

At this point, the git hook is used.

We need to install the jenkins plug-in parameterized

Install the plug-in

When you click Project Settings again, Trigger parameterized build on other will appear.

Projects

Finally, click Save and click build. Let's check the results.

Now you can see that the number of builds of the two of them is growing together.

Download pipeline. This only needs to build a project, which will help us to complete all the related projects (which have just been installed)

Let's click on the + number on the home page to create a new attempt

And then save.

The pipeline view is as follows:

Click Run

In this way, the code quality is managed first, and then the deployment begins.

After building successfully: test it

The experiment is over

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Servers

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report