2019-09-06 10:10:10 +00:00
|
|
|
# dda_devops_build
|
2019-09-04 16:40:41 +00:00
|
|
|
# Copyright 2019 meissa GmbH.
|
|
|
|
#
|
|
|
|
# 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.
|
|
|
|
|
2023-06-26 07:35:40 +00:00
|
|
|
from os import environ
|
2023-06-26 10:58:17 +00:00
|
|
|
from subprocess import run
|
2023-06-26 07:35:40 +00:00
|
|
|
from pybuilder.core import init, task, use_plugin, Author
|
|
|
|
from ddadevops import *
|
2019-09-04 16:40:41 +00:00
|
|
|
|
|
|
|
|
|
|
|
use_plugin("python.core")
|
2020-03-12 13:10:16 +00:00
|
|
|
use_plugin("copy_resources")
|
2019-09-06 10:10:10 +00:00
|
|
|
use_plugin("filter_resources")
|
2019-09-04 16:40:41 +00:00
|
|
|
#use_plugin("python.unittest")
|
|
|
|
#use_plugin("python.coverage")
|
|
|
|
use_plugin("python.distutils")
|
|
|
|
|
2019-09-06 10:10:10 +00:00
|
|
|
#use_plugin("python.install_dependencies")
|
2019-09-04 16:40:41 +00:00
|
|
|
|
2023-06-28 06:24:21 +00:00
|
|
|
default_task = "dev"
|
2019-09-04 16:40:41 +00:00
|
|
|
|
2019-09-06 10:10:10 +00:00
|
|
|
name = "ddadevops"
|
2023-06-26 07:35:40 +00:00
|
|
|
MODULE = "not-used"
|
|
|
|
PROJECT_ROOT_PATH = "."
|
2023-07-07 06:51:14 +00:00
|
|
|
version = "4.0.3"
|
2019-09-04 16:40:41 +00:00
|
|
|
summary = "tools to support builds combining gopass, terraform, dda-pallet, aws & hetzner-cloud"
|
|
|
|
description = __doc__
|
|
|
|
authors = [Author("meissa GmbH", "buero@meissa-gmbh.de")]
|
2023-05-31 06:40:39 +00:00
|
|
|
url = "https://repo.prod.meissa.de/meissa/dda-devops-build"
|
|
|
|
requires_python = ">=3.10" # CHECK IF NEW VERSION EXISTS
|
2019-09-04 16:40:41 +00:00
|
|
|
license = "Apache Software License"
|
|
|
|
|
|
|
|
@init
|
|
|
|
def initialize(project):
|
|
|
|
#project.build_depends_on('mockito')
|
|
|
|
#project.build_depends_on('unittest-xml-reporting')
|
2023-07-06 16:37:43 +00:00
|
|
|
project.build_depends_on("ddadevops>=4.0.0")
|
2019-09-04 16:40:41 +00:00
|
|
|
|
2019-09-06 10:10:10 +00:00
|
|
|
project.set_property("verbose", True)
|
2020-03-12 13:10:16 +00:00
|
|
|
project.get_property("filter_resources_glob").append("main/python/ddadevops/__init__.py")
|
2023-03-16 12:15:39 +00:00
|
|
|
project.set_property("dir_source_unittest_python", "src/test/python")
|
2020-03-12 13:10:16 +00:00
|
|
|
|
|
|
|
project.set_property("copy_resources_target", "$dir_dist/ddadevops")
|
|
|
|
project.get_property("copy_resources_glob").append("LICENSE")
|
|
|
|
project.get_property("copy_resources_glob").append("src/main/resources/terraform/*")
|
2020-04-17 19:57:21 +00:00
|
|
|
project.get_property("copy_resources_glob").append("src/main/resources/docker/image/resources/*")
|
2020-03-12 13:10:16 +00:00
|
|
|
project.include_file("ddadevops", "LICENSE")
|
|
|
|
project.include_file("ddadevops", "src/main/resources/terraform/*")
|
2020-04-17 19:57:21 +00:00
|
|
|
project.include_file("ddadevops", "src/main/resources/docker/image/resources/*")
|
2019-09-06 10:10:10 +00:00
|
|
|
|
2019-09-04 16:40:41 +00:00
|
|
|
#project.set_property('distutils_upload_sign', True)
|
|
|
|
#project.set_property('distutils_upload_sign_identity', '')
|
2019-09-06 10:10:10 +00:00
|
|
|
project.set_property("distutils_readme_description", True)
|
|
|
|
project.set_property("distutils_description_overwrite", True)
|
2019-09-04 16:40:41 +00:00
|
|
|
project.set_property("distutils_classifiers", [
|
|
|
|
'License :: OSI Approved :: Apache Software License',
|
|
|
|
'Programming Language :: Python',
|
|
|
|
'Programming Language :: Python :: 3',
|
2020-03-05 11:08:50 +00:00
|
|
|
'Programming Language :: Python :: 3.8',
|
2023-03-16 12:15:39 +00:00
|
|
|
'Programming Language :: Python :: 3.10',
|
2020-03-05 11:08:50 +00:00
|
|
|
'Operating System :: POSIX :: Linux',
|
|
|
|
'Operating System :: OS Independent',
|
|
|
|
'Development Status :: 5 - Production/Stable',
|
|
|
|
'Environment :: Console',
|
|
|
|
'Intended Audience :: Developers',
|
|
|
|
'License :: OSI Approved :: Apache Software License',
|
2019-09-06 10:10:10 +00:00
|
|
|
'Topic :: Software Development :: Build Tools',
|
2020-03-05 11:08:50 +00:00
|
|
|
'Topic :: Software Development :: Quality Assurance',
|
|
|
|
'Topic :: Software Development :: Testing'
|
2019-09-06 10:10:10 +00:00
|
|
|
])
|
2023-06-26 07:35:40 +00:00
|
|
|
|
|
|
|
input = {
|
|
|
|
"name": name,
|
|
|
|
"module": MODULE,
|
|
|
|
"stage": "notused",
|
|
|
|
"project_root_path": PROJECT_ROOT_PATH,
|
|
|
|
"build_types": [],
|
|
|
|
"mixin_types": ["RELEASE"],
|
|
|
|
"release_primary_build_file": "build.py",
|
|
|
|
}
|
|
|
|
|
|
|
|
build = ReleaseMixin(project, input)
|
|
|
|
build.initialize_build_dir()
|
|
|
|
|
2023-06-26 10:58:17 +00:00
|
|
|
@task
|
|
|
|
def test(project):
|
|
|
|
run("pytest")
|
|
|
|
|
|
|
|
@task
|
|
|
|
def lint(project):
|
|
|
|
run("flake8 --max-line-length=120 --count --select=E9,F63,F7,F82 "+
|
|
|
|
"--show-source --statistics src/main/python/ddadevops/", shell=True)
|
|
|
|
run("flake8 --count --exit-zero --max-complexity=10 --max-line-length=127 "+
|
|
|
|
"--per-file-ignores=\"__init__.py:F401\" "+
|
|
|
|
"--ignore=E722,W503 --statistics src/main/python/ddadevops/", shell=True)
|
|
|
|
run("python -m mypy src/main/python/ddadevops/ --ignore-missing-imports "+
|
|
|
|
"--disable-error-code=attr-defined --disable-error-code=union-attr", shell=True)
|
|
|
|
run("pylint -d W0511,R0903,C0301,W0614,C0114,C0115,C0116,similarities,W1203,W0702,W0702,"+
|
|
|
|
"R0913,R0902,R0914,R1732,R1705,W0707,C0123,W0703,C0103 src/main/python/ddadevops/", shell=True)
|
|
|
|
|
|
|
|
@task
|
|
|
|
def patch(project):
|
2023-06-28 06:24:21 +00:00
|
|
|
build(project, "PATCH")
|
|
|
|
|
|
|
|
@task
|
|
|
|
def minor(project):
|
|
|
|
build(project, "MINOR")
|
|
|
|
|
|
|
|
@task
|
|
|
|
def major(project):
|
|
|
|
build(project, "MAJOR")
|
|
|
|
|
|
|
|
@task
|
|
|
|
def dev(project):
|
|
|
|
build(project, "NONE")
|
2023-06-26 10:58:17 +00:00
|
|
|
|
2023-06-26 07:35:40 +00:00
|
|
|
@task
|
|
|
|
def nothing(project):
|
|
|
|
pass
|
2023-06-28 06:24:21 +00:00
|
|
|
|
|
|
|
@task
|
|
|
|
def prepare_release(project):
|
|
|
|
build = get_devops_build(project)
|
|
|
|
build.prepare_release()
|
|
|
|
|
|
|
|
@task
|
|
|
|
def tag_bump_and_push_release(project):
|
|
|
|
build = get_devops_build(project)
|
|
|
|
build.tag_bump_and_push_release()
|
|
|
|
|
|
|
|
|
|
|
|
def build(project, release_type):
|
|
|
|
build = get_devops_build(project)
|
|
|
|
build.update_release_type(release_type)
|
|
|
|
test(project)
|
|
|
|
lint(project)
|