.gitlab-ci.yml 1.59 KB
Newer Older
1 2 3 4 5 6
image: registry.uninett.no/system/kubernetes-deploy:v0.13

variables:
  KUBE_PROD_DOMAIN: play.oauth.no # The main domain for your application.
  KUBE_TEST_DOMAIN: play-oauth.paas2.uninett.no # A domain which test versions of your application can be launched under.
  KUBE_REVIEW_DOMAIN: play-oauth-review.paas2.uninett.no # A domain which review versions of your application can be launched under.
Andreas Åkre Solberg's avatar
Andreas Åkre Solberg committed
7
  HTTP_PORT: '3000' # The port number of the web server.
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 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78
  REPLICAS: '1'

stages:
  - build
  - test
  - review
  - staging
  - production

build:
  stage: build
  script:
    - build
  only:
    - branches

production:
  stage: production
  variables:
    CI_ENVIRONMENT_URL: https://$KUBE_PROD_DOMAIN
    REPLICAS: '2'
  script:
    - deploy kubernetes/deployment.yaml
  environment:
    name: production
    url: https://$KUBE_PROD_DOMAIN
  when: manual
  only:
    - master

staging:
  stage: staging
  variables:
    CI_ENVIRONMENT_URL: https://$KUBE_TEST_DOMAIN
  script:
    - deploy kubernetes/deployment.yaml
  environment:
    name: staging
    url: https://$KUBE_TEST_DOMAIN
  only:
    - master

review:
  stage: review
  variables:
    CI_ENVIRONMENT_URL: https://$KUBE_REVIEW_DOMAIN
  script:
    - deploy kubernetes/deployment.yaml
  environment:
    name: review/$CI_BUILD_REF_NAME
    url: https://$KUBE_REVIEW_DOMAIN
    on_stop: stop_review
  only:
    - branches
  except:
    - master

stop_review:
  stage: review
  variables:
    GIT_STRATEGY: none
  script:
    - destroy
  environment:
    name: review/$CI_BUILD_REF_NAME
    action: stop
  when: manual
  only:
    - branches
  except:
    - master