模擬生產環境中的代碼上線實戰篇

                  模擬生產環境中的代碼上線實戰篇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來實現代碼自動發佈;

相關文章
相關標籤/搜索