-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy path.gitlab-ci.yml
129 lines (119 loc) · 3.48 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
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
---
stages:
- build
- tests
- publish
variables:
BJOERN_IMAGE: "${CI_REGISTRY_IMAGE}/${CI_PROJECT_NAME}-bjoern:${CI_COMMIT_SHORT_SHA}"
GUNICORN_IMAGE: "${CI_REGISTRY_IMAGE}/${CI_PROJECT_NAME}-gunicorn:${CI_COMMIT_SHORT_SHA}"
UVICORN_IMAGE: "${CI_REGISTRY_IMAGE}/${CI_PROJECT_NAME}-uvicorn:${CI_COMMIT_SHORT_SHA}"
build containers:
stage: build
interruptible: true
image: quay.io/containers/buildah
variables:
BUILDAH_ISOLATION: chroot
BUILDAH_LAYERS: "true"
BJOERN_IMAGE_LATEST: "${CI_REGISTRY_IMAGE}/${CI_PROJECT_NAME}-bjoern:latest"
GUNICORN_IMAGE_LATEST: "${CI_REGISTRY_IMAGE}/${CI_PROJECT_NAME}-gunicorn:latest"
UVICORN_IMAGE_LATEST: "${CI_REGISTRY_IMAGE}/${CI_PROJECT_NAME}-uvicorn:latest"
before_script:
- buildah version
- buildah info
- buildah login
--username "${CI_REGISTRY_USER}"
--password "${CI_REGISTRY_PASSWORD}"
"${CI_REGISTRY}"
script:
- buildah build
--cache-from "${CI_REGISTRY_IMAGE}/cache"
--cache-to "${CI_REGISTRY_IMAGE}/cache"
--tag "${BJOERN_IMAGE}"
--file bjoern.Dockerfile
.
- buildah push
"${BJOERN_IMAGE}"
- buildah build
--cache-from "${CI_REGISTRY_IMAGE}/cache"
--cache-to "${CI_REGISTRY_IMAGE}/cache"
--tag "${GUNICORN_IMAGE}"
--file gunicorn.Dockerfile
.
- buildah push
"${GUNICORN_IMAGE}"
- buildah build
--cache-from "${CI_REGISTRY_IMAGE}/cache"
--cache-to "${CI_REGISTRY_IMAGE}/cache"
--tag "${UVICORN_IMAGE}"
--file uvicorn.Dockerfile
.
- buildah push
"${UVICORN_IMAGE}"
- |
if [ "$CI_COMMIT_BRANCH" == "$CI_DEFAULT_BRANCH" ]; then
buildah tag "${BJOERN_IMAGE}" "${BJOERN_IMAGE_LATEST}"
buildah push "${BJOERN_IMAGE_LATEST}"
buildah tag "${GUNICORN_IMAGE}" "${GUNICORN_IMAGE_LATEST}"
buildah push "${GUNICORN_IMAGE_LATEST}"
buildah tag "${UVICORN_IMAGE}" "${UVICORN_IMAGE_LATEST}"
buildah push "${UVICORN_IMAGE_LATEST}"
fi
after_script:
- buildah logout --all
test bjoern:
stage: tests
interruptible: true
image: "${CI_DEPENDENCY_PROXY_GROUP_IMAGE_PREFIX}/python:3.12"
services:
- name: "${BJOERN_IMAGE}"
alias: python-server
before_script:
- pip install poetry
- poetry install --no-root --no-interaction --no-ansi --only=dev
- mkdir results
script:
- poetry run locust --config=test.conf --html results/bjoern-locust-report.html
artifacts:
expire_in: 10 mins
paths: [results/]
test gunicorn:
stage: tests
interruptible: true
image: "${CI_DEPENDENCY_PROXY_GROUP_IMAGE_PREFIX}/python:3.12"
services:
- name: "${GUNICORN_IMAGE}"
alias: python-server
before_script:
- pip install poetry
- poetry install --no-root --no-interaction --no-ansi --only=dev
- mkdir results
script:
- poetry run locust --config=test.conf --html results/gunicorn-locust-report.html
artifacts:
expire_in: 10 mins
paths: [results/]
test uvicorn:
stage: tests
interruptible: true
image: "${CI_DEPENDENCY_PROXY_GROUP_IMAGE_PREFIX}/python:3.12"
services:
- name: "${UVICORN_IMAGE}"
alias: python-server
before_script:
- pip install poetry
- poetry install --no-root --no-interaction --no-ansi --only=dev
- mkdir results
script:
- poetry run locust --config=test.conf --html results/uvicorn-locust-report.html
artifacts:
expire_in: 10 mins
paths: [results/]
pages:
stage: publish
script:
- mv results public
artifacts:
paths:
- public
rules:
- if: $CI_COMMIT_BRANCH == $CI_DEFAULT_BRANCH