CI/CD of GitLab

CI:

    Continuous Integration

CD:

   continuous deployment

   continuous delivery

   

Job -> Pipeline

GitLab Runner is an application which processes builds. It can be deployed separately and works with GitLab CI/CD through an API.

Architecture

executor

.gitlab-ci.yml

stages:
  - build
  - unit_test
  - deploy
  - release
  - e2e_test

test_job:
  stage: unit_test
  script:
    - echo Test OK
  except:
    - tags
  tags:
    - win-aocc-powershell-runner

dev-forntend-build_job:
  stage: build
  script:
    - powershell .\bat_bin\frontend_publish.bat --develop
  cache:
    untracked: true
  only:
    - develop
  tags:
    - win-aocc-powershell-runner
  
dev-forntend-deploy_job:
  stage: deploy
  script:
    - powershell .\bat_bin\cp_file.bat --develop
  only:
    - develop
  when: manual
  allow_failure: false
  environment:
    name: staging/$CI_PIPELINE_IID-$CI_COMMIT_SHORT_SHA
    url: 
  tags:
    - win-aocc-powershell-runner


production-forntend-build_job:
  stage: build
  script:
    - powershell .\bat_bin\frontend_publish.bat --master
  cache:
    untracked: true
  only:
    - master
  except:
    - tags
  tags:
    - win-aocc-powershell-runner

production-forntend-deploy_job:
  stage: deploy
  script:
    - powershell .\bat_bin\cp_file.bat --master
  only:
    - master
  except:
    - tags
  when: manual
  allow_failure: false
  environment:
    name: production/$CI_PIPELINE_IID-$CI_COMMIT_SHORT_SHA
    url: 
  tags:
    - win-aocc-powershell-runner

staging-frontend-e2e-test_job:
  stage: e2e_test
  script:
    - powershell .\bat_bin\e2e_test.bat
  only:
    - develop
  environment:
    name: staging/$CI_PIPELINE_IID-$CI_COMMIT_SHORT_SHA
    url: 
  dependencies:
    - dev-forntend-deploy_job
  tags:
    - win-aocc-powershell-runner

production-frontend-e2e-test_job:
  stage: e2e_test
  script:
    - powershell .\batbat_bin\e2e_test.bat
  only:
    - master
  except:
    - tags
  environment:
    name: production/$CI_PIPELINE_IID-$CI_COMMIT_SHORT_SHA
    url: 
  dependencies:
    - production-forntend-deploy_job
  tags:
    - powershell-runner

semantic-release:
  stage: release
  script:
    - yarn install 
    - npm run semantic-release
  only:
    - master
  except:
    - tags
  dependencies:
    - production-forntend-deploy_job
  tags:
    - powershell-runner

CI lint

Gitlab CI/CD

By jaokuohsuan

Gitlab CI/CD

  • 1,181