-
Notifications
You must be signed in to change notification settings - Fork 5
/
Copy path.gitlab-ci.yml
54 lines (46 loc) · 1.26 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
# One of the new trends in Continuous Integration/Deployment is to:
# (see https://docs.gitlab.com/ee/ci/docker/using_docker_build.html)
#
# 1. Create an application image
# 2. Run tests against the created image
# 3. Push image to a remote registry
# 4. Deploy to a server from the pushed image
stages:
- build
- test
- push
- deploy
# see usage of Namespaces at https://docs.gitlab.com/ee/user/group/#namespaces
variables:
REGISTRY_GROUP_PROJECT: $CI_REGISTRY/root/restexamples
# see how to login at https://docs.gitlab.com/ee/ci/docker/using_docker_build.html#using-the-gitlab-container-registry
before_script:
- docker login -u $CI_REGISTRY_USER -p $CI_JOB_TOKEN $CI_REGISTRY
build-image:
stage: build
# the tag 'shell' advices only GitLab runners using this tag to pick up that job
tags:
- shell
script:
- docker build . --tag $REGISTRY_GROUP_PROJECT/restexamples:latest
test-image:
stage: test
tags:
- shell
script:
- echo Insert fancy API test here!
push-image:
stage: push
tags:
- shell
script:
- docker push $REGISTRY_GROUP_PROJECT/restexamples:latest
deploy-2-dev:
stage: deploy
tags:
- shell
script:
- echo You should use Ansible here!
environment:
name: dev
url: https://dev.jonashackt.io