forked from crosscloudci/ci-dashboard
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy path.gitlab-ci.yml
61 lines (58 loc) · 3.05 KB
/
.gitlab-ci.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
stages:
- Build
- Deploy
before_script:
- export BASE_URL=${BASE_URL:-$(echo $CI_PROJECT_URL | cut -d'/' -f1-3)}
Dashboard-Frontend:
stage: Build
script:
- >
if [ "$BASE_URL" == "https://gitlab.dev.cncf.ci" ] && [ "$CI_COMMIT_REF_NAME" == "master" ]; then
echo "Deploying $CI_COMMIT_REF_NAME on $BASE_URL"
elif [ "$BASE_URL" == "https://gitlab.cidev.cncf.ci" ] && [ "$CI_COMMIT_REF_NAME" == "integration" ]; then
echo "Deploying $CI_COMMIT_REF_NAME on $BASE_URL"
elif [ "$BASE_URL" == "https://gitlab.staging.cncf.ci" ] && [ "$CI_COMMIT_REF_NAME" == "staging" ]; then
echo "Deploying $CI_COMMIT_REF_NAME on $BASE_URL"
elif [ "$BASE_URL" == "https://gitlab.cncf.ci" ] && [ "$CI_COMMIT_REF_NAME" == "production" ]; then
echo "Deploying $CI_COMMIT_REF_NAME on $BASE_URL"
else
echo "No Matching Environment Could Be Found"
exit 1
fi
- docker login -u "gitlab-ci-token" -p "$CI_JOB_TOKEN" $CI_REGISTRY
- docker build --pull --no-cache -t "$CI_REGISTRY_IMAGE/frontend-$CI_COMMIT_REF_NAME:$CI_COMMIT_SHA" .
- docker push "$CI_REGISTRY_IMAGE/frontend-$CI_COMMIT_REF_NAME:$CI_COMMIT_SHA"
Deploy-Frontend:
stage: Deploy
image: crosscloudci/helm:latest
script:
- >
if [ "$BASE_URL" == "https://gitlab.dev.cncf.ci" ] && [ "$CI_COMMIT_REF_NAME" == "master" ]; then
echo "Deploying $CI_COMMIT_REF_NAME on $BASE_URL"
export BACKEND_INGRESS="https://devapi.cncf.ci/api"
export FRONTEND_INGRESS="dev.cncf.ci"
export TLS="true"
elif [ "$BASE_URL" == "https://gitlab.cidev.cncf.ci" ] && [ "$CI_COMMIT_REF_NAME" == "integration" ]; then
echo "Deploying $CI_COMMIT_REF_NAME on $BASE_URL"
export BACKEND_INGRESS="https://cidevapi.cncf.ci/api"
export FRONTEND_INGRESS="cidev.cncf.ci"
export TLS="true"
elif [ "$BASE_URL" == "https://gitlab.staging.cncf.ci" ] && [ "$CI_COMMIT_REF_NAME" == "staging" ]; then
echo "Deploying $CI_COMMIT_REF_NAME on $BASE_URL"
export BACKEND_INGRESS="https://stagingapi.cncf.ci/api"
export FRONTEND_INGRESS="staging.cncf.ci"
export TLS="true"
elif [ "$BASE_URL" == "https://gitlab.cncf.ci" ] && [ "$CI_COMMIT_REF_NAME" == "production" ]; then
echo "Deploying $CI_COMMIT_REF_NAME on $BASE_URL"
export BACKEND_INGRESS="https://productionapi.cncf.ci/api"
export FRONTEND_INGRESS="cncf.ci"
export TLS="true"
else
echo "No Matching Environment Could Be Found"
exit 1
fi
- /helm/entrypoint.sh
- export KUBECONFIG=/kubeconfig
- helm init
- helm repo add cncf http://cncf.gitlab.io/stable
- helm upgrade fnt-"$CI_COMMIT_REF_NAME" cncf/frontend --install --force --wait --timeout 3600 --set tls="$TLS" --set imagePullSecrets="$CI_COMMIT_REF_NAME"secret --set ingress.host="$FRONTEND_INGRESS" --set ingress.port=8080 --set api.url="$BACKEND_INGRESS" --set node.port=8080 --set node.host=0.0.0.0 --set image.repository="$CI_REGISTRY_IMAGE/frontend-$CI_COMMIT_REF_NAME" --set image.tag="$CI_COMMIT_SHA"