include:
  - project: "open-source/gitlab-ci-templates"
    ref: "branch/v2"
    file:
      - "templates/base.yml"
      - "templates/build-docker-image.yml"


image_build:
  tags:
    - dedibox
  variables:
    KUBERNETES_MEMORY_LIMIT: 1.5Gi

image_build_latest:
  tags:
    - dedibox
  variables:
    KUBERNETES_MEMORY_LIMIT: 1.5Gi

image_build_tag:
  tags:
    - dedibox
  variables:
    KUBERNETES_MEMORY_LIMIT: 1.5Gi

deploy:
  tags:
    - dedibox
  stage: deploy
  image: alpine/helm:3.11.3
  rules:
    - if: '$CI_COMMIT_REF_NAME == "branch/default"'
  before_script:
   - helm repo add logilab https://helm.logilab.fr
  script:
    - helm upgrade helm-repo logilab/web-app
        --install --atomic
        --set host=helm.logilab.fr
        --set image.repo=registry.logilab.fr/open-source/helm-repository
        --set image.tag=${CI_COMMIT_HG_SHORT_SHA}
        --set appName=helm-repo
        --namespace helm-repo

stages:
    - lint
    - release
    - deploy
