Original article, welcome to reprint. Reprint please specify: reprint from IT people story, thank you! Docker CI/CD Continuous Integration — The Whole Process series (75)

CI Python, CI Java, CDpython, gitLab, GitLab-CI, GitLab CICD, from the development process to the release process, a working process. Source: github.com/limingios/d…

The process is very important, I suggest you demonstrate.

  • Settings

setting –Repositoryt —Protected Branches







No one can push code directly into the Master branch




Setting — general — The Merge request allows the master to set nothing to change, so how should we change the process? Anyone can only work in branch mode, when there is no problem can submit to their branch. After receiving the merge request, the administrator can merge the developer’s own branch into the master branch.










  • Create a new branch dev can be named after each person, one branch per person

Repository — Branches — new Branches













  • The code pull then switches to the dev branch

Already in dev branch.




  • Modify the code to submit the code push to the dev branch

Just pick some code and change it, and look at the flow










  • Commit automatically after the dev branch pipline up



  • Send a Merge Request









Pipline first and then merge.




  • Code error found.



If pipline has problems, mege will not be allowed




The administrator is telling the developer that your code has a problem, and the developer starts fixing the code and resubmitting it.




Commit to push the code

To merge the request













  • There was another problem with the previous code

Now any branch that changes, it deploys, and now only master deploys.

Added only master to deploy only for master

stages:
  - style
  - test
  - deploy

pep8:
  stage: style
  script:
    - pip install tox
    - tox -ePep8 tags: -python2.7 unittest-py27: stage:test
   script:
     - pip install tox
     - tox -ePy27 tags: -python2.7 unitTest -py34: stage:test
   script:
     - pip install tox
     - tox -e py34
   tags:
     - python3/4
     
docker-deploy:
   stage: deploy
   script:
     - docker build -t flask-demo .
     - if [ $( docker ps -aq --filter name=web) ]; then docker rm -f web;fi
     - docker run -d -p 5000:5000 --name web flask-demo
   tags:
     - test1
   only:
     - master
Copy the code



  • After the normal pipline can be merged, the master branch has changed. The Master branch starts firing pipline. There is no deploy in the dev branch









PS: Basically this is the complete process of developing and testing CICD. Git workflow, branch based workflow. Deploy to CI’s server. CD actually comes in several cases, the machine that may be deployed to the production environment, another separate system, the deployment of our production environment, is generally deployed according to the release. Today this is mostly development and testing, not production. Gitlab should be available for deployment in the next project release. What is the process of GITlab-CI