-
Notifications
You must be signed in to change notification settings - Fork 1
/
build.py
143 lines (122 loc) · 5.83 KB
/
build.py
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
140
141
142
143
# -*- coding: utf-8 -*-
#
# Copyright 2020 Express Systems USA, Inc
# Copyright 2021 Karellen, Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
#
import textwrap
from subprocess import check_call
from pybuilder.core import (use_plugin, init, Author, task)
use_plugin("pypi:karellen_pyb_plugin", ">=0.0.1")
use_plugin("python.coveralls")
use_plugin("python.vendorize")
use_plugin("filter_resources")
name = "kubernator"
version = "1.0.18.dev"
summary = "Kubernator is the a pluggable framework for K8S provisioning"
authors = [Author("Express Systems USA, Inc.", "")]
maintainers = [Author("Karellen, Inc.", "supervisor@karellen.co"),
Author("Arcadiy Ivanov", "arcadiy@karellen.co")]
url = "https://github.com/karellen/kubernator"
urls = {
"Bug Tracker": "https://github.com/karellen/kubernator/issues",
"Source Code": "https://github.com/karellen/kubernator/",
"Documentation": "https://github.com/karellen/kubernator/"
}
license = "Apache License, Version 2.0"
requires_python = ">=3.9"
default_task = ["analyze", "publish"]
@init
def set_properties(project):
project.depends_on("gevent", ">=21.1.2")
project.depends_on("kubernetes", "~=30.0")
project.depends_on("durationpy", ">=0.7")
project.depends_on("openapi-schema-validator", "~=0.1")
project.depends_on("openapi-spec-validator", "~=0.3")
project.depends_on("json-log-formatter", "~=0.3")
project.depends_on("platformdirs", "~=4.2")
project.depends_on("requests", "<=2.31.0")
project.depends_on("jsonpatch", "~=1.32")
project.depends_on("jsonpath-ng", "~=1.6.1")
project.depends_on("jinja2", "~=3.1")
project.depends_on("coloredlogs", "~=15.0")
project.depends_on("jsonschema", "<4.0")
project.depends_on("diff-match-patch", ">2023.0")
project.set_property("coverage_break_build", False)
project.set_property("cram_fail_if_no_tests", False)
project.set_property("integrationtest_inherit_environment", True)
project.set_property("copy_resources_target", "$dir_dist/kubernator")
project.get_property("copy_resources_glob").append("LICENSE")
project.set_property("filter_resources_target", "$dir_dist")
project.get_property("filter_resources_glob").append("kubernator/__init__.py")
project.include_file("kubernator", "LICENSE")
project.set_property("distutils_upload_sign", False)
project.set_property("distutils_upload_sign_identity", None)
project.set_property("distutils_upload_repository_key", None)
project.set_property("distutils_console_scripts", ["kubernator = kubernator:main"])
project.set_property("distutils_setup_keywords", ["kubernetes", "k8s", "kube", "top", "provisioning",
"kOps", "terraform", "tf", "AWS"])
project.set_property("distutils_classifiers", [
"License :: OSI Approved :: Apache Software License",
"Programming Language :: Python :: 3.9",
"Programming Language :: Python :: 3.10",
"Programming Language :: Python :: 3.11",
"Programming Language :: Python :: 3.12",
"Operating System :: MacOS :: MacOS X",
"Operating System :: POSIX",
"Operating System :: POSIX :: Linux",
"Environment :: Console",
"Topic :: Utilities",
"Topic :: System :: Monitoring",
"Topic :: System :: Distributed Computing",
"Topic :: System :: Clustering",
"Topic :: System :: Networking",
"Intended Audience :: System Administrators",
"Intended Audience :: Developers",
"Development Status :: 4 - Beta"
])
project.set_property('pybuilder_header_plugin_break_build', False)
project.set_property("pybuilder_header_plugin_expected_header",
textwrap.dedent("""\
# -*- coding: utf-8 -*-
#
# Copyright 2020 Express Systems USA, Inc
# Copyright 2024 Karellen, Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
#
"""))
@task
def publish(project):
image = f"ghcr.io/karellen/kubernator"
versioned_image = f"{image}:{project.dist_version}"
project.set_property("docker_image", image)
labels = ["-t", versioned_image]
# Do not tag with latest if it's a development build
if project.version == project.dist_version:
labels += ["-t", f"{image}:latest"]
check_call(["docker", "build"] + labels + ["."])
@task
def upload(project):
check_call(["docker", "push", project.get_property("docker_image"), "-a"])