-
Notifications
You must be signed in to change notification settings - Fork 12
Expand file tree
/
Copy path.gitlab-ci.yml
More file actions
120 lines (112 loc) · 4.39 KB
/
Copy path.gitlab-ci.yml
File metadata and controls
120 lines (112 loc) · 4.39 KB
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
variables:
LINSTOR_CONTROLLER_HOST: 'linstor-controller'
LINSTOR_CONTROLLER_PORT: '3370'
stages:
- lint
- build
- test
- deploy
- deploy_tests
before_script:
# setup ssh access to clone python-linstor dep
- 'which ssh-agent || ( apt-get update -y && apt-get install openssh-client -y )'
- eval $(ssh-agent -s)
- echo "$SSH_PRIVATE_KEY" | tr -d '\r' | ssh-add -
- mkdir -p ~/.ssh
- chmod 700 ~/.ssh
- ssh-keyscan $CI_SERVER_HOST >> ~/.ssh/known_hosts
# now install python-linstor into venv
- pushd /tmp
- python -m venv venv
- git clone --recursive git@$CI_SERVER_HOST:$PYTHON_LINSTOR_PATH
- cd linstor-api-py
- git checkout $CI_COMMIT_REF_NAME || true
- git submodule update
- make gensrc
- ../venv/bin/python setup.py install
# and also install xmlrunner package
- ../venv/bin/pip install --trusted-host pypi.python.org xmlrunner argcomplete
- popd
services:
- name: $CI_REGISTRY/linstor/linstor-server/controller
alias: linstor-controller
pep8:
stage: lint
image: registry.gitlab.com/pipeline-components/flake8:latest
rules:
- if: '$CI_PIPELINE_SOURCE == "merge_request_event"'
- if: '$CI_COMMIT_BRANCH == "jenkins"'
- if: $CI_COMMIT_BRANCH == 'master'
before_script:
- echo noop
script:
flake8 .
test:3.6:
stage: test
image: python:3.6
rules:
- if: '$CI_PIPELINE_SOURCE == "merge_request_event"'
- if: '$CI_COMMIT_BRANCH == "jenkins"'
- if: $CI_COMMIT_BRANCH == 'master'
script:
- /tmp/venv/bin/python tests.py
artifacts:
reports:
junit: test-reports/TEST-*.xml
test:3.10:
stage: test
image: python:3.10
rules:
- if: '$CI_PIPELINE_SOURCE == "merge_request_event"'
- if: '$CI_COMMIT_BRANCH == "jenkins"'
- if: $CI_COMMIT_BRANCH == 'master'
script:
- /tmp/venv/bin/python tests.py
artifacts:
reports:
junit: test-reports/TEST-*.xml
deploy_client:
stage: deploy
image: $LINBIT_DOCKER_REGISTRY/build-helpers:latest
rules:
- if: '$CI_PIPELINE_SOURCE == "merge_request_event"'
- if: $CI_COMMIT_BRANCH == 'master'
before_script:
- curl -sSL $LINBIT_REGISTRY_URL/repository/lbbuild/lbbuildctl-latest -o /usr/local/bin/lbbuildctl
- chmod +x /usr/local/bin/lbbuildctl
script:
- |
case "$CI_COMMIT_REF_NAME" in
"master") VERSION_SUFFIX="" ;;
*) VERSION_SUFFIX=.dev$(echo -n $CI_COMMIT_REF_NAME | md5sum| sed -e 's/[^1-9]//g' | cut -c -9) ;;
esac
- LINSTOR_CLIENT_VERSION=1.99.0$VERSION_SUFFIX
- PYTHON_LINSTOR_VERSION=1.99.0
- |
if curl --head -f $LINBIT_REGISTRY_URL/repository/lbbuild-upstream/python-linstor-$PYTHON_LINSTOR_VERSION$VERSION_SUFFIX.tar.gz ; then
PYTHON_LINSTOR_VERSION=$LINSTOR_CLIENT_VERSION
echo "USING PYTHON_LINSTOR: $PYTHON_LINSTOR_VERSION"
fi
- awk -f "/usr/local/bin/dch.awk" -v PROJECT_VERSION="$LINSTOR_CLIENT_VERSION" -v PROJECT_NAME="linstor-client" debian/changelog > debian/changelog.tmp
- mv debian/changelog{.tmp,}
- sed -i "s/LINSTOR_CLI_VERSION [0-9.]*/LINSTOR_CLI_VERSION $LINSTOR_CLIENT_VERSION/g" Dockerfile
- sed -i "s/PYTHON_LINSTOR_VERSION [0-9.]*/PYTHON_LINSTOR_VERSION $LINSTOR_CLIENT_VERSION/g" Dockerfile
- sed -i "s/python-linstor >= [0-9.]*/python-linstor >= $LINSTOR_CLIENT_VERSION/g" setup.cfg
- sed -i "s/\"python-linstor>=[0-9.]*\"/\"python-linstor>=$LINSTOR_CLIENT_VERSION\"/g" setup.py pyproject.toml
- sed -i "s/VERSION = \"[0-9.]*\"/VERSION = \"$LINSTOR_CLIENT_VERSION\"/g" linstor_client/consts.py
- NO_DOC="-no-doc" make debrelease
- curl -isSf -u $LINBIT_REGISTRY_USER:$LINBIT_REGISTRY_PASSWORD --upload-file dist/linstor-client-$LINSTOR_CLIENT_VERSION.tar.gz $LINBIT_REGISTRY_URL/repository/lbbuild-upstream/
- curl -X DELETE -u $LINBIT_REGISTRY_USER:$LINBIT_REGISTRY_PASSWORD $LINBIT_REGISTRY_URL/repository/rhel8/x86_64/linstor-client-$LINSTOR_CLIENT_VERSION-1.noarch.rpm
- lbbuildctl build linstor-client --arch amd64 --ci -v "$LINSTOR_CLIENT_VERSION" -p "$PYTHON_LINSTOR_VERSION"
-e LINBIT_REGISTRY_USER=$LINBIT_REGISTRY_USER
-e LINBIT_REGISTRY_PASSWORD=$LINBIT_REGISTRY_PASSWORD
-e LINBIT_REGISTRY_URL=$LINBIT_REGISTRY_URL
-d ubuntu-jammy,ubuntu-noble,debian-bookworm,rhel8.0
staging:
stage: deploy_tests
variables:
ARG_COMMIT_BRANCH: $CI_COMMIT_REF_NAME
rules:
- if: '$CI_PIPELINE_SOURCE == "merge_request_event"'
- if: $CI_COMMIT_BRANCH == 'master'
trigger: linstor/linstor-tests