-
Notifications
You must be signed in to change notification settings - Fork 2
/
.gitlab-ci.yml
137 lines (119 loc) · 5.23 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
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
include:
- project: does/public/ci-templates
file: default.yml
variables:
PROJECT_SLUG: esgf-metagrid-k8s
HELM_EXTRA_ARGS: >-
--kube-apiserver=https://api.onyx.ccs.ornl.gov:443
--kube-token=$CLI137_RUNNER_TOKEN
--set keycloak.url=https://login.esgf.io/
--set django.image.repository=$IMAGE_REGISTRY/django
--set django.image.tag=$IMAGE_TAG
--set django.env.DJANGO_SECRET_KEY=${DJANGO_SECRET_KEY}
--set django.env.DJANGO_DEBUG="True"
--set django.env.REACT_APP_WGET_API_URL=https://greyworm1-rh7.llnl.gov/wget
--set django.env.REACT_APP_SEARCH_URL=https://esgf-node.ornl.gov/esg-search/search
--set react.image.repository=$IMAGE_REGISTRY/react
--set react.image.tag=$IMAGE_TAG
--set react.env.REACT_APP_WGET_API_URL=https://greyworm1-rh7.llnl.gov/wget
--set react.env.REACT_APP_ESGF_NODE_STATUS_URL=https://aims2.llnl.gov/metagrid-backend/proxy/status
--set-string react.ingress.enabled=true
--set-string react.ingress.annotations.ccs\.ornl\.gov\/requireAuth=false
--set-string react.ingress.annotations.route\.openshift\.io\/termination=edge
--set-string react.ingress.labels.ccs\.ornl\.gov\/externalRoute=true
--set postgresql.postgresql.podSecurityContext.enabled=false
--set postgresql.postgresql.containerSecurityContext.enabled=false
--set postgresql.postgresql.password=${POSTGRES_PASSWORD}
--set postgresql.postgresql.repmgrPassword=${POSTGRES_PASSWORD}
--set postgresql.pgpool.podSecurityContext.enabled=false
--set postgresql.pgpool.containerSecurityContext.enabled=false
--set postgresql.pgpool.adminPassword=${PGPOOL_ADMIN_PASSWORD}
KANIKO_ARGS: "--cache=true --reproducible=true --use-new-run=true
--context ${CONTEXT} --dockerfile ${DOCKERFILE} --destination ${IMAGE_URL} --ignore-path=/workspace
--ignore-path=/busybox ${KANIKO_EXTRA_ARGS}"
workflow:
name: "$PIPELINE_TYPE $CI_COMMIT_BRANCH"
rules:
- if: $FORCE_REVIEW_RUN == "true" || $CI_MERGE_REQUEST_IID || $CI_PIPELINE_SOURCE == "web" || $CI_PIPELINE_SOURCE == "trigger"
variables:
RUNNER_TAG: mariner
CI_ENVIRONMENT_URL: "$CI_BUILD_REF_SLUG-$PROJECT_SLUG.mariner-cluster.ornl.gov"
ENVIRONMENT_NAME: Review/$CI_BUILD_REF_SLUG
NAMESPACE: "$PROJECT_SLUG-review"
RELEASENAME: "$PROJECT_SLUG-$CI_BUILD_REF_SLUG"
HELM_CHANNEL: dev
PIPELINE_TYPE: review
- if: $FORCE_PRODUCTION_RUN == "true" || ($CI_COMMIT_BRANCH == $CI_DEFAULT_BRANCH)
variables:
RUNNER_TAG: shellback
CI_ENVIRONMENT_URL: "esgf-node.ornl.gov"
ENVIRONMENT_NAME: Production
NAMESPACE: "cli137"
RELEASENAME: "$PROJECT_SLUG"
HELM_CHANNEL: stable
PIPELINE_TYPE: production
# HELM_EXTRA_ARGS: >-
# --kube-apiserver=https://api.onyx.ccs.ornl.gov:443
# --kube-token=$CLI137_RUNNER_TOKEN
.Container Matrix:
- DOCKERFILE: Django.dockerfile
CONTEXT: metagrid-upstream/backend
IMAGE_URL: $IMAGE_REGISTRY/django:$IMAGE_TAG
GIT_SUBMODULE_STRATEGY: recursive
KUBERNETES_MEMORY_REQUEST: 2G
KUBERNETES_MEMORY_LIMIT: 2G
- DOCKERFILE: React.dockerfile
CONTEXT: $CI_PROJECT_DIR
IMAGE_URL: $IMAGE_REGISTRY/react:$IMAGE_TAG
GIT_SUBMODULE_STRATEGY: none
NPM Build:
image: node:16
variables:
GIT_SUBMODULE_STRATEGY: recursive
NODE_OPTIONS: --max-old-space-size=1024
KUBERNETES_MEMORY_LIMIT: 3G
KUBERNETES_MEMORY_REQUEST: 2G
rules:
- when: on_success
artifacts:
paths:
- metagrid-upstream/frontend/build
script:
- |
cd metagrid-upstream/frontend
# Create React App apps can't read runtime variables, they have to
# be baked in at build time
echo "REACT_APP_METAGRID_API_URL=https://$CI_ENVIRONMENT_URL" >> .envs/.prod.env
echo "REACT_APP_WGET_API_URL=https://$CI_ENVIRONMENT_URL/esg-search/wget" >> .envs/.prod.env
echo "REACT_APP_ESGF_NODE_URL=https://$CI_ENVIRONMENT_URL/esg-search/search" >> .envs/.prod.env
echo "REACT_APP_SEARCH_URL=https://$CI_ENVIRONMENT_URL/esg-search/search" >> .envs/.prod.env
echo "REACT_APP_ESGF_NODE_STATUS_URL=https://aims4.llnl.gov/prometheus/api/v1/query?query=probe_success%7Bjob%3D%22http_2xx%22%2C+target%3D~%22.%2Athredds.%2A%22%7D" >> .envs/.prod.env
echo "REACT_APP_KEYCLOAK_REALM=esgf" >> .envs/.prod.env
echo "REACT_APP_KEYCLOAK_URL=https://login.esgf.io/" >> .envs/.prod.env
echo "REACT_APP_KEYCLOAK_CLIENT_ID=esgf-node-ornl-gov" >> .envs/.prod.env
echo "GENERATE_SOURCEMAP=false" >> .envs/.prod.env
yarn install --frozen-lock-file
yarn build:production
- mkdir -p build/.well-known
- npx @cyclonedx/cyclonedx-npm --ignore-npm-errors --output-reproducible --output-file build/.well-known/bom package.json
Build Chart:
variables:
KUBERNETES_MEMORY_REQUEST: 512M
KUBERNETES_MEMORY_LIMIT: 512M
Deploy Environment:
variables:
KUBERNETES_MEMORY_LIMIT: 512M
KUBERNETES_MEMORY_REQUEST: 512M
before_script:
- >-
kubectl delete secret
--ignore-not-found
--namespace $NAMESPACE
--selector $RELEASENAME
--selector 'status in (pending-install, pending-upgrade, failed)'
--server https://api.onyx.ccs.ornl.gov:443
--token $CLI137_RUNNER_TOKEN
Parse Sitemap:
script:
- echo "https://${CI_ENVIRONMENT_URL}/" >> $URL_LIST_FILE
- echo "https://${CI_ENVIRONMENT_URL}/search" >> $URL_LIST_FILE