-
Notifications
You must be signed in to change notification settings - Fork 7
/
Copy path.gitlab-ci.yml
74 lines (68 loc) · 2.11 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
variables:
GIT_SUBMODULE_STRATEGY: recursive
stages:
- build
- image
- test
- image_pass
build:
stage: build
image: microsoft/dotnet:2.1-sdk
script:
- ls -lh
- dotnet restore
- dotnet publish -c Release -o build maplestory.io
- ls -lh maplestory.io
artifacts:
name: "MapleStory.IO"
paths:
- maplestory.io/build
docker_image:
only:
- master
tags:
- docker
stage: image
image: docker:stable
services:
- docker:dind
script:
- docker login -u gitlab-ci-token -p ${CI_JOB_TOKEN} registry.crr.io
- echo ${CI_COMMIT_SHA} > SHA1.hash
- docker build -t registry.crr.io/${CI_PROJECT_PATH}:${CI_COMMIT_SHA} .
- docker push registry.crr.io/${CI_PROJECT_PATH}:${CI_COMMIT_SHA}
test:
stage: test
only:
- master
image: registry.crr.io/${CI_PROJECT_PATH}:${CI_COMMIT_SHA}
script:
- echo 'TODO More comprehensive tests once S3 migration is complete'
- sh /app/run.sh &
- /bin/wait-for-it.sh -t 120 127.0.0.1:5000
- curl --silent --show-error --fail -o /dev/null localhost:5000 && echo 'Successfully loaded home page'
- echo 'Being safe and ensuring forked process is disposed of' && kill $!
docker_image_latest:
stage: image_pass
only:
- master
tags:
- docker
image: docker:stable
services:
- docker:dind
script:
- docker login -u gitlab-ci-token -p ${CI_JOB_TOKEN} registry.crr.io
- docker pull registry.crr.io/${CI_PROJECT_PATH}:${CI_COMMIT_SHA}
- docker tag registry.crr.io/${CI_PROJECT_PATH}:${CI_COMMIT_SHA} registry.crr.io/${CI_PROJECT_PATH}:latest
- docker push registry.crr.io/${CI_PROJECT_PATH}:latest
kubernetes_deploy:
only:
- master
stage: image_pass
image: registry.crr.io/crrio/kubernetes-deploy:latest
environment:
name: maplestory.io
url: https://maplestory.io/
script:
- ~/kubectl set image deployment/io io=registry.crr.io/${CI_PROJECT_PATH}:${CI_COMMIT_SHA} --namespace=maplestory