-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy path.gitlab-ci.yml
94 lines (81 loc) · 2.55 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
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
stages:
- build
- docker
- deploy
- release
variables:
REGISTRY_PATH: ${CI_REGISTRY}/gaia-x/data-infrastructure-federation-services/por
IMAGE_NAME: ${CI_PROJECT_NAME}/portal-${CI_PROJECT_NAME}
TAG: ${CI_PIPELINE_ID}
CI: "false"
REACT_APP_EDGE_API_URI: "https://${PORTAL_URL}/api"
REACT_APP_MODE: "${REACT_APP_MODE}"
application-build:
stage: build
image:
name: registry.gitlab.com/gaia-x/data-infrastructure-federation-services/por/demo/node:17-alpine3.14
artifacts:
paths:
- build
only:
- main
- /^release\/\d*[.]\d*[.]\d*$/
- tags
script:
- npm install
- npm run build
docker-build:
stage: docker
dependencies:
- application-build
image:
name: gcr.io/kaniko-project/executor:debug
entrypoint: [ "" ]
only:
- main
- /^release\/\d*[.]\d*[.]\d*$/
- tags
script:
- mkdir -p deploy/docker/output
- mv build deploy/docker/output/build
- mkdir -p /kaniko/.docker
- echo "{\"auths\":{\"${CI_REGISTRY}\":{\"auth\":\"$(printf "%s:%s" "${CI_REGISTRY_USER}" "${CI_REGISTRY_PASSWORD}" | base64 | tr -d '\n')\"}}}" > /kaniko/.docker/config.json
- >-
/kaniko/executor
--context "${CI_PROJECT_DIR}/deploy/docker"
--dockerfile "${CI_PROJECT_DIR}/deploy/docker/Dockerfile"
--destination "${REGISTRY_PATH}/${IMAGE_NAME}:${TAG}"
.base_deploy: &base_deploy
stage: deploy
only:
- main
- /^release\/\d*[.]\d*[.]\d*$/
- tags
image: registry.gitlab.com/gaia-x/data-infrastructure-federation-services/por/demo/alpine/k8s:1.21.12
script:
- mkdir -p /root/.kube
- echo "${K8S_CONFIG}" | base64 -d > /root/.kube/config
- helm upgrade --install gaia-x-${CI_PROJECT_NAME} deploy/helm/app --values deploy/helm/app/values.yaml -n gaia-x-portal --set image.repository="${REGISTRY_PATH}" --set image.name="${IMAGE_NAME}" --set image.tag=${TAG} --set fullnameOverride=${CI_PROJECT_NAME} --wait
#Deploy to Test:
# <<: *base_deploy
# environment:
# name: az-test
# variables:
# K8S_CONFIG: "${AZ_KUBE_CONFIG}"
Deploy to Demo:
<<: *base_deploy
environment:
name: ecodemo
# when: manual
variables:
K8S_CONFIG: "${ECO_K8S}"
release_job:
stage: release
image: registry.gitlab.com/gitlab-org/release-cli:latest
rules:
- if: $CI_COMMIT_TAG # Run this job when a tag is created
script:
- echo "running release_job"
release: # See https://docs.gitlab.com/ee/ci/yaml/#release for available properties
tag_name: '$CI_COMMIT_TAG'
description: '$CI_COMMIT_TAG'