variables: WEBSITE_SRC: ${CI_PROJECT_DIR}/website INFRA_SRC: ${CI_PROJECT_DIR}/infra TEAMSPEAK_SRC: ${CI_PROJECT_DIR}/teamspeak DEFIANT_SRC: ${CI_PROJECT_DIR}/defiant IMAGE_PREFIX: registry.gitlab.com/momothereal/momoperes.ca WEBSITE_IMAGE: ${IMAGE_PREFIX}/website DEFIANT_IMAGE: ${IMAGE_PREFIX}/defiant KUBECONFIG_PARENT: /etc/deploy KUBECONFIG: ${KUBECONFIG_PARENT}/config DEPLOY_NAMESPACE: public stages: - build - release - deploy ### WEBSITE ### website:release: stage: release image: name: gcr.io/kaniko-project/executor:debug entrypoint: [""] script: - echo "Building to ${WEBSITE_IMAGE}:${CI_COMMIT_TAG}" - echo "{\"auths\":{\"${CI_REGISTRY}\":{\"username\":\"${CI_REGISTRY_USER}\",\"password\":\"${CI_REGISTRY_PASSWORD}\"}}}" > /kaniko/.docker/config.json - /kaniko/executor --context ${WEBSITE_SRC} --dockerfile ${WEBSITE_SRC}/docker/Dockerfile --destination ${WEBSITE_IMAGE}:${CI_COMMIT_REF_SLUG}-${CI_COMMIT_SHORT_SHA} --destination ${WEBSITE_IMAGE}:${CI_COMMIT_REF_SLUG} only: changes: - website/**/* website:deploy: stage: deploy image: lwolf/helm-kubectl-docker:v1.15.4-v2.14.3 script: - mkdir -p ${KUBECONFIG_PARENT} - echo ${K8S_CLUSTER_CONFIG} | base64 -d > ${KUBECONFIG} # Deploy using helm chart - cd ${WEBSITE_SRC}/chart - mkdir -p manifests/ - helm template ./website/ --output-dir manifests/ --name website --set image.name=${WEBSITE_IMAGE} --set image.tag=${CI_COMMIT_REF_SLUG}-${CI_COMMIT_SHORT_SHA} -f ./website/values.yaml - kubectl apply --namespace ${DEPLOY_NAMESPACE} -R -f manifests/ only: refs: - master changes: - website/**/* # INFRA # infra:deploy: stage: deploy image: lwolf/helm-kubectl-docker:v1.15.4-v2.14.3 script: - mkdir -p ${KUBECONFIG_PARENT} - echo ${K8S_CLUSTER_CONFIG} | base64 -d > ${KUBECONFIG} # Deploy nginx ingress - helm init --client-only && helm repo update - helm upgrade nginx-ingress stable/nginx-ingress --install --namespace ${DEPLOY_NAMESPACE} --set controller.publishService.enabled=true # Deploy infra manifests directly - cd ${INFRA_SRC}/ - kubectl apply --namespace ${DEPLOY_NAMESPACE} -R -f manifests/ only: refs: - master changes: - infra/**/* # TEAMSPEAK # teamspeak:deploy: stage: deploy image: lwolf/helm-kubectl-docker:v1.15.4-v2.14.3 script: - mkdir -p ${KUBECONFIG_PARENT} - echo ${K8S_CLUSTER_CONFIG} | base64 -d > ${KUBECONFIG} # Deploy using helm chart - cd ${TEAMSPEAK_SRC}/chart - mkdir -p manifests/ - helm template ./teamspeak/ --output-dir manifests/ --name teamspeak -f ./teamspeak/values.yaml - kubectl apply --namespace ${DEPLOY_NAMESPACE} -R -f manifests/ only: refs: - master changes: - teamspeak/**/* # DEFIANT # defiant:build: stage: build image: debian script: - apt-get update && apt-get install -y git - cd ${DEFIANT_SRC}/src - git clone https://github.com/momothereal/code-jam-2.git defiant - cp main_config.yaml defiant/config/main_config.yaml artifacts: paths: - ${DEFIANT_SRC}/src only: changes: - defiant/**/* defiant:release: stage: release image: name: gcr.io/kaniko-project/executor:debug entrypoint: [""] script: - echo "Building to ${DEFIANT_IMAGE}:${CI_COMMIT_TAG}" - echo "{\"auths\":{\"${CI_REGISTRY}\":{\"username\":\"${CI_REGISTRY_USER}\",\"password\":\"${CI_REGISTRY_PASSWORD}\"}}}" > /kaniko/.docker/config.json - /kaniko/executor --context ${DEFIANT_SRC}/src/defiant --dockerfile ${DEFIANT_SRC}/src/defiant/Dockerfile --destination ${DEFIANT_IMAGE}:${CI_COMMIT_REF_SLUG}-${CI_COMMIT_SHORT_SHA} --destination ${DEFIANT_IMAGE}:${CI_COMMIT_REF_SLUG} only: changes: - defiant/**/*