-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy path.gitlab-ci.yml
71 lines (63 loc) · 1.75 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
stages:
- lint
- test
- build
- publish
- deploy
- post-deployment
variables:
TAG_LATEST: $CI_REGISTRY_IMAGE/$CI_COMMIT_REF_NAME:latest
TAG_COMMIT: $CI_REGISTRY_IMAGE/$CI_COMMIT_REF_NAME:$CI_COMMIT_SHORT_SHA
lint:
image: cytopia/golint
tags:
- gitlab-org-docker
stage: lint
script:
- golint -set_exit_status $(go list ./... | grep -v /vendor/)
test:
image: golang:latest
tags:
- gitlab-org-docker
stage: test
script:
- go test -short $(go list ./... | grep -v /vendor/)
- go test -race -short $(go list ./... | grep -v /vendor/)
- go test -msan -short $(go list ./... | grep -v /vendor/)
build:
image:
name: gcr.io/kaniko-project/executor:debug
entrypoint: [""]
variables:
DOCKER_IMAGE: $CI_REGISTRY_IMAGE/$CI_COMMIT_REF_SLUG:$CI_COMMIT_SHA
script:
- base64 -d $GCP_SA_KEY | docker login -u _json_key --password-stdin https://gcr.io
- docker build --build-arg targetApp=listing_server --cache-from -t gcr.io/nextwave-drop/gitlab.com/nextwavedevs/drop/listingserver:$CI_COMMIT_SHA $DOCKER_IMAGE
- docker push gcr.io/nextwave-drop/gitlab.com/nextwavedevs/drop/listingserver:$CI_COMMIT_SHA
stage: build
deploy:
image: alpine:latest
tags:
- gitlab-org-docker
stage: deploy
script:
- docker login -u gitlab-ci-token -p $CI_BUILD_TOKEN $CI_REGISTRY
- docker pull $TAG_COMMIT
- docker container rm -f drop-api || true
- docker run -d -p 80:80 --name drop-api $TAG_COMMIT
environment:
name: test
url: http://$SERVER_IP
only:
- main
post-deployment-testing:
image: newman:latest
needs:
- deploy
tags:
- gitlab-org-docker
stage: post-deployment
script:
- newman run Dropp.postman_collection.json
only:
- main