-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy path.gitlab-ci.yml
72 lines (66 loc) · 2.19 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
image: node:8
stages:
- test
- version
- build
- deploy
version:
stage: version
only:
- master
except:
- tags
- triggers
script:
- export CI_PUSH_REPO=`echo $CI_REPOSITORY_URL | perl -pe "s#(.*)\/\/(.*)@(.*)#\1\/\/yehiyam:${HKUBE_CI_TOKEN}@\3#"`
- export TMP_BRANCH_NAME=ci_processing_$CI_JOB_ID
- git checkout -b $TMP_BRANCH_NAME
- git remote set-url --push origin "$CI_PUSH_REPO"
- git config user.name "${GITLAB_USER_NAME}"
- git config user.email "${GITLAB_USER_EMAIL}"
- npm version patch -m "$(git log -1 --pretty=%B) .... bump version [skip ci]"
- echo push url "$TMP_BRANCH_NAME:${CI_COMMIT_REF_NAME}"
- git remote -v
- git push origin $TMP_BRANCH_NAME:${CI_COMMIT_REF_NAME} --follow-tags
- curl -X POST -F "token=${TRIGGER_TOKEN}" -F "ref=$(git describe --abbrev=0 --tags)" "https://gitlab.com/api/v4/projects/$CI_PROJECT_ID/trigger/pipeline"
build:
image: yehiyam/docker-node:8
services:
- docker:dind
stage: build
only:
- triggers
script:
# - npm --registry=http://npmhkube.ddns.net:4873 install
- echo ${HKUBE_CI_TOKEN} | docker login -u yehiyam --password-stdin registry.gitlab.com
- export PRIVATE_REGISTRY=registry.gitlab.com/greenapes/hkube/registry
- npm run build
deploy:
stage: deploy
only:
- triggers
script:
- VERSION=$(git describe --abbrev=0 --tags);VERSION=${VERSION%.*}
- MESSAGE="Triggered by ${CI_PROJECT_NAME:-Unknown}. $(git log -1 --pretty=%B)"
- curl -X POST -F "token=4c7785e026e9ce1cb8914b0add0ed2" -F "ref=master" "https://gitlab.com/api/v4/projects/4650308/trigger/pipeline"
#cache:
# paths:
# - node_modules/
.test:
stage: test
only:
- master
# services:
# - name: redis:latest
# alias: redis
# - name: quay.io/coreos/etcd:v2.3.8
# alias: etcd
# variables:
# ETCD_LISTEN_CLIENT_URLS: "http://0.0.0.0:2379,http://0.0.0.0:4001"
# ETCD_ADVERTISE_CLIENT_URLS: "http://etcd:2379,http://etcd:4001"
script:
- npm --registry http://npmhkube.ddns.net:4873 install
# - export ETCD_CLIENT_SERVICE_HOST=etcd
# - export REDIS_SERVICE_HOST=redis
# - wget -qO- http://${ETCD_CLIENT_SERVICE_HOST}:4001/version
# - NODE_ENV=test npm run test