Jenkins + Gitlab Automated Deployment

Source: Internet
Author: User
Tags port number git clone webhook
OutlineIdeas about Jenkins installation Gitlab installation Jenkins and Gitlab configuring automated deployment testing possible issues ideas to explain

Gitlab->pull (Other operations) (->webhook)-Trigger (Jenkins build operation)->jenkins build->pull Specify Project---build script complete.

Jenkins installation Download Jenkins War

wget Http://mirrors.jenkins.io/war-stable/latest/jenkins.war
set the Jenkins root location (Linux CentOS is installed by default in the/root/.jenkins directory)
A. Edit the Bash_profile file

   vi/root/.bash_profile

b. Add the following (set the JENKINS root)

   export jenkins_home=/opt/jenkins

C. Entry into force change

   source/root/.bash_profile
Start Jenkins (Specify 8888 port number) [Here is just a demo, normally don't start like this, put the war under Tomcat]
Nohup Java-jar Jenkins.war--httpport=8888 &
View boot Status
PS aux | grep Jenkins
Web Access
http://ip:8888
Installation Wizard

View the key according to the path displayed on the page and fill in

   Cat/opt/jenkins/secrets/initialadminpassword

Install the official recommended plugin, select the option on the left to install

Note: Here are some plug-ins prompt installation failure, no relationship, under normal circumstances will not affect the use, can be installed in the background plug-in two times. Create user

start using

Gitlab Installation get Bitnami Gitlab One-click installation package

wget Https://bitnami.com/redirect/to/137681/bitnami-gitlab-8.14.3-0-linux-x64-installer.run

Note: Now Bitnami Gitlab is not available. run file download, want to get other version can Baidu Google a bit
Bitnami Gitlab official website Download address: Https://bitnami.com/stack/gitlab installation Gitlab

A. Modify permissions (executable)
chmod +x Bitnami-gitlab-8.2.3-4-linux-installer.run

b. Execute the. run file
. Bitnami-gitlab-8.2.3-4-linux-installer.run
Installation Details

Web Access

IP: Port

The above completes the foundation environment construction. Jenkins and Gitlab Automated deployment configuration new git repository

initializing the Git repository

clone the code and upload it to the Git repository

1. Git clone xxx.git

2. Vim  index.html

Jenkins install the necessary pluginsBuild Authorization Token Root Plugin (visitors can also perform job build)

Jenkins-> Management plug-in system management

Create a task (choose free Style)

git source Configuration

Building triggers

The above generated tokens are used as Gitlab web_hook communication using the form of the URL address below the Web-hook URL address
Jenkins_url/job/demo/build?token=token_name Construction

Here we build operations using the Execute shell form, the Shell scripting language

Because the PHP project is built, you only need to send the source code to the Web directory.
Note: The build section is what you need to do when you build your project if Java is to be built using MAVEN or Gradle to execute the appropriate script. This section has completed the Code pull action and what to do next is up to you to specify. Gitlab Hook Configuration

Come to your project to find the Webhook configuration into

After the configuration is complete, click Test below

The above configuration is complete. Test Modify Jenkins_demo Content

push remote git library

Automatic Build Complete

possible problems when testing Gitlab Webhook may present a communication problem when Jenkins itself prohibits cross-site requests

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.