模拟生产环境中的代码上线实战篇

                  模拟生产环境中的代码上线实战篇python

                                     做者:尹正杰git

版权声明:原创做品,谢绝转载!不然将追究法律责任。服务器

 

 

 

一.代码上线流程运维

 

 

二.开发人员作的事情dom

1>.模拟开发人员编写的测试代码测试

#!/usr/bin/env python
#_*_coding:utf-8_*_
#@author :yinzhengjie
#blog:http://www.cnblogs.com/yinzhengjie/tag/python%E8%87%AA%E5%8A%A8%E5%8C%96%E8%BF%90%E7%BB%B4%E4%B9%8B%E8%B7%AF/
#EMAIL:y1053419035@qq.com

import random

def ValdateCode(number=5):
    res = ""
    for i in range(number):
        num = random.randint(1, 9)
        string = chr(random.randint(97,122))
        s = random.choice([str(num),string])
        res += s
    return res

res = ValdateCode(10)
print(res)

2>.测试代码是是否能够成功运行spa

 

3>.提交代码到GitLab3d

4>.进行push操做code

5>.push成功界面blog

6>.查看GitLab是否push成功

 

三.运维人员作的事情

1>.在服务器端拉取(pull)代码

[root@yinzhengjie yinzhengjieCode]# pwd
/root/yinzhengjieCode
[root@yinzhengjie yinzhengjieCode]# 
[root@yinzhengjie yinzhengjieCode]# ll
total 4
-rw-r--r-- 1 root root 70 Sep  9 07:13 README.md
[root@yinzhengjie yinzhengjieCode]# 
[root@yinzhengjie yinzhengjieCode]# git pull
remote: Counting objects: 11, done.
remote: Compressing objects: 100% (10/10), done.
remote: Total 11 (delta 3), reused 0 (delta 0)
Unpacking objects: 100% (11/11), done.
From www.yinzhengjie.org.cn:root/yinzhengjieCode
   a697c69..317317e  master     -> origin/master
 * [new branch]      yinzhengjie-pycharm -> origin/yinzhengjie-pycharm
Auto-merging README.md
CONFLICT (content): Merge conflict in README.md
Automatic merge failed; fix conflicts and then commit the result.
[root@yinzhengjie yinzhengjieCode]# 
[root@yinzhengjie yinzhengjieCode]# ll
total 8
-rw-r--r-- 1 root root 341 Sep  9 07:13 README.md
-rw-r--r-- 1 root root 484 Sep  9 07:13 VerificationCode.py
[root@yinzhengjie yinzhengjieCode]# 
[root@yinzhengjie yinzhengjieCode]#

2>.运维须要运行代码,检查是否能够正常运行

  代码上线处理步骤:

        2.1>.当你测试代码运行失败时,须要找开发解决问题;

        2.2>.当你测试代码运行成功时,须要告知你的上司,当公司的领导说能够上线了,你才能上线代码;

        2.3>.当上线代码时,你应该讲以前稳定的代码进行备份;

        2.4>.上线新的代码,加入生成环境中出现不稳定的情况,须要及时复原以前的数据,这个时候你备份的操做就显得尤其重要;

        2.5>.这些操做你能够写成脚原本完成,固然你也能够使用git+Jenkins来实现代码自动发布;

相关文章
相关标签/搜索