Skip to content
Snippets Groups Projects
.gitlab-ci.yml 3.01 KiB
variables:
  GIT_SUBMODULE_STRATEGY: recursive

stages:
  - test
  - build
  - deploy

zola check:
  stage: test
  image: ${CI_DEPENDENCY_PROXY_DIRECT_GROUP_IMAGE_PREFIX}/alpine:latest
  before_script:
  - apk add --update-cache --repository http://dl-cdn.alpinelinux.org/alpine/edge/community/ zola
  - apk add yarn
  - yarn install
  script:
  - zola check
  allow_failure: true

.build:
  stage: build
  interruptible: true
  needs: []
  image:
    name: gcr.io/kaniko-project/executor:debug
    entrypoint: [""]
  script:
    - echo "{\"auths\":{\"$CI_REGISTRY\":{\"username\":\"$CI_REGISTRY_USER\",\"password\":\"$CI_REGISTRY_PASSWORD\"}}}" >/kaniko/.docker/config.json
    - /kaniko/executor
       --context $CI_PROJECT_DIR
       --dockerfile $CI_PROJECT_DIR/Dockerfile
       --destination $CI_REGISTRY_IMAGE:$CI_COMMIT_REF_NAME
       --digest-file DIGESTFILE
       --build-arg BASE_URL=$BASE_URL
       --cache=true
       --cleanup
  artifacts:
    paths:
      - DIGESTFILE


build production:
  extends: .build
  variables:
    BASE_URL: https://teckids.org
  only:
    - master

build review:
  extends: .build
  variables:
    BASE_URL: https://$CI_COMMIT_REF_SLUG.review.teckids.org
  only:
    - merge_requests

.deploy:
  stage: deploy
  image: ${CI_DEPENDENCY_PROXY_DIRECT_GROUP_IMAGE_PREFIX}/line/kubectl-kustomize:latest
  tags:
    - teckids-trusted
  before_script:
    - echo $KUBECONFIG | base64 -d > /tmp/kubeconfig

deploy production:
  extends: .deploy
  environment:
    name: production
    url: https://teckids.org
  script:
    - cd deploy/overlays/production