Skip to content
Snippets Groups Projects
.gitlab-ci.yml 1.32 KiB
Newer Older
egon w. stemle's avatar
egon w. stemle committed
variables:
  CONTAINER_IMAGE: "gitlab.inf.unibz.it:4567/commul/merlin-platform/www/master"
  DOCKER_BUILDER_IMAGE: "docker:19.03.1"
  DOCKER_TLS_CERTDIR: "" # See https://gitlab.com/gitlab-org/gitlab-runner/issues/4501
  KUBECTL: "https://storage.googleapis.com/kubernetes-release/release/v1.8.10/bin/linux/amd64/kubectl"

stages:
  - build
  - tag
  - deploy

build:
  stage: build
  tags:
    - commul
  image: ${DOCKER_BUILDER_IMAGE}
  services:
    - docker:dind
  before_script:
    - docker login -u gitlab-ci-token -p $CI_JOB_TOKEN https://gitlab.inf.unibz.it:4567
  script:
    - docker build --rm --no-cache --tag=${CONTAINER_IMAGE}:${CI_COMMIT_SHA} .
    - docker push ${CONTAINER_IMAGE}:${CI_COMMIT_SHA}
    - docker tag ${CONTAINER_IMAGE}:${CI_COMMIT_SHA} ${CONTAINER_IMAGE}:staging
    - docker push ${CONTAINER_IMAGE}:staging
  only:
   - master

deploy_staging:
  stage: deploy
  tags:
    - commul
  image: ${DOCKER_BUILDER_IMAGE}
  services:
    - docker:dind
  before_script:
    - wget ${KUBECTL}
    - mv kubectl /usr/bin/
    - chmod +x /usr/bin/kubectl
    - docker login -u gitlab-ci-token -p $CI_JOB_TOKEN gitlab.inf.unibz.it:4567
  script:
    - docker pull ${CONTAINER_IMAGE}:${CI_COMMIT_SHA}
    - kubectl --namespace kommul-dev set image deployment/merlin browser=${CONTAINER_IMAGE}:${CI_COMMIT_SHA}
  only:
    - master