1515 script :
1616 - make lint
1717
18+ .only_var_template : &only_tag_release
19+ only :
20+ variables :
21+ - $CI_COMMIT_TAG =~ /^[0-9.]+$/
22+
23+ .only_var_template : &only_tag_rc
24+ only :
25+ variables :
26+ - $CI_COMMIT_TAG =~ /^[0-9.]+[\-_]*[a-zA-Z]+[a-zA-Z0-9.\-_]*[a-zA-Z0-9]+$/
27+
28+ .only_var_template : &only_master
29+ only :
30+ - master
31+
32+ .only_var_template : &only_feature
33+ only :
34+ refs :
35+ - branches
36+ variables :
37+ - $CI_COMMIT_REF_SLUG != "master"
38+
1839build-binary-alpine :
1940 image : golang:1.13-alpine
2041 stage : build-binary
@@ -26,20 +47,35 @@ build-binary-alpine:
2647 paths :
2748 - bin
2849 script :
29- - go build -o bin/dblab-server-alpine ./cmd/database-lab/main.go
30- - go build -o bin/dblab-alpine ./cmd/cli/main.go
50+ - apk add --update --no-cache make
51+ - make build
3152
32- build-binary-generic :
53+ build-binary-client-linux :
54+ << : *only_feature
3355 stage : build-binary
34- only :
35- refs :
36- - branches
37- - tags
3856 artifacts :
3957 paths :
4058 - bin
4159 script :
42- - make build-generic
60+ - go build -o bin/dblab-linux-amd64 ./cmd/cli/main.go
61+
62+ build-binary-client :
63+ << : *only_tag_release
64+ stage : build-binary
65+ script :
66+ - make build-client
67+
68+ # Install google-cloud-sdk.
69+ - echo "deb [signed-by=/usr/share/keyrings/cloud.google.gpg] http://packages.cloud.google.com/apt cloud-sdk main" | tee -a /etc/apt/sources.list.d/google-cloud-sdk.list
70+ - curl https://packages.cloud.google.com/apt/doc/apt-key.gpg | apt-key --keyring /usr/share/keyrings/cloud.google.gpg add -
71+ - apt-get update && apt-get install -y google-cloud-sdk
72+
73+ # Authenticate.
74+ - echo $GCP_SERVICE_KEY | gcloud auth activate-service-account --key-file=-
75+
76+ # Upload artifacts.
77+ - gsutil -m cp -r bin/cli/* gs://database-lab-cli/${CI_COMMIT_TAG}/
78+ - gsutil -m cp -r bin/cli/* gs://database-lab-cli/latest/
4379
4480.job_template : &build_image_definition
4581 image : docker:19
@@ -53,27 +89,6 @@ build-binary-generic:
5389 - apk update && apk upgrade && apk add --no-cache bash # TODO(anatoly): Remove dependency.
5490 - bash ./scripts/ci_docker_build_push.sh
5591
56- .only_var_template : &only_tag_release
57- only :
58- variables :
59- - $CI_COMMIT_TAG =~ /^[0-9.]+$/
60-
61- .only_var_template : &only_tag_rc
62- only :
63- variables :
64- - $CI_COMMIT_TAG =~ /^[0-9.]+[\-_]*[a-zA-Z]+[a-zA-Z0-9.\-_]*[a-zA-Z0-9]+$/
65-
66- .only_var_template : &only_master
67- only :
68- - master
69-
70- .only_var_template : &only_feature
71- only :
72- refs :
73- - branches
74- variables :
75- - $CI_COMMIT_REF_SLUG != "master"
76-
7792build-image-feature-server :
7893 << : *build_image_definition
7994 << : *only_feature
@@ -84,8 +99,6 @@ build-image-feature-server:
8499 DOCKER_FILE : " Dockerfile.dblab-server"
85100 DOCKER_NAME : " registry.gitlab.com/postgres-ai/database-lab/dblab-server"
86101 TAGS : " ${DOCKER_NAME}:${CI_COMMIT_REF_SLUG}"
87- before_script :
88- - cp ./bin/dblab-server-alpine ./bin/dblab-server
89102
90103build-image-feature-client :
91104 << : *build_image_definition
@@ -97,8 +110,6 @@ build-image-feature-client:
97110 DOCKER_FILE : " Dockerfile.dblab"
98111 DOCKER_NAME : " registry.gitlab.com/postgres-ai/database-lab/dblab"
99112 TAGS : " ${DOCKER_NAME}:${CI_COMMIT_REF_SLUG}"
100- before_script :
101- - cp ./bin/dblab-alpine ./bin/dblab
102113
103114build-image-feature-client-extended :
104115 << : *build_image_definition
@@ -120,8 +131,6 @@ build-image-master-server:
120131 DOCKER_FILE : " Dockerfile.dblab-server"
121132 DOCKER_NAME : " registry.gitlab.com/postgres-ai/database-lab/dblab-server"
122133 TAGS : " ${DOCKER_NAME}:master,${DOCKER_NAME}:master-${CI_COMMIT_SHORT_SHA}"
123- before_script :
124- - cp ./bin/dblab-server-alpine ./bin/dblab-server
125134
126135build-image-master-client :
127136 << : *build_image_definition
@@ -130,8 +139,6 @@ build-image-master-client:
130139 DOCKER_FILE : " Dockerfile.dblab"
131140 DOCKER_NAME : " registry.gitlab.com/postgres-ai/database-lab/dblab"
132141 TAGS : " ${DOCKER_NAME}:master,${DOCKER_NAME}:master-${CI_COMMIT_SHORT_SHA}"
133- before_script :
134- - cp ./bin/dblab-alpine ./bin/dblab
135142
136143build-image-latest-server :
137144 << : *build_image_definition
@@ -143,8 +150,6 @@ build-image-latest-server:
143150 DOCKER_FILE : " Dockerfile.dblab-server"
144151 DOCKER_NAME : " postgresai/dblab-server"
145152 TAGS : " ${DOCKER_NAME}:latest,${DOCKER_NAME}:${CI_COMMIT_TAG}"
146- before_script :
147- - cp ./bin/dblab-server-alpine ./bin/dblab-server
148153
149154build-image-latest-client :
150155 << : *build_image_definition
@@ -156,8 +161,6 @@ build-image-latest-client:
156161 DOCKER_FILE : " Dockerfile.dblab"
157162 DOCKER_NAME : " postgresai/dblab"
158163 TAGS : " ${DOCKER_NAME}:latest,${DOCKER_NAME}:${CI_COMMIT_TAG}"
159- before_script :
160- - cp ./bin/dblab-alpine ./bin/dblab
161164
162165build-image-rc-server :
163166 << : *build_image_definition
@@ -169,8 +172,6 @@ build-image-rc-server:
169172 DOCKER_FILE : " Dockerfile.dblab-server"
170173 DOCKER_NAME : " postgresai/dblab-server"
171174 TAGS : " ${DOCKER_NAME}:${CI_COMMIT_TAG}"
172- before_script :
173- - cp ./bin/dblab-server-alpine ./bin/dblab-server
174175
175176build-image-rc-client :
176177 << : *build_image_definition
@@ -182,8 +183,6 @@ build-image-rc-client:
182183 DOCKER_FILE : " Dockerfile.dblab"
183184 DOCKER_NAME : " postgresai/dblab"
184185 TAGS : " ${DOCKER_NAME}:${CI_COMMIT_TAG}"
185- before_script :
186- - cp ./bin/dblab-alpine ./bin/dblab
187186
188187build-image-swagger-latest :
189188 << : *build_image_definition
0 commit comments