-
Notifications
You must be signed in to change notification settings - Fork 2
/
.gitlab-ci.yml
52 lines (45 loc) · 1.09 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
image: node:latest
stages:
- build
- test
- containerize
- deploy
cache:
paths:
- node_modules/
install-dependencies:
stage: build
tags:
- gitlab-org
script: yarn
artifacts:
paths:
- node_modules/
run-tests:
stage: test
tags:
- gitlab-org
script: yarn run coverage
build-and-push-docker-image:
stage: containerize
tags:
- docker
image: docker:git
services:
- docker:dind
before_script:
- docker login -u $DOCKERHUB_LOGIN -p $DOCKERHUB_PASSWORD
script:
- docker pull $DOCKERHUB_REGISTRY_IMAGE:$CI_COMMIT_REF_SLUG || true
- docker build --cache-from $DOCKERHUB_REGISTRY_IMAGE:$CI_COMMIT_REF_SLUG --tag $DOCKERHUB_REGISTRY_IMAGE:$CI_COMMIT_REF_SLUG .
- docker push $DOCKERHUB_REGISTRY_IMAGE:$CI_COMMIT_REF_SLUG
deploy-to-cluster:
stage: deploy
only: [master]
tags:
- omnibot-builder
image: greenchill/kubernetes-deploy:master
script:
- sed -i "s/<COMMIT_SHA>/${CI_COMMIT_SHA}/g" $DEPLOYMENT_MANIFEST
- sed -i "s/<VERSION>/${CI_COMMIT_REF_SLUG}/g" $DEPLOYMENT_MANIFEST
- kubectl apply -f $DEPLOYMENT_MANIFEST