Code release (Jenkins)

Source: Internet
Author: User

Code release process:

Code launch:

Code distribution through tools. distribution methods: Push and pull)

Generally, the pull method is safer.

Tool: jenkins

Test: Use WordPress

Installation:

Wget-O/etc/yum. Repos. d/Jenkins. Repo http://pkg.jenkins-ci.org/redhat/jenkins.repo

Rpm -- import http://pkg.jenkins-ci.org/redhat/jenkins-ci.org.key

Yum install Jenkins

Start/stop:

Service Jenkins start/stop/restart

Web:

Localhost: 8080

Important Note on centos Java:

Yum remove Java

The yum install java-1.6.0-openjdk requires a 1.6 Java version

Test:

Use wordpress.org/download/svn Test

Use:

Jenkins-Wordpress-build

Code drop-down to the distributor:

1. New-component-free style... -- OK

2. Source Code Management-Subversion

Parameterization component process-add parameter-string parameter-Name: wp_version

Repository URL:

Http://core.svn.wordpress.org/tags/javaswp_version

Local Module Directory (optional): WordPress-$ wp_version

3. Save

4. Build with parameters-WP_VERSION: 3.8-start build

5. You can click "console output" to view the result.

6. Save the code to/var/lib/Jenkins/workspace/WordPress-build.

7. Configure-Build-add component step-execute shell-enter shell command to execute code

Shell command:

Target =/var/www/html/deploy/package/workpress-$ wp_version.tgz

Md5file = $ target. MD5

Tar-CVF $ target WordPress-$ wp_version

Md5sum $ target | cut-d \-F1> $ md5file

Echo $ wp_version>/var/www/html/deploy/lastver

8. Grant User Permissions:

Chown-r Jenkins: Jenkins/var/www/html/deploy/package

Touch/var/www/html/deploy/lastver

Chown-r Jenkins: Jenkins/var/www/html/deploy/lastver

Chown-r Jenkins: Jenkins/var/www/html/deploy/livever

9. After the code is re-built, the code is successfully downloaded.

Jenkins message:

+ Cut '-d'-F1

+ Md5sum/var/www/html/deploy/package/workpress-3.8.tgz

+ Echo 3.8

Finished: Success

Sending and distributing Proxy:

Deploy. py script to get code from the distributor

Check whether code distribution is complete:

Jenkins-Wordpress-version-Check

CD/var/www/html/foobar

Fab check_ver

Code upgrade: (Release)

Jenkins-Wordpress-live

Echo $ wp_ver>/var/www/html/deploy/livever

# The deploy script detects this version and then automatically upgrades it.

Code rollback:

Change wp_version to 3.7 to complete code rollback.

Jenkins workflow:

1. Synchronize code from wordperss-build to WordPress (take downloading version 3.7 as an example)

2. Run the deploy. py script on the distributor to pull the code (to make a scheduled task and run it once every minute)

3. WordPress-version-check whether the code distribution check is complete (mainly checks whether the/var/www/releases directory has a 3.7 version directory, and if yes, the synchronization is complete)

4. WordPress-live code upgrade: Change wp_version to 3.8 to complete the code upgrade (deploy. py reads the http: // deploymaster/deploy/lastver file, which records the version number)


This article is from the "muzinan technology blog" blog, please be sure to keep this source http://muzinan110.blog.51cto.com/684213/1439992

Code release (Jenkins)

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.