-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy path.gitlab-ci.yml
140 lines (125 loc) · 3.43 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
130
131
132
133
134
135
136
137
138
139
140
include:
- https://gitlab.exphost.pl/exphost/exphost-helms/-/raw/master/common/gitlab-ci.yml
- https://gitlab.exphost.pl/exphost-controller/controller-helms/-/raw/master/helpers/gitlab-ci.yml
stages:
- prepare
- tests
- build
- push
- deploy_to_dev
- deploy
- cleanup
- upload
get version:
extends: .get version
tests:
stage: tests
image: python:3.9
script:
- apt-get update && apt-get -y install libldap2-dev libsasl2-dev libcrack2-dev && apt-get clean
- pip install -r requirements.txt
- mkdir /srv/dicts
- pushd /srv/dicts
- wget https://github.com/danielmiessler/SecLists/raw/master/Passwords/Common-Credentials/10-million-password-list-top-1000000.txt
- cracklib-format < 10-million-password-list-top-1000000.txt | cracklib-packer dict.db
- popd
- cd app
- git clone https://gitlab.exphost.pl/exphost-controller/apispec.git
- flake8
- pytest --cov --cov-report term --cov-report xml --junitxml=report.xml
artifacts:
reports:
cobertura: coverage.xml
junit: report.xml
variables:
PIP_CACHE_DIR: "$CI_PROJECT_DIR/.cache/pip"
cache:
paths:
- .cache/pip
helm lint:
stage: tests
image: alpine/helm
script:
- helm lint chart
.registry:
before_script:
- echo -n $CI_REGISTRY_PASSWORD | podman login -u $CI_REGISTRY_USER --password-stdin $CI_REGISTRY
build:
stage: build
image: quay.io/podman/stable
extends: .registry
script:
- podman pull $CI_REGISTRY_IMAGE:dev || true
- >
podman build
--pull
--build-arg http_proxy=$http_proxy
--build-arg https_proxy=$https_proxy
--build-arg no_proxy=$no_proxy
--tag $CI_REGISTRY_IMAGE:dev
.
- podman push $CI_REGISTRY_IMAGE:dev
push latest:
variables:
GIT_STRATEGY: none
image: quay.io/podman/stable
stage: push
extends: .registry
only:
- master
script:
- podman pull $CI_REGISTRY_IMAGE:dev
- podman tag $CI_REGISTRY_IMAGE:dev $CI_REGISTRY_IMAGE:latest
- podman push $CI_REGISTRY_IMAGE:latest
- "podman tag $CI_REGISTRY_IMAGE:dev $CI_REGISTRY_IMAGE:$(cat output/version.txt)"
- "podman push $CI_REGISTRY_IMAGE:$(cat output/version.txt)"
push tag:
variables:
GIT_STRATEGY: none
image: quay.io/podman/stable
stage: push
extends: .registry
only:
- tags
script:
- podman pull $CI_REGISTRY_IMAGE:dev
- podman tag $CI_REGISTRY_IMAGE:dev $CI_REGISTRY_IMAGE:$CI_COMMIT_REF_NAME
- podman push $CI_REGISTRY_IMAGE:$CI_COMMIT_REF_NAME
#deploy_to_dev:
# image: bitnami/kubectl
# stage: deploy_to_dev
# script:
# - kubectl -n tenant-exphost-controller rollout restart deployment tenant-exphost-controller-exphost-controller-usersservice
# - kubectl -n tenant-exphost-controller rollout status deployment tenant-exphost-controller-exphost-controller-usersservice
# environment:
# name: dev
upload:
extends: .upload
only:
refs:
- tags
- master
upload latest:
extends: .upload latest
only:
refs:
- tags
- master
deploy branch:
extends: .deploy branch
variables:
APP: usersservice
delete_app:
extends: .delete_app
variables:
APP: usersservice
update general helm:
extends: .deploy-to-git
stage: upload
variables:
patch_cmd: yq -i e ".dependencies[] |= select(.name == \"usersservice\").version=\"$$VERSION\"" chart/Chart.yaml
repo: [email protected]:exphost-controller/controller-helms.git
only:
refs:
- tags
- master