summaryrefslogtreecommitdiff
path: root/.gitlab-ci.yml
blob: 269da47ed35e5fc04fd0c573057047a52cafe785 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
stages:
  - test
  - build
  - deploy

variables:
  SERVICE_NAME: 'reviewer-bot'

.build-master: &build-master
  stage: build
  script:
    - docker login -u gitlab-ci-token -p $CI_BUILD_TOKEN $CI_REGISTRY
    - docker build --build-arg MODE=$MODE --build-arg PROXY=${PROXY} -t $CI_REGISTRY_IMAGE/$MODE:$CI_PIPELINE_IID -t $CI_REGISTRY_IMAGE/$MODE:latest .
    - docker push $CI_REGISTRY_IMAGE/$MODE:$CI_PIPELINE_IID
    - docker push $CI_REGISTRY_IMAGE/$MODE:latest
  only:
    - master

build daemon:
  <<: *build-master
  variables:
    MODE: daemon

.deploy: &deploy
  stage: deploy
  script:
    - docker login -u gitlab-ci-token -p $CI_BUILD_TOKEN $CI_REGISTRY
    - docker pull $CI_REGISTRY_IMAGE/$MODE:$CI_PIPELINE_IID
    - docker service update --image $CI_REGISTRY_IMAGE/$MODE:$CI_PIPELINE_IID $SERVICE_NAME-$MODE

deploy daemon:
  <<: *deploy
  variables:
    MODE: daemon
  only:
    - master