-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy path.gitlab-ci.yml
50 lines (45 loc) · 1.07 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
variables:
DOCKER_DRIVER: overlay2
DOCKER_TLS_CERTDIR: "/certs"
CONTAINER_IMAGE: "$CI_REGISTRY_USER/load-tester"
stages:
- test
- build
- push
test:
image: python:3.9-slim
stage: test
script:
- pip install -r requirements.txt
- python test_loadtester.py
.docker-in-docker:
image: docker:20.10.8
services:
- docker:20.10.8-dind
before_script:
- docker login -u "$CI_REGISTRY_USER" -p "$CI_REGISTRY_PASSWORD"
build:
extends: .docker-in-docker
stage: build
dependencies:
- test
script:
- docker build -t $CONTAINER_IMAGE:$CI_COMMIT_SHORT_SHA .
- docker save $CONTAINER_IMAGE:$CI_COMMIT_SHORT_SHA -o docker-image.tar
artifacts:
paths:
- docker-image.tar
cache:
key: "$CI_COMMIT_REF_NAME"
paths:
- cache/
push:
extends: .docker-in-docker
stage: push
dependencies:
- build
script:
- docker load -i docker-image.tar
- docker tag $CONTAINER_IMAGE:$CI_COMMIT_SHORT_SHA $CONTAINER_IMAGE:latest
- docker push $CONTAINER_IMAGE:$CI_COMMIT_SHORT_SHA
- docker push $CONTAINER_IMAGE:latest