BotLino/Lino

View on GitHub
.gitlab-ci.yml

Summary

Maintainability
Test Coverage
stages:
  - test
  - build
  - deploy

############################################################
######################## Variables #########################
############################################################
variables:
  LINO_LATEST_IMAGE: $DOCKER_USER/lino
  CRONJOB_LATEST_IMAGE: $DOCKER_USER/cronjob
  LINO_LATEST_IMAGE_FACEBOOK: $DOCKER_USER/lino-facebook


############################################################
######################## Tests #############################
############################################################
test_flake8:
  image: ejplatform/python:alpine
  stage: test
  script:
    - flake8


############################################################
######################## Build #############################
############################################################
build lino-telegram:
  image: docker:latest
  stage: build
  services:
    - docker:dind
  script:
    - docker build -f docker/Telegram.Dockerfile -t $LINO_LATEST_IMAGE .
    - docker login -u $DOCKER_USER -p $DOCKER_PASS
    - docker push $LINO_LATEST_IMAGE
  only:
    - /master/
  environment: production

build lino-telegram-dev:
  image: docker:latest
  stage: build
  services:
    - docker:dind
  script:
    - docker build -f docker/Telegram.Dockerfile -t $LINO_LATEST_IMAGE:homolog .
    - docker login -u $DOCKER_USER -p $DOCKER_PASS
    - docker push $LINO_LATEST_IMAGE:homolog
  only:
    - /devel/

build cronjob:
  image: docker:latest
  stage: build
  services:
    - docker:dind
  script:
    - docker build . -t $CRONJOB_LATEST_IMAGE -f docker/Cronjob.Dockerfile
    - docker login -u $DOCKER_USER -p $DOCKER_PASS
    - docker push $CRONJOB_LATEST_IMAGE
  only:
    - /master/
  environment: production

build lino-facebook:
  image: docker:latest
  stage: build
  services:
    - docker:dind
  script:
    - docker build -f docker/Messenger.Dockerfile -t $LINO_LATEST_IMAGE_FACEBOOK .
    - docker login -u $DOCKER_USER -p $DOCKER_PASS
    - docker push $LINO_LATEST_IMAGE_FACEBOOK
  only:
    - /master/
  environment: production



############################################################
######################## Deploy ############################
############################################################
deploy lino-telegram:
  image: cdrx/rancher-gitlab-deploy
  stage: deploy
  script:
    - "upgrade
            --service lino-telegram
            --environment $RANCHER_ENVIRONMENT
            --stack $RANCHER_STACK
            --rancher-key $RANCHER_ACCESS_KEY
            --rancher-secret $RANCHER_SECRET_KEY
            --rancher-url $RANCHER_URL"
  only:
    - /master/

deploy cronjob:
  image: cdrx/rancher-gitlab-deploy
  stage: deploy
  script:
    - "upgrade
            --service cronjob-lino
            --environment $RANCHER_ENVIRONMENT
            --stack $RANCHER_STACK
            --rancher-key $RANCHER_ACCESS_KEY
            --rancher-secret $RANCHER_SECRET_KEY
            --rancher-url $RANCHER_URL"
  only:
    - /master/

deploy lino-facebook:
  image: cdrx/rancher-gitlab-deploy
  stage: deploy
  script:
    - "upgrade
            --service lino-messenger
            --environment $RANCHER_ENVIRONMENT
            --stack $RANCHER_STACK_FACEBOOK
            --rancher-key $RANCHER_ACCESS_KEY
            --rancher-secret $RANCHER_SECRET_KEY
            --rancher-url $RANCHER_URL"
  only:
    - /master/

deploy lino-telegram-homolog:
  image: cdrx/rancher-gitlab-deploy
  stage: deploy
  script:
    - "upgrade
            --rancher-url $RANCHER_HOMOLOG_URL
            --rancher-key $RANCHER_HOMOLOG_ACCESS_KEY
            --rancher-secret $RANCHER_HOMOLOG_SECRET_KEY
            --environment $RANCHER_ENVIRONMENT
            --stack $RANCHER_STACK
            --service new-telegram-lino"
  only:
    - /devel/