-
Notifications
You must be signed in to change notification settings - Fork 4
/
.gitlab-ci.yml
130 lines (121 loc) · 4.46 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
image: docker.uib.gmbh/opsi/dev/pybuilder:deb9-py3.11
variables:
SKIP_TESTS: "false"
stages:
- test
- build
- integration_test
- publish
pytest-pylint:
stage: test
script:
- apt update
- apt -y install python3-newt gettext gzip asciidoc-base zstd
- poetry lock --no-update --no-cache
- poetry install
- poetry run ruff check opsiutils tests
- poetry run mypy opsiutils tests
- poetry run pytest --tb=short -o junit_family=xunit2 --junitxml=testreport.xml --cov-append --cov opsiutils --cov-report term --cov-report xml -v tests
rules:
- if: $CI_PIPELINE_SOURCE == "merge_request_event" # dont run on merge-requests
when: never
- if: $SKIP_TESTS == "false"
linux-amd64-pyinstaller:
stage: build
script:
- TRANSIFEX_MIN_REVIEW_RATE=0.0
- '[ "$CI_COMMIT_TAG" = "" ] || TRANSIFEX_MIN_REVIEW_RATE=1.0'
- apt update
- apt -y install python3-newt gettext gzip asciidoc-base zstd
- curl -o opsi-dev-tools.tar.gz "$OPSIDEVTOOLS_URL_LINUX_X64"
- tar -xvf opsi-dev-tools.tar.gz
- mv opsi-dev-tool opsi-dev-cli
- poetry lock --no-update --no-cache
- poetry install
- poetry run ./opsi-dev-cli -l info pyinstaller build
- '[ "$CI_COMMIT_TAG" = "" ] && poetry run ./opsi-dev-cli -l info binary push dist/opsi-utils --prerelease="$CI_JOB_ID"'
- '[ "$CI_COMMIT_TAG" = "" ] || poetry run ./opsi-dev-cli -l info binary push dist/opsi-utils'
- mv dist/opsi-utils ./opsi-utils-amd64
# Check if binary is working
- opsi-utils-amd64/opsi-admin --version
- ./opsi-dev-cli -l info binary pull
- mv opsi-cli opsi-utils-amd64
artifacts:
name: 'opsi-utils-linux-pyinstaller'
paths:
- opsi-utils-amd64
expire_in: 2 days
linux-arm64-pyinstaller:
stage: build
tags:
- linux-arm64
script:
- TRANSIFEX_MIN_REVIEW_RATE=0.0
- '[ "$CI_COMMIT_TAG" = "" ] || TRANSIFEX_MIN_REVIEW_RATE=1.0'
- apt update
- apt -y install python3-newt gettext gzip asciidoc-base zstd
- curl -o opsi-dev-tools.tar.gz "$OPSIDEVTOOLS_URL_LINUX_ARM64"
- tar -xvf opsi-dev-tools.tar.gz
- mv opsi-dev-tool opsi-dev-cli
- poetry lock --no-update --no-cache
- poetry install
- poetry run ./opsi-dev-cli -l info pyinstaller build
- mv dist/opsi-utils ./opsi-utils-arm64
# Check if binary is working
- OPSI_HOSTNAME=test.uib.local opsi-utils-arm64/opsi-admin --version
- ./opsi-dev-cli -l info binary pull
- mv opsi-cli opsi-utils-arm64
artifacts:
name: 'opsi-utils-arm64-pyinstaller'
paths:
- opsi-utils-arm64
expire_in: 2 days
integration_test:
services:
- name: mysql:8.3
command:
- --max_connections=1000
# - --mysql-native-password=ON
- --default-authentication-plugin=mysql_native_password
- name: redislabs/redistimeseries:latest
alias: redis
variables:
MYSQL_ROOT_PASSWORD: "opsi"
MYSQL_DATABASE: "opsitest"
MYSQL_USER: "opsi"
MYSQL_PASSWORD: "opsi"
MYSQL_HOST: mysql
REDIS_HOST: redis
OPSI_ADMIN_PASSWORD: vhahd8usaz
OPSI_HOST_ROLE: configserver
OPSI_HOST_ID: "test.uib.gmbh"
OPSI_TFTPBOOT: "false"
OPSICONFD_LOG_LEVEL: 6
OPSICONFD_RESTORE_BACKUP_URL: "http://binaryindex.uib.gmbh/development/testbackup/all/all/testbackup_all_all_1.1.tar.gz"
stage: integration_test
image:
name: docker.uib.gmbh/opsi/opsi-server:4.3-development
entrypoint: [""]
script:
- bash /entrypoint.sh &
- while ! nc -v -z -w3 localhost 4447 > /dev/null 2>&1; do sleep 1; done
- source /entrypoint.sh set_environment_vars # to set hosts for redis/grafana
- apt update
- apt -y install zstd
- for file in integration_tests/*.sh; do echo "=== Running $file ==="; bash "$file"; done
rules:
- if: $CI_PIPELINE_SOURCE == "merge_request_event" # dont run on merge-requests
when: never
- if: $SKIP_TESTS == "false"
obs_ext:
stage: publish
script:
- curl -o opsi-dev-tools.tar.gz "$OPSIDEVTOOLS_URL_LINUX_X64"
- tar -xvf opsi-dev-tools.tar.gz
- mv opsi-dev-tool opsi-dev-cli
- ./opsi-dev-cli -l info packaging obs update-package https://build.opensuse.org home:uibmz:opsi:4.3:development
- ./opsi-dev-cli -l info changelog from-git output/
- ./opsi-dev-cli release-service register-package-version opsi-utils SERVER_PACKAGE --changelog-file output/changelog.md
- ./opsi-dev-cli release-service push-repository-state opsi-utils SERVER_PACKAGE SERVER_PACKAGE-4.3-development
rules:
- if: '$CI_COMMIT_TAG != null'