-
Notifications
You must be signed in to change notification settings - Fork 5
/
Copy path.gitlab-ci.yml
95 lines (88 loc) · 3.18 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
stages:
- build
- test
variables:
img: registry.ops.mist.io/mistio/mist.tests
build:
stage: build
before_script:
# Configure registries.
- |
rm ~/.docker/config.json
export REGISTRIES=""
# Login to gitlab docker registry.
if [ -n "$CI_REGISTRY_IMAGE" ]; then
echo "Logging in to gitlab registry."
docker login -u "$CI_REGISTRY_USER" -p "$CI_REGISTRY_PASSWORD" \
$CI_REGISTRY
export REGISTRIES="$REGISTRIES $CI_REGISTRY_IMAGE"
echo "Logged in to gitlab registry."
else
echo "No credentials provided for gitlab registry, skipping."
fi
# Login to other registry.
if [ -n "$EXT_REGISTRY" ] && \
[ -n "$EXT_REGISTRY_IMAGE" ] && \
[ -n "$EXT_REGISTRY_USER" ] && \
[ -n "$EXT_REGISTRY_PASSWORD" ]
then
echo "Logging in to $EXT_REGISTRY."
docker login -u "$EXT_REGISTRY_USER" -p "$EXT_REGISTRY_PASSWORD" \
"$EXT_REGISTRY"
export REGISTRIES="$REGISTRIES $EXT_REGISTRY_IMAGE"
echo "Logged in to $EXT_REGISTRY."
else
echo "No credentials provided for external registry, skipping."
fi
# Login to dockerhub.
if [ -n "$DOCKERHUB_IMAGE" ] && \
[ -n "$DOCKERHUB_USER" ] && \
[ -n "$DOCKERHUB_PASSWORD" ]
then
echo "Logging in to dockerhub."
docker login -u "$DOCKERHUB_USER" -p "$DOCKERHUB_PASSWORD"
export REGISTRIES="$REGISTRIES $DOCKERHUB_IMAGE"
echo "Logged in to dockerhub."
else
echo "No credentials provided for dockerhub, skipping."
fi
# Check if any registry configured.
if [ -z "$REGISTRIES" ]; then
echo "No registries configured, exiting."
exit 1
fi
script:
- docker build --no-cache --rm -t $img:$CI_COMMIT_SHA .
- echo "Pushing $img:$CI_COMMIT_SHA"
- docker push $img:$CI_COMMIT_SHA
- docker tag $img:$CI_COMMIT_SHA $img:$CI_COMMIT_REF_SLUG
- docker tag $img:$CI_COMMIT_SHA mist/tests:$CI_COMMIT_SHA
- echo "Pushing $img:$CI_COMMIT_REF_SLUG"
- docker push $img:$CI_COMMIT_REF_SLUG
- echo "Pushing mist/tests:$CI_COMMIT_SHA"
- docker push mist/tests:$CI_COMMIT_SHA
- if [ "$CI_COMMIT_REF_SLUG" != master ]; then exit 0; fi
- docker tag $img:$CI_COMMIT_SHA $img:latest
- echo "Pushing $img:latest"
- docker push $img:latest
tags:
- builder
flake8:
stage: test
image: $img:$CI_COMMIT_SHA
variables:
GIT_STRATEGY: none
before_script:
- cd /mist.tests/
script:
- flake8 misttests/integration/api/mistrequests.py
- flake8 misttests/integration/api/main/secrets.py
- flake8 misttests/integration/api/utils.py
- flake8 misttests/integration/gui/steps/browser.py
- flake8 misttests/integration/gui/steps/images.py
- flake8 misttests/integration/gui/steps/networks.py
- flake8 misttests/integration/gui/steps/org_context.py
- flake8 misttests/integration/gui/steps/popups.py
- flake8 misttests/integration/gui/steps/scroll.py
- flake8 misttests/integration/gui/steps/setup.py
- flake8 misttests/integration/gui/steps/team.py