-

   rss_rss_hh_new

 - e-mail

 

 -

 LiveInternet.ru:
: 17.03.2011
:
:
: 51

:


GitLab CI production. 2:

, 12 2017 . 09:00 +

, :

image
, , .

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

1. .gitlab-ci.yml


, git push, .gitlab-ci.yml production. GitLab: #24794 #20826 .

, - , : push .gitlab-ci.yml DevOps, .. .

boolean- ci_admin . true, git push .gitlab-ci.yml.

2.


, , GITLAB_USER_ID GITLAB_USER_EMAIL . , , . #21825, (upstream) GitLab CI 8.12:


3.


, . , . .

, -, , -, , , . . , .

, :

, . , , , . .

, artifact, ( ) . , , : - . .

. testing staging:



, (deploy to qa-*) , . touch , deploy to qa-*, staging, .

test integration deploy to qa-1:

test integration:
  stage: testing
  tags: [deploy]
  script:
    - mkdir -p .ci_status
    - echo "test integration"
    - touch .ci_status/test_integration
  artifacts:
    paths:
      - .ci_status/

deploy to qa-1:
  tags: [deploy]
  stage: staging
  when: manual
  script:
    - if [ ! -e .ci_status/test_unit -o ! -e .ci_status/test_integration -o ! -e .ci_status/test_selenium ]; then echo "    "; exit 1; fi
    - echo "execute job ${CI_BUILD_NAME}"
    - touch .ci_status/deploy_to_qa_1
  artifacts:
    paths:
      - .ci_status/

artifact, , GitLab CI . , .ci_status, (mkdir -p).

: .gitlab-ci.yml staging testing .

production approve:



approve not approve , production. , , , NOT approve approve . , . , timestamp. deploy to production : approve timestamp , , .

approve:
  script:
    - mkdir -p .ci_status
    - echo $(date +%s) > .ci_status/approved
  artifacts:
    paths:
      - .ci_status/

NOT approve:
  script:
    - mkdir -p .ci_status
    - echo $(date +%s) > .ci_status/not_approved
  artifacts:
    paths:
      - .ci_status/

deploy to production:
  script:
    - if [[ $(cat .ci_status/not_approved) > $(cat .ci_status/approved) ]]; then echo "   -"; exit 1; fi
    - echo "deploy to production!"

appove deploy to production:



NOT approve deploy to production :



:

?


. , : REST API, curl GITLAB_USER_ID GITLAB_USER_EMAIL. REST API .

, , .gitlab-ci.yml. , - , , qa pre-production . , , .

. , , , . , REST-. , , .

, :
  1. ,
  2. ,
  3. approve not approve.

. , GitLab , . , .


, GitLab CI .



P.S. .gitlab-ci.yml https://-/ci/lint. !
Original source: habrahabr.ru (comments, light).

https://habrahabr.ru/post/332842/


: [1] []
 

:
: 

: ( )

:

  URL