mirror of
https://github.com/janishutz/fundamentals-of-webengineering.git
synced 2025-11-25 05:44:24 +00:00
Task 3: React Frontend
This commit is contained in:
73
task_3_react/.gitlab-ci.yml
Normal file
73
task_3_react/.gitlab-ci.yml
Normal file
@@ -0,0 +1,73 @@
|
||||
stages:
|
||||
- lint
|
||||
- build
|
||||
- deploy
|
||||
|
||||
workflow:
|
||||
rules:
|
||||
- if: $CI_COMMIT_BRANCH =~ /^(master|main)$/
|
||||
- if: $FORCE_DEPLOY
|
||||
when: always
|
||||
- when: never
|
||||
|
||||
variables:
|
||||
IMAGE_NAME: $CI_REGISTRY/$CI_PROJECT_PATH
|
||||
BASE_URI: "a3.webdev-25.ivia.isginf.ch"
|
||||
FORCE_DEPLOY:
|
||||
value: "false"
|
||||
description: "Force deploy the application"
|
||||
options:
|
||||
- "true"
|
||||
- "false"
|
||||
|
||||
default:
|
||||
before_script:
|
||||
- IMAGE_NAME=$(echo $IMAGE_NAME | tr '[:upper:]' '[:lower:]')
|
||||
- URI_NAME=$(echo $CI_PROJECT_NAME | tr '[:upper:]' '[:lower:]' | tr _ -)
|
||||
|
||||
lint_helm:
|
||||
stage: lint
|
||||
image: matthiasgabathuler/my-runner:ubuntu-20.04
|
||||
script:
|
||||
- >-
|
||||
helm lint ${CI_PROJECT_DIR}/helm
|
||||
--set image.name=${IMAGE_NAME}
|
||||
--set image.tag=${CI_COMMIT_REF_NAME}
|
||||
--set build.job_id=${CI_JOB_ID}
|
||||
--set build.commit=${CI_COMMIT_SHA}
|
||||
|
||||
build_webapp:
|
||||
stage: build
|
||||
rules:
|
||||
image:
|
||||
name: gcr.io/kaniko-project/executor:debug
|
||||
entrypoint: [""]
|
||||
script:
|
||||
- echo "${DOCKER_REGISTRY_AUTH}" > /kaniko/.docker/config.json
|
||||
- /kaniko/executor
|
||||
--context "${CI_PROJECT_DIR}"
|
||||
--dockerfile "${CI_PROJECT_DIR}/Dockerfile"
|
||||
--destination "${IMAGE_NAME}-webapp:latest"
|
||||
|
||||
deploy_app:
|
||||
stage: deploy
|
||||
rules:
|
||||
image:
|
||||
name: alpine/helm:3.11.1
|
||||
entrypoint: [""]
|
||||
script:
|
||||
- >-
|
||||
helm --namespace $K8S_NAMESPACE
|
||||
--kube-context $K8S_CONTEXT
|
||||
upgrade a3-$(echo ${CI_PROJECT_NAME} | tr _ -) ${CI_PROJECT_DIR}/helm
|
||||
--install
|
||||
--history-max 5
|
||||
--set image.host=${CI_REGISTRY}
|
||||
--set image.name=${IMAGE_NAME}
|
||||
--set image.tag=latest
|
||||
--set url.hostname.uri=${URI_NAME}
|
||||
--set url.hostname.base_uri=${BASE_URI}
|
||||
--set build.job_id=${CI_JOB_ID}
|
||||
--set build.commit=${CI_COMMIT_SHA}
|
||||
- >-
|
||||
echo "webapp URL: http://${URI_NAME}.${BASE_URI}"
|
||||
Reference in New Issue
Block a user