-
Notifications
You must be signed in to change notification settings - Fork 2
/
.gitlab-ci.yml
147 lines (128 loc) · 3.52 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
138
139
140
141
142
143
144
145
146
147
image: golang:1.19
include:
- template: Security/SAST.gitlab-ci.yml
variables:
DOCKER_FILE: "Dockerfile"
stages:
- test
- build-binary
- build-image
test:
stage: test
script:
- make vet
- make test
lint:
stage: test
script:
- make lint
build-binary:
stage: build-binary
only:
refs:
- branches
- tags
artifacts:
paths:
- bin
script:
- make build
- make build-ee
.job_template: &build_image_definition
image: docker:19
stage: build-image
artifacts:
paths:
- bin
services:
- docker:dind
script:
- apk add --no-cache bash # TODO(anatoly): Remove dependency.
- bash ./scripts/ci_docker_build_push.sh
.only_var_template: &only_tag_release
only:
variables:
- $CI_COMMIT_TAG =~ /^[0-9.]+$/
.only_var_template: &only_tag_rc
only:
variables:
- $CI_COMMIT_TAG =~ /^[0-9.]+[\-_]*[a-zA-Z]+[a-zA-Z0-9.\-_]*[a-zA-Z0-9]+$/
.only_var_template: &only_master
only:
- master
.only_var_template: &only_feature
only:
variables:
- $CI_COMMIT_TAG == null
- $CI_COMMIT_REF_SLUG != "master"
build-image-feature:
<<: *build_image_definition
<<: *only_feature
variables:
REGISTRY_USER: "${CI_REGISTRY_USER}"
REGISTRY_PASSWORD: "${CI_REGISTRY_PASSWORD}"
REGISTRY: "${CI_REGISTRY}"
DOCKER_NAME: "registry.gitlab.com/postgres-ai/joe"
TAGS: "${DOCKER_NAME}:${CI_COMMIT_REF_SLUG}"
build-image-master:
<<: *build_image_definition
<<: *only_master
variables:
DOCKER_NAME: "registry.gitlab.com/postgres-ai/joe"
TAGS: "${DOCKER_NAME}:master,${DOCKER_NAME}:master-${CI_COMMIT_SHORT_SHA}"
build-image-latest:
<<: *build_image_definition
<<: *only_tag_release
variables:
REGISTRY_USER: "${DH_CI_REGISTRY_USER}"
REGISTRY_PASSWORD: "${DH_CI_REGISTRY_PASSWORD}"
REGISTRY: "${DH_CI_REGISTRY}"
DOCKER_NAME: postgresai/joe
TAGS: "${DOCKER_NAME}:latest,${DOCKER_NAME}:${CI_COMMIT_TAG}"
build-image-latest-dev-registry:
<<: *build_image_definition
<<: *only_tag_release
variables:
REGISTRY_USER: "${CI_REGISTRY_USER}"
REGISTRY_PASSWORD: "${CI_REGISTRY_PASSWORD}"
REGISTRY: "${CI_REGISTRY}"
DOCKER_NAME: "registry.gitlab.com/postgres-ai/joe"
TAGS: "${DOCKER_NAME}:${CI_COMMIT_TAG}"
build-image-release-dev-registry-ee:
<<: *build_image_definition
<<: *only_tag_release
variables:
REGISTRY_USER: "${CI_REGISTRY_USER}"
REGISTRY_PASSWORD: "${CI_REGISTRY_PASSWORD}"
REGISTRY: "${CI_REGISTRY}"
DOCKER_NAME: "registry.gitlab.com/postgres-ai/joe"
DOCKER_FILE: "Dockerfile.ee"
TAGS: "${DOCKER_NAME}:${CI_COMMIT_TAG}-ee"
build-image-rc:
<<: *build_image_definition
<<: *only_tag_rc
variables:
REGISTRY_USER: "${DH_CI_REGISTRY_USER}"
REGISTRY_PASSWORD: "${DH_CI_REGISTRY_PASSWORD}"
REGISTRY: "${DH_CI_REGISTRY}"
DOCKER_NAME: postgresai/joe
TAGS: "${DOCKER_NAME}:${CI_COMMIT_TAG}"
build-image-rc-dev-registry:
<<: *build_image_definition
<<: *only_tag_rc
variables:
REGISTRY_USER: "${CI_REGISTRY_USER}"
REGISTRY_PASSWORD: "${CI_REGISTRY_PASSWORD}"
REGISTRY: "${CI_REGISTRY}"
DOCKER_NAME: "registry.gitlab.com/postgres-ai/joe"
TAGS: "${DOCKER_NAME}:${CI_COMMIT_TAG}"
build-image-rc-dev-registry-ee:
<<: *build_image_definition
<<: *only_tag_rc
variables:
REGISTRY_USER: "${CI_REGISTRY_USER}"
REGISTRY_PASSWORD: "${CI_REGISTRY_PASSWORD}"
REGISTRY: "${CI_REGISTRY}"
DOCKER_NAME: "registry.gitlab.com/postgres-ai/joe"
DOCKER_FILE: "Dockerfile.ee"
TAGS: "${DOCKER_NAME}:${CI_COMMIT_TAG}-ee"