-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy path.gitlab-ci.yml
139 lines (115 loc) · 3.06 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
# .gitlab-ci.yaml
stages:
- test
- build
test py39:
stage: test
image: pcr.teskalabs.com/python:3.9
tags:
- docker
script:
- apt-get update
- pip install --upgrade pip
- pip install asab
test py310:
stage: test
image: pcr.teskalabs.com/python:3.10
tags:
- docker
script:
- apt-get update
- pip install --upgrade pip
- pip install asab
test py311:
stage: test
image: pcr.teskalabs.com/python:3.11
tags:
- docker
script:
- apt-get update
- pip install --upgrade pip
- pip install asab
test flake:
stage: test
image: pcr.teskalabs.com/python:3.11
tags:
- docker
script:
- apt-get update
- pip install --upgrade pip
- pip install flake8
- python3 -m flake8 asabdiscovery
build docker:
stage: build
image: pcr.teskalabs.com/docker:24
tags:
# The shell Gitlab runner has to be used for this
- shell
variables:
GIT_SUBMODULE_STRATEGY: recursive
only:
# Execute only for master branch
- master
before_script:
- docker info
# We want to run in the clean environment
- docker system prune -f
script:
- docker build -t "$DOCKER_REGISTRY_IMAGE" --no-cache
--build-arg CI_COMMIT_BRANCH
--build-arg CI_COMMIT_TAG
--build-arg CI_COMMIT_REF_NAME
--build-arg CI_COMMIT_SHA
--build-arg CI_COMMIT_TIMESTAMP
--build-arg CI_JOB_ID
--build-arg CI_PIPELINE_CREATED_AT
--build-arg CI_RUNNER_ID
--build-arg CI_RUNNER_EXECUTABLE_ARCH
--build-arg GITHUB_HEAD_REF
--build-arg GITHUB_JOB
--build-arg GITHUB_SHA
--build-arg GITHUB_REPOSITORY
.
- docker login -u "$DOCKER_USER" -p "$DOCKER_PASSWORD" "$DOCKER_REGISTRY"
- docker push $DOCKER_REGISTRY_IMAGE
after_script:
# Clean-up
- docker container prune -f > /dev/null 2> /dev/null
- docker image prune -a -f > /dev/null 2> /dev/null
build docker-tags:
stage: build
image: pcr.teskalabs.com/docker:24
variables:
GIT_SUBMODULE_STRATEGY: normal
tags:
# The shell Gitlab runner has to be used for this
- shell
only:
- tags
before_script:
- docker info
# We want to run in the clean environment
- docker system prune -f
script:
- docker build -t "${CI_COMMIT_TAG}" --no-cache
--build-arg CI_COMMIT_BRANCH
--build-arg CI_COMMIT_TAG
--build-arg CI_COMMIT_REF_NAME
--build-arg CI_COMMIT_SHA
--build-arg CI_COMMIT_TIMESTAMP
--build-arg CI_JOB_ID
--build-arg CI_PIPELINE_CREATED_AT
--build-arg CI_RUNNER_ID
--build-arg CI_RUNNER_EXECUTABLE_ARCH
--build-arg GITHUB_HEAD_REF
--build-arg GITHUB_JOB
--build-arg GITHUB_SHA
--build-arg GITHUB_REPOSITORY
.
- docker tag "${CI_COMMIT_TAG}" "${DOCKER_REGISTRY_IMAGE}:${CI_COMMIT_TAG}"
- docker login -u "$DOCKER_USER" -p "$DOCKER_PASSWORD" "$DOCKER_REGISTRY"
- docker push "${DOCKER_REGISTRY_IMAGE}:${CI_COMMIT_TAG}"
after_script:
# Clean-up
- docker container prune -f > /dev/null 2> /dev/null
- docker image prune -a -f > /dev/null 2> /dev/null