-
Notifications
You must be signed in to change notification settings - Fork 0
/
.gitlab-ci.yml
106 lines (97 loc) · 2.78 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
stages:
- test
- build
- deploy
- integrationtests
variables:
CONTAINER_INTERNAL_PORT: "8080"
TEST_IMAGE_CONTAINER: "git.mygait.com:4567/cgaspard/seemless"
TEST_TAG: "qalatest"
TEST_EXTERNAL_PORT: "9001"
TEST_CONTAINER_NAME: "seemless-qa"
RELEASE_IMAGE_CONTAINER: "git.mygait.com:4567/cgaspard/seemless"
RELEASE_TAG: "latest"
RELEASE_EXTERNAL_PORT: "9002"
RELEASE_CONTAINER_NAME: "seemless-staging"
unit_tests:
stage: test
image: node:7.7.2
before_script:
- npm update --silent > /dev/null
- npm install --silent -g tape > /dev/null
- npm install --silent -g faucet > /dev/null
script:
- echo You are here
- tape tests/*.js | faucet
tags:
- nodejs-7.7.2
build-qa-container:
stage: build
before_script:
- docker info
script:
- docker login -u gitlab-ci-token -p $CI_BUILD_TOKEN git.mygait.com:4567
- docker build --file .dockerfile -t $TEST_TAG .
- docker push $TEST_IMAGE_CONTAINER:$TEST_TAG
only:
- dev
tags:
- shell
build-staging-container:
stage: build
before_script:
- docker info
script:
- docker login -u gitlab-ci-token -p $CI_BUILD_TOKEN git.mygait.com:4567
- docker build --file .dockerfile -t $RELEASE_TAG .
- docker push $RELEASE_IMAGE_CONTAINER:$RELEASE_TAG
only:
- master
tags:
- shell
deploy-qa-container:
stage: deploy
environment:
name: qa
url: http://172.24.32.6:$TEST_EXTERNAL_PORT/
before_script:
- docker info
script:
- docker login -u gitlab-ci-token -p $CI_BUILD_TOKEN git.mygait.com:4567
- docker pull $TEST_IMAGE_CONTAINER:$TEST_TAG
- docker stop $TEST_CONTAINER_NAME || true && docker rm $TEST_CONTAINER_NAME || true
- docker run --name=$TEST_CONTAINER_NAME --restart=always -p $TEST_EXTERNAL_PORT:$CONTAINER_INTERNAL_PORT -d $TEST_IMAGE_CONTAINER:$TEST_TAG --link
- docker
only:
- dev
tags:
- shell
when: manual
deploy-staging-container:
stage: deploy
environment:
name: staging
url: http://172.24.32.6/J111/
before_script:
- docker info
script:
- docker login -u gitlab-ci-token -p $CI_BUILD_TOKEN git.mygait.com:4567
- docker pull $RELEASE_IMAGE_CONTAINER:$RELEASE_TAG
- docker stop $RELEASE_CONTAINER_NAME || true && docker rm $RELEASE_CONTAINER_NAME || true
- docker run --name=$RELEASE_CONTAINER_NAME --restart=always -p $RELEASE_EXTERNAL_PORT:$CONTAINER_INTERNAL_PORT -d $RELEASE_IMAGE_CONTAINER:$RELEASE_TAG
only:
- master
tags:
- shell
when: manual
integration_tests:
stage: integrationtests
image: node:7.7.2
before_script:
- npm update --silent > /dev/null
- npm install --silent -g newman > /dev/null
script:
- export TESTURL=http://172.24.32.6/J111/; newman /path/to/json/file.json
tags:
- nodejs-7.7.2
shoulderror: false