-

   rss_rss_hh_new

 - e-mail

 

 -

 LiveInternet.ru:
: 17.03.2011
:
:
: 51

:


GitLab CI production. 1:

, 10 2017 . 08:52 +


, GitLab CI: ? , , , GitLab Flow. , , GitLab CI , . : ( ) , , DevOps- -. . , , GitLab CI, production (CI) (CD).


CI- , ( stage ), ( job ). production , . pipeline ( ). :



:
  • build ;
  • testing ;
  • staging , DevOps, ;
  • pre-production production ;
  • approve , - production ;
  • production production.

: , : , . , . , GitLab CI , . GitLab CI.

?


, user story. , : . :
  1. feature_, DevOps- infra_. git push ( build) ( testing).
  2. , (manual).
  3. staging . , DevOps-, . .
  4. staging pre-production , DevOps- -.
  5. - . .
  6. , pre-production , . , - approve. - , - not approve.
  7. production pre-production approve. production - DevOps-.


-


build . Open Source- dapp ( + ), . feature_ ( ), infra_ ( ) , (master/develop/production/release).

staging , DevOps- . , feature_ infra_ ( ).

pre-production production . , - merge- . , GitLab Flow , production , .

approve : approve not approve. production, . , production , , -. - , , production -, DevOps. -, approve, deploy to production DevOps. , , .

, , . , GitLab CI

.gitlab-ci.yml


, .gitlab-ci.yml, :

stages:
  - build
  - testing
  - staging
  - preprod
  - approve
  - production

## build stage
build:
  stage: build
  tags: [deploy]
  script:
    - echo "Build"

## testing stage
test unit:
  stage: testing
  tags: [deploy]
  script:
    - echo "test unit"

test integration:
  stage: testing
  tags: [deploy]
  script:
    - echo "test integration"

test selenium:
  stage: testing
  tags: [deploy]
  script:
    - echo "test selenium"

## staging stage
.staging-deploy: &staging-deploy
  tags: [deploy]
  stage: staging
  when: manual
  script:
    - echo $CI_BUILD_NAME


deploy to dev-1:
  <<: *staging-deploy

deploy to dev-2:
  <<: *staging-deploy

deploy to devops-1:
  <<: *staging-deploy

deploy to devops-2:
  <<: *staging-deploy

deploy to qa-1:
  <<: *staging-deploy

deploy to qa-2:
  <<: *staging-deploy


## preprod stage
deploy to preprod:
  stage: preprod
  tags: [deploy]
  when: manual
  script:
    - echo "deploy to preprod"

## approve stage
approve:
  stage: approve
  tags: [deploy]
  when: manual
  script:
    - echo "APPROVED"

NOT approve:
  stage: approve
  tags: [deploy]
  when: manual
  script:
    - echo "NOT APPROVED"

## production stage
deploy to production:
  stage: production
  tags: [deploy]
  when: manual
  script:
    - echo "deploy to production!"

. :
  • stage , ;
  • script , , ;
  • when (manual , );
  • tags , , .

: GitLab CI, CI, .. , GitLab script.

Coding the Next Build ((c) 2016 Niek Palm)

, ?
.staging-deploy: &staging-deploy
  tags: [deploy]
  stage: staging
  when: manual
  script:
    - echo $CI_BUILD_NAME

YAML . . .

, approve production . .gitlab-ci.yml only. , , tags . , only .

, build, testing, staging, pre-production, infra_, feature_ , :
test unit:
  stage: testing
  tags: [deploy]
  script:
    - echo "test unit"
  only:
    - tags
    - /^infra_.*$/
    - /^feature_.*$/

approve production, , :
deploy to production:
  stage: production
  tags: [deploy]
  script:
    - echo "deploy to production!"
  only:
    - tags

only ( .gitlab-ci.yml ).

?


.gitlab-ci.yml , .. GitLab CI , -, , -, . .gitlab-ci.yml .

GitLab . ( ).
Original source: habrahabr.ru (comments, light).

https://habrahabr.ru/post/332712/


: [1] []
 

:
: 

: ( )

:

  URL