-
Notifications
You must be signed in to change notification settings - Fork 3
/
.gitlab-ci.yml
130 lines (117 loc) · 3.72 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
stages:
- Build
- Deploy
### Build ###
"Check Helm":
stage: Build
image: docker.aquaveo.com/tethys/kubernetes/helm-docker:0.7.1
variables:
GIT_SUBMODULE_STRATEGY: none
HELM_CHART: $CI_PROJECT_DIR/helm/gsprestapi
script:
# Ensure all required variables are set
- ": \"${HELM_CHART:?must be set}\""
- helm lint $HELM_CHART
- chmod +x ./check_helm_chart
- ./check_helm_chart $HELM_CHART
except:
- tags
- master
"Update Helm":
stage: Build
image: docker.aquaveo.com/tethys/kubernetes/helm-docker:0.7.1
variables:
GIT_SUBMODULE_STRATEGY: none
HELM_REPO_USERNAME: aquaveo
HELM_CHART: $CI_PROJECT_DIR/helm/gsprestapi
script:
# Ensure all required variables are set
- ": \"${HELM_CHART:?must be set}\""
- ": \"${HELM_KEY_PASSPHRASE:?must be set}\""
- ": \"${HELM_REPO_PASSWORD:?must be set}\""
- helm lint $HELM_CHART
- chmod +x ./check_helm_chart
- ./check_helm_chart $HELM_CHART --upload
only:
- master
.kaniko_build:
stage: Build
image:
name: gcr.io/kaniko-project/executor:debug-v0.23.0
entrypoint: [""]
variables:
GIT_SUBMODULE_STRATEGY: recursive
before_script:
- >
echo "{\"auths\":{
\"$CI_REGISTRY\": {\"username\":\"$CI_REGISTRY_USER\", \"password\":\"$CI_REGISTRY_PASSWORD\"},
\"eccr.ecmwf.int/harbor\": {\"username\":\"$ECCR_USER\", \"password\":\"$ECCR_PASSWORD\"}
}}" > /kaniko/.docker/config.json
script:
# Ensure all required variables are set
- ": \"${KANIKO_DOCKERFILE:?must be set}\""
- ": \"${KANIKO_CONTEXT:?must be set}\""
- ": \"${KANIKO_DESTINATIONS:?must be set}\""
# Run Kaniko
- export KANIKO_CMD="/kaniko/executor
--context $KANIKO_CONTEXT
--dockerfile $KANIKO_DOCKERFILE
$(for DEST in $KANIKO_DESTINATIONS; do echo "--destination $DEST "; done)
--cache=true
--cache-repo $CI_REGISTRY_IMAGE/cache
--force"
- echo $KANIKO_CMD
- $KANIKO_CMD
"Build Commit":
extends: .kaniko_build
variables:
GIT_SUBMODULE_STRATEGY: recursive
KANIKO_CONTEXT: $CI_PROJECT_DIR
KANIKO_DOCKERFILE: $CI_PROJECT_DIR/Dockerfile
KANIKO_DESTINATIONS: $CI_REGISTRY_IMAGE/dev:$CI_COMMIT_SHORT_SHA
except:
- tags
"Build Tag":
extends: .kaniko_build
variables:
GIT_SUBMODULE_STRATEGY: recursive
KANIKO_CONTEXT: $CI_PROJECT_DIR
KANIKO_DOCKERFILE: $CI_PROJECT_DIR/Dockerfile
KANIKO_DESTINATIONS: >
eccr.ecmwf.int/geoglows_api/geoglows_api:$CI_COMMIT_TAG
eccr.ecmwf.int/geoglows_api/geoglows_api:latest
only:
- tags
"Build Stable":
extends: .kaniko_build
variables:
KANIKO_CONTEXT: $CI_PROJECT_DIR
KANIKO_DOCKERFILE: $CI_PROJECT_DIR/Dockerfile
KANIKO_DESTINATIONS: eccr.ecmwf.int/geoglows_api/geoglows_api:stable
only:
- /^stable$/
### DEPLOY ###
"Deploy to Staging":
stage: Deploy
image: docker.aquaveo.com/tethys/kubernetes/helm-docker:2.0.0-rc1
dependencies: [] # Deploys do not depend on the Build phase artifacts
variables:
GIT_SUBMODULE_STRATEGY: none
script:
- echo ${CI_COMMIT_TAG}
- 'curl -X POST -H "Authorization: Bearer ${ECCR_GEOGLOWS_TOKEN}" -d "bamboo.COMMIT_TAG=${CI_COMMIT_TAG}" https://bamboo.ecmwf.int/rest/api/latest/queue/GEOGLOWS-GSPRES0'
when: manual
only:
- tags
"Deploy to Production":
stage: Deploy
image: docker.aquaveo.com/tethys/kubernetes/helm-docker:2.0.0-rc1
dependencies: [] # Deploys do not depend on the Build phase artifacts
variables:
GIT_SUBMODULE_STRATEGY: none
script:
- echo ${CI_COMMIT_TAG}
- 'curl -X POST -H "Authorization: Bearer ${ECCR_GEOGLOWS_TOKEN}" -d "bamboo.COMMIT_TAG=${CI_COMMIT_TAG}" https://bamboo.ecmwf.int/rest/api/latest/queue/GEOGLOWS-GSPRES1'
when: manual
only:
- tags