forked from kserve/kserve
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy path.gitlab-ci.yml
64 lines (59 loc) · 2.34 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
include:
- project: 'analytics/artificial-intelligence/ai-platform/aip-infrastructure/ci-templates/ci-cd-template'
ref: &include_ref 'v3'
file: 'environments/devex.yml'
- project: 'analytics/artificial-intelligence/ai-platform/aip-infrastructure/ci-templates/ci-cd-template'
ref: *include_ref # TODO Use V4?
file: '/blocks/python.yml'
variables:
PY_LIBRARY_NAME: "zillow-kserve"
MAJOR_VERSION: "0"
MINOR_VERSION: "10"
RELEASE_BRANCH: "zillow/release-0.10.2"
KSERVE_VERSION_PATH: "python/kserve/setup.py"
PUBLISH: "true"
stages:
- build
.version: &version |
# Extract the open source KServe version as the basis for our forked library version.
KSERVE_VERSION=$(cat python/VERSION)
echo Kserve version is $KSERVE_VERSION
PY_LIBRARY_VERSION="${MAJOR_VERSION}.${MINOR_VERSION}.${CI_PIPELINE_IID}"
echo Base PY_LIBRARY_VERSION is $PY_LIBRARY_VERSION
if [ "${CI_COMMIT_BRANCH}" != "${RELEASE_BRANCH}" ]; then
PY_LIBRARY_VERSION="${PY_LIBRARY_VERSION}.dev${CI_PIPELINE_IID}"
# Ensure the image tag is compliant with PEP-440,
IMAGE_TAG="${PY_LIBRARY_VERSION}.dev${CI_PIPELINE_IID}"
else
IMAGE_TAG="${PY_LIBRARY_VERSION}"
fi
echo IMAGE_TAG is $IMAGE_TAG
# Only apply the KServe version to the python library as Docker versions do not have the concept of
# build metadata and the "+" character causes errors.
PY_LIBRARY_VERSION="${PY_LIBRARY_VERSION}+${KSERVE_VERSION}"
echo Final PY_LIBRARY_VERSION is $PY_LIBRARY_VERSION
build:publish:
extends: .aip_python_debian_image
stage: build
script:
- *version
# Now write back the zillow-kserve version back to the original location we found the original so
# python package managers can reference it as they need the version stored internally.
- sed -i "s/version=version/version=\'${PY_LIBRARY_VERSION}\'/" $KSERVE_VERSION_PATH
- cd python/kserve
- python setup.py sdist
# Set up the configuration for Artifactory to publish the python package internally.
- |
cat >~/.pypirc <<EOL
[distutils]
index-servers = local
[local]
repository: ${ANALYTICS_PYPI_REPOSITORY}
username: ${PYPI_USERNAME}
password: ${PYPI_PASSWORD}
EOL
- python setup.py sdist upload --repository "${ANALYTICS_PYPI_REPOSITORY}"
rules:
- if: '$PUBLISH == "true"'
# only trigger on zillow/ branches
- if: '$CI_COMMIT_BRANCH =~ /^zillow.*/'