jenkins+gitlab 实现代码自动拉取

搭建jenkins
https://wangwei520.top/index.php/archives/74/
搭建gitlab
https://wangwei520.top/index.php/archives/206/

jitlab配置
配置ssh公钥 SSH密钥使您可以在计算机和GitLab之间建立安全连接。

photo_2020-01-15_19-38-17.jpg

创建一个用户 设置用户名、密码和权限

photo_2020-01-15_14-58-56.jpg

photo_2020-01-15_15-01-21.jpg

使用root 创建一个group 然后在group里创建一个项目,在把组员加进来

photo_2020-01-15_14-56-00.jpg

Git全局设置
git config --global user.name "Administrator"
git config --global user.email "admin@example.com"
创建一个新的仓库
cd /data/    ('我的网站根目录是/data/daima')
git clone http://119.3.xx.xx:8080/php/php.git daima('下载代码库重命名')
把自己的代码移动到这里
git add README.md
git commit -m "add README"        
git push -u origin master    ('上传代码')

jenkins设置

photo_2020-01-15_14-45-06.jpg


添加git地址和账号

photo_2020-01-15_14-49-54.jpg

配置钩子 需要安装gitlab、gitlabhook插件

photo_2020-01-15_15-39-33.jpg

生成密令

photo_2020-01-18_19-33-34.jpg

构建执行shell  ('我这里使用的是ansible推送拉取代码')

photo_2020-01-15_16-15-35.jpg

[root@baiduyun ansible]# cat agent-code.yml 
- hosts: "{{hosts}}"
  user: laowang
  gather_facts: no
  become: yes
  become_method: sudo
  tasks:
  - name: pull from git
    git:
      repo: 'http://laowang:asdqwe123@119.3.148.98:8080/php/php.git'
      dest: /data/daima
      update: yes
      force: yes
 点击应用保存

 gitlab项目里面设置

photo_2020-01-15_16-21-21.jpg

 url填写构建触发器里面webhook时候的url
 token 填写jenkins 里面生成的密令

photo_2020-01-15_16-27-53.jpg


保存测试,如果出现200说明配置正确

gitlab 删除或者创建一个文件看一下

photo_2020-01-15_16-33-21.jpg

jenkins 触发了钩子,自动更新代码

photo_2020-01-15_16-31-43.jpg


 
再去服务器上看一下是不是已经没有了或者添加了这个文件

我来吐槽

*

*

已有 36 条评论

  1. clourgy

    Where Can I Buy Cipro Xr best price cialis 20mg Silagra 100 Uk For Sale

  2. Twirway

    stromectol to buy Ampicillin Amoxicillin

  3. Keysler

    Offer provided by Pfizer cialis online cheap The recommended dose per day shall not exceed 20 mg

  4. wainnef

    org, or by calling the Chatham, Glynn, or Bryan County Health Departments priligy kaufen Yes, penile pumps also known as ED pumps are over-the-counter devices that work to treat erectile dysfunction ED , similar to Viagra

  5. ruinkix

    6 of patients taking tadalafil 10 mg and 1 cialis 10mg

  6. Nizscoons

    An alternative to this has Partner A sitting, with Partner B standing in front tadalafil cialis

  7. Gearsella

    Boa et al found that the markers of endometrial receptivity HOXA10 and integrin alpha v beta 3 in rats were suppressed by clomiphene citrate and not affected by letrozole 24. clomiphene citrate administration

  8. ziserse

    coli selection experiments if they have been transformed with plasmids that carry the pac resistance gene. doxycycline brand name The primary outcome measures were improvement of persistent symptoms assessed by neurological examinations, a symptom severity score and estimation of the quality of life.

  9. Arrerswaf

    Well, I was 51 when diagnosed with BC and chose to have a double mastectomy, I took Tamoxifen for only six weeks and became manic depressive lasix medication side effects

  10. ethinny

    nortriptyline how to use ivermectin pour on for goats The service attracts a mostly female clientele in their 30s to 50s, and although men can also opt for the live snail treatment, none have done so yet generic 5mg cialis best price In cases with fibrous and voluminous gynecomastia breast tissue must be removed surgically

  11. Allercext

    2 and 927 ng L 1 and 11 buy stromectol australia

  12. Epibigo

    The mental health comorbidity group consisted of a breast cancer sample with at least 2 outpatient days or at least 1 inpatient day of claim service for depression and or anxiety before cancer diagnosis buy priligy australia Some things I have read is that low metabolism that s what we have responds better to a low carb diet

  13. Almobre

    Lucky me to tamoxifen on reap innate momentum liquid nolvadex Dodson RM, et al

  14. Spoiffutt

    lasix name 5 years, extended adjuvant AI treatment was associated with an absolute 2

  15. Attaicift

    clomid for men for sale The researchers based at the University of Dundee and funded by the Medical Research Council and Breast Cancer Research Scotland used the prescription records of more than 2000 women to see how many did not complete the standard treatment of a tamoxifen tablet every day and linked this to other health records to see if they were more likely to die

  16. legepunny

    Eye 13, 729 733 1999 ivermectin for goats South Carolina Crew Sperry s and Polo Rho Sigma Nu Iota Delta ОЎОЈОќО™Оґ COASTAL CAROLINA 2016 Montreal Crew EDM Crew Misc Alpha Crew EDM IS MY LIFE CREW Molly makes life better crew used to be forever alone fat but now after the first year in college im aesthetic and 80 alpha and ed 12 girls this year crew got rapped in the back of a car by a drunk blonde slut while her boyfriend was sitting next to her crew

  17. ristsnums

    There are case reports where glucocorticoids apparently stimulated the growth of melanoma 75, 76 stromectol uses Hereditary Risk Factors

  18. frurgeorS

    propecia disconts online FDA Approves Lisocabtagene Maraleucel for the Second Line Treatment of Large B Cell Lymphoma

  19. hahacticy

    buy nolvadex The organic sulfur is believed to detox your system and to have anti viral qualities

  20. unfaina

    Every clinic and hospital should be able to provide basic oxygen supplementation ivermectin 3mg tab Is excedrin bad for high blood pressure

  21. scupesace

    zithromax for gonorrhea Dermaplaning is the safest way to exfoliate when you re pregnant because it s a simple mechanical exfoliation that doesn t involve any acids or chemicals

  22. marlomi

    What is the accuracy of familial risk assessment for BRCA related cancer when performed by a nonspecialist in genetics in a clinical setting stromectol otc These two componets accounted for the largest effect in the CPI

  23. liapGearl

    Letairis bosentan Tracleer Flolan Ventavis Opsumit riociguat Adempas Uptravi sildenafil Revatio tadalafil Adcirca treprostenil Orenitram, Remodulin, Tyvaso does tamoxifen cause menopause A basal body thermometer reads 0

  24. fliplem

    Diastolic dysfunction seems to be predictive of cardiac morbidity and mortality 105, 106 otc lasix

  25. Undopsy

    There are currently no drugs approved by the US Food and Drug Administration FDA for the treatment of transient neonatal hyperinsulinism online pharmacy india tamoxifen 20 mg

  26. boufave

    clomiphene for men side effects STUUUUUPID move ryt der

  27. queueds

    Cancer 2011; 117 534 44 Ineligible data Schmidinger 2014 Schmidinger M viagra vs cialis forum Onyekwere OC, Campbell A, Teshome M, Onyeagoro S, Sylvan C, Akintilo A, et al

  28. Undopsy

    Maternally inherited essential hypertension is associated with the novel 4263A G mutation in the mitochondrial tRNAIle gene in a large Han Chinese family brand cialis online