-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy path.gitlab-ci.yml
More file actions
54 lines (49 loc) · 1.18 KB
/
.gitlab-ci.yml
File metadata and controls
54 lines (49 loc) · 1.18 KB
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
variables:
MYSQL_ROOT_PASSWORD: $DB_ROOT_PASSWORD
MYSQL_DATABASE: $DB_NAME
MYSQL_USER: $DB_USER
MYSQL_PASSWORD: $DB_PASSWORD
stages:
- test
- build
- push
- deploy
test-job:
stage: test
services:
- name: public.jlinux.ir/database/mysql:8.0
alias: db
# command: ["--default-authentication-plugin=mysql_native_password"]
image: public.jlinux.ir/language/go/golang:1.19
before_script:
- "make install-requirements"
script:
- "echo Run Test"
- "make test"
build-job:
stage: build
before_script:
- "apk update && apk add make"
script:
- "make build-images"
push-job:
stage: push
before_script:
- "apk update && apk add make"
- "make docker-login"
script:
- "make push-images"
deploy-job:
stage: deploy
before_script:
- "apk update && apk add make && apk add curl"
- "(command -v ssh-agent > /dev/null) || (apk add openssh)"
- "eval $(ssh-agent -s)"
- echo "$SSH_PRIVATE_KEY" | tr -d '\r' | ssh-add -
- "mkdir -p ~/.ssh"
- "chmod 700 ~/.ssh"
- "ssh-keyscan $SERVER_IP >> ~/.ssh/known_hosts"
- "chmod 400 ~/.ssh/known_hosts"
script:
- "echo deploy to Production"
- "make production-up"