forked from UserOfficeProject/user-office-frontend
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy path.gitlab-ci.yml
70 lines (64 loc) · 2 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
image: node:10.17.0-alpine
cache:
key: 'alpine'
paths:
- node_modules/
stages:
- test
- build
- e2etest
- autodeploy
test:
stage: test
script:
- npm install
- NODE_ENV=ci npm run test
tags:
- docker
docker build:
image: docker:stable
stage: build
script:
- docker info
- docker build . -t dmsc/duo-frontend
- echo "$REGISTRY_PASSWORD" | docker login -u "$REGISTRY_USER" --password-stdin
- docker push dmsc/duo-frontend
tags:
- docker
e2etest:
image: tiangolo/docker-with-compose
stage: e2etest
script:
- echo "CI_COMMIT_BRANCH $CI_COMMIT_BRANCH"
- TAGS_JSON=$(curl -sb -H "Accept:application/json" "https://registry.hub.docker.com/v1/repositories/dmsc/duo-backend/tags")
- apk add jq
- TAG_COUNT=$(echo $TAGS_JSON | jq --arg "CI_COMMIT_BRANCH" $CI_COMMIT_BRANCH -c '.[] | select(.name==$CI_COMMIT_BRANCH)' | jq -s '. | length')
- if [ "$TAG_COUNT" != 0 ]; then export TAG=$CI_COMMIT_BRANCH; else export TAG=latest; fi
- echo "TAG $TAG"
- apk add git
- rm -rf duo-backend
- git clone https://gitlab.esss.lu.se/swap/duo-backend.git
- docker-compose -f docker-compose.e2e.yaml rm
- docker-compose -f docker-compose.e2e.yaml down --remove-orphans
- docker-compose -f docker-compose.e2e.yaml pull
- docker-compose -f docker-compose.e2e.yaml build
- docker-compose -f docker-compose.e2e.yaml up --exit-code-from cypress
- docker-compose -f docker-compose.e2e.yaml down
tags:
- docker
autodeploy:
image: ubuntu:latest
stage: autodeploy
script:
- echo $CI_COMMIT_SHA
- apt-get update -qq
- 'which ssh-agent || ( apt-get install -qq openssh-client )'
- eval $(ssh-agent -s)
- ssh-add <(echo "$SSH_PRIVATE_KEY_GEN")
- mkdir -p ~/.ssh
- '[[ -f /.dockerenv ]] && echo -e "Host *\n\tStrictHostKeyChecking no\n\n" > ~/.ssh/config'
- ssh [email protected] "/home/jekabskarklins/duo-kubernetes/frontend/autodeploy.sh dev"
tags:
- dind
only:
- develop