From eb5be218240a6ac726b84a95883a1591c60909f4 Mon Sep 17 00:00:00 2001 From: Michael Jerger Date: Thu, 13 Jul 2023 08:52:46 +0200 Subject: [PATCH 01/19] add more granulare build images --- infrastructure/clojure/build.py | 4 +- infrastructure/ddadevops/build.py | 50 +++++++++++++++++++++++ infrastructure/ddadevops/image/Dockerfile | 6 +++ infrastructure/dind/build.py | 50 +++++++++++++++++++++++ infrastructure/dind/image/Dockerfile | 6 +++ infrastructure/python/build.py | 50 +++++++++++++++++++++++ infrastructure/python/image/Dockerfile | 7 ++++ 7 files changed, 171 insertions(+), 2 deletions(-) create mode 100644 infrastructure/ddadevops/build.py create mode 100644 infrastructure/ddadevops/image/Dockerfile create mode 100644 infrastructure/dind/build.py create mode 100644 infrastructure/dind/image/Dockerfile create mode 100644 infrastructure/python/build.py create mode 100644 infrastructure/python/image/Dockerfile diff --git a/infrastructure/clojure/build.py b/infrastructure/clojure/build.py index 3267dae..7d337ea 100644 --- a/infrastructure/clojure/build.py +++ b/infrastructure/clojure/build.py @@ -2,8 +2,8 @@ from os import environ from pybuilder.core import task, init from ddadevops import * -name = "clojure" -MODULE = "image" +name = "ddadevops" +MODULE = "clojure" PROJECT_ROOT_PATH = "../.." diff --git a/infrastructure/ddadevops/build.py b/infrastructure/ddadevops/build.py new file mode 100644 index 0000000..c07b871 --- /dev/null +++ b/infrastructure/ddadevops/build.py @@ -0,0 +1,50 @@ +from os import environ +from pybuilder.core import task, init +from ddadevops import * + +name = "ddadevops" +MODULE = "" +PROJECT_ROOT_PATH = "../.." + + +@init +def initialize(project): + + input = { + "name": name, + "module": MODULE, + "stage": "notused", + "project_root_path": PROJECT_ROOT_PATH, + "build_types": ["IMAGE"], + "mixin_types": [], + } + + project.build_depends_on("ddadevops>=4.0.0") + + build = DevopsImageBuild(project, input) + build.initialize_build_dir() + + +@task +def image(project): + build = get_devops_build(project) + build.image() + + +@task +def drun(project): + build = get_devops_build(project) + build.drun() + + +@task +def test(project): + build = get_devops_build(project) + build.test() + + +@task +def publish(project): + build = get_devops_build(project) + build.dockerhub_login() + build.dockerhub_publish() diff --git a/infrastructure/ddadevops/image/Dockerfile b/infrastructure/ddadevops/image/Dockerfile new file mode 100644 index 0000000..833fa70 --- /dev/null +++ b/infrastructure/ddadevops/image/Dockerfile @@ -0,0 +1,6 @@ +FROM python:3.10-alpine + +RUN set -eux; +RUN apk add --no-cache python3 py3-pip openssl-dev bash git; +RUN python3 -m pip install -U pip; +RUN pip3 install pybuilder ddadevops deprecation dda-python-terraform boto3 pyyaml inflection; diff --git a/infrastructure/dind/build.py b/infrastructure/dind/build.py new file mode 100644 index 0000000..eddc7da --- /dev/null +++ b/infrastructure/dind/build.py @@ -0,0 +1,50 @@ +from os import environ +from pybuilder.core import task, init +from ddadevops import * + +name = "ddadevops" +MODULE = "dind" +PROJECT_ROOT_PATH = "../.." + + +@init +def initialize(project): + + input = { + "name": name, + "module": MODULE, + "stage": "notused", + "project_root_path": PROJECT_ROOT_PATH, + "build_types": ["IMAGE"], + "mixin_types": [], + } + + project.build_depends_on("ddadevops>=4.0.0") + + build = DevopsImageBuild(project, input) + build.initialize_build_dir() + + +@task +def image(project): + build = get_devops_build(project) + build.image() + + +@task +def drun(project): + build = get_devops_build(project) + build.drun() + + +@task +def test(project): + build = get_devops_build(project) + build.test() + + +@task +def publish(project): + build = get_devops_build(project) + build.dockerhub_login() + build.dockerhub_publish() diff --git a/infrastructure/dind/image/Dockerfile b/infrastructure/dind/image/Dockerfile new file mode 100644 index 0000000..875d0fe --- /dev/null +++ b/infrastructure/dind/image/Dockerfile @@ -0,0 +1,6 @@ +FROM docker:latest + +RUN set -eux; +RUN apk add --no-cache python3 py3-pip openssl-dev bash git; +RUN python3 -m pip install -U pip; +RUN pip3 install pybuilder ddadevops deprecation dda-python-terraform boto3 pyyaml inflection; diff --git a/infrastructure/python/build.py b/infrastructure/python/build.py new file mode 100644 index 0000000..ba87e9d --- /dev/null +++ b/infrastructure/python/build.py @@ -0,0 +1,50 @@ +from os import environ +from pybuilder.core import task, init +from ddadevops import * + +name = "ddadevops" +MODULE = "python" +PROJECT_ROOT_PATH = "../.." + + +@init +def initialize(project): + + input = { + "name": name, + "module": MODULE, + "stage": "notused", + "project_root_path": PROJECT_ROOT_PATH, + "build_types": ["IMAGE"], + "mixin_types": [], + } + + project.build_depends_on("ddadevops>=4.0.0") + + build = DevopsImageBuild(project, input) + build.initialize_build_dir() + + +@task +def image(project): + build = get_devops_build(project) + build.image() + + +@task +def drun(project): + build = get_devops_build(project) + build.drun() + + +@task +def test(project): + build = get_devops_build(project) + build.test() + + +@task +def publish(project): + build = get_devops_build(project) + build.dockerhub_login() + build.dockerhub_publish() diff --git a/infrastructure/python/image/Dockerfile b/infrastructure/python/image/Dockerfile new file mode 100644 index 0000000..3d49141 --- /dev/null +++ b/infrastructure/python/image/Dockerfile @@ -0,0 +1,7 @@ +FROM python:3.10-alpine + +RUN set -eux; +RUN apk add --no-cache build-base rust python3 python3-dev py3-pip py3-setuptools py3-wheel libffi-dev openssl-dev cargo bash git; +RUN python3 -m pip install -U pip; +RUN pip3 install pybuilder ddadevops deprecation dda-python-terraform boto3 pyyaml inflection; +RUN pip3 install coverage flake8 flake8-polyfill mypy mypy-extensions pycodestyle pyflakes pylint pytest pytest-cov pytest-datafiles types-setuptools types-PyYAML; From 6b1ffb6e994a2d4092f0f54b7a7b496c7176876b Mon Sep 17 00:00:00 2001 From: Michael Jerger Date: Thu, 13 Jul 2023 20:41:52 +0200 Subject: [PATCH 02/19] add some tests --- doc/architecture/Domain.md | 1 + src/main/python/ddadevops/domain/image.py | 21 +++++++++++++++++++++ src/test/python/domain/test_image.py | 13 +++++++++++++ 3 files changed, 35 insertions(+) diff --git a/doc/architecture/Domain.md b/doc/architecture/Domain.md index 7e76a96..afb8378 100644 --- a/doc/architecture/Domain.md +++ b/doc/architecture/Domain.md @@ -12,6 +12,7 @@ classDiagram } class Image { + image_naming image_dockerhub_user image_dockerhub_password image_publish_tag diff --git a/src/main/python/ddadevops/domain/image.py b/src/main/python/ddadevops/domain/image.py index d24b59b..5fcfc5b 100644 --- a/src/main/python/ddadevops/domain/image.py +++ b/src/main/python/ddadevops/domain/image.py @@ -1,3 +1,4 @@ +from enum import Enum from typing import List, Dict from .common import ( filter_none, @@ -5,15 +6,23 @@ from .common import ( ) +class NamingType(Enum): + NAME_ONLY = 1 + NAME_AND_MODULE = 2 + + class Image(Validateable): def __init__( self, inp: dict, ): + self.module = inp.get("module") + self.name = inp.get("name") self.image_dockerhub_user = inp.get("image_dockerhub_user") self.image_dockerhub_password = inp.get("image_dockerhub_password") self.image_tag = inp.get("image_tag") self.image_build_commons_path = inp.get("image_build_commons_path") + self.image_naming = NamingType[inp.get("image_naming", "NAME_ONLY")] self.image_use_package_common_files = inp.get( "image_use_package_common_files", True ) @@ -23,8 +32,10 @@ class Image(Validateable): def validate(self) -> List[str]: result = [] + result += self.__validate_is_not_empty__("name") result += self.__validate_is_not_empty__("image_dockerhub_user") result += self.__validate_is_not_empty__("image_dockerhub_password") + result += self.__validate_is_not_empty__("image_naming") if not self.image_use_package_common_files: result += self.__validate_is_not_empty__("image_build_commons_path") result += self.__validate_is_not_empty__("image_build_commons_dir_name") @@ -37,6 +48,16 @@ class Image(Validateable): ] return "/".join(filter_none(commons_path)) + "/" + def image_name(self) -> str: + result: List[str] = [self.name] # type: ignore + if ( + self.image_naming == NamingType.NAME_AND_MODULE + and self.module + and self.module != "" + ): + result.append(self.module) + return "-".join(result) + @classmethod def get_mapping_default(cls) -> List[Dict[str, str]]: return [ diff --git a/src/test/python/domain/test_image.py b/src/test/python/domain/test_image.py index e26c98d..765aa3d 100644 --- a/src/test/python/domain/test_image.py +++ b/src/test/python/domain/test_image.py @@ -12,3 +12,16 @@ def test_devops_build_commons_path(): assert image is not None assert image.is_valid() assert "docker/" == image.build_commons_path() + +def test_should_calculate_image_name(): + sut = build_devops({}) + image = sut.specialized_builds[BuildType.IMAGE] + assert "name" == image.image_name() + + sut = build_devops({'image_naming': "NAME_ONLY"}) + image = sut.specialized_builds[BuildType.IMAGE] + assert "name" == image.image_name() + + sut = build_devops({'image_naming': "NAME_AND_MODULE"}) + image = sut.specialized_builds[BuildType.IMAGE] + assert "name-module" == image.image_name() From 9c44bebd5d170df254d1cab6950afef4fc524a7f Mon Sep 17 00:00:00 2001 From: Michael Jerger Date: Fri, 14 Jul 2023 11:33:01 +0200 Subject: [PATCH 03/19] use the new image_naming --- build.py | 115 ++++++++++++------ infrastructure/clojure/build.py | 2 +- infrastructure/ddadevops/build.py | 1 + infrastructure/devops-build/build.py | 1 + infrastructure/dind/build.py | 1 + infrastructure/python/build.py | 9 +- infrastructure/python/test/dummy | 0 .../application/image_build_service.py | 11 +- .../infrastructure/infrastructure.py | 16 +-- 9 files changed, 104 insertions(+), 52 deletions(-) create mode 100644 infrastructure/python/test/dummy diff --git a/build.py b/build.py index f1d0b48..2a8ce58 100644 --- a/build.py +++ b/build.py @@ -22,63 +22,71 @@ from ddadevops import * use_plugin("python.core") use_plugin("copy_resources") use_plugin("filter_resources") -#use_plugin("python.unittest") -#use_plugin("python.coverage") +# use_plugin("python.unittest") +# use_plugin("python.coverage") use_plugin("python.distutils") -#use_plugin("python.install_dependencies") +# use_plugin("python.install_dependencies") default_task = "dev" name = "ddadevops" MODULE = "not-used" PROJECT_ROOT_PATH = "." -version = "4.0.15-dev" +version = "4.0.17-dev3" summary = "tools to support builds combining gopass, terraform, dda-pallet, aws & hetzner-cloud" description = __doc__ authors = [Author("meissa GmbH", "buero@meissa-gmbh.de")] url = "https://repo.prod.meissa.de/meissa/dda-devops-build" -requires_python = ">=3.10" # CHECK IF NEW VERSION EXISTS +requires_python = ">=3.10" # CHECK IF NEW VERSION EXISTS license = "Apache Software License" + @init def initialize(project): - #project.build_depends_on('mockito') - #project.build_depends_on('unittest-xml-reporting') + # project.build_depends_on('mockito') + # project.build_depends_on('unittest-xml-reporting') project.build_depends_on("ddadevops>=4.0.0") project.set_property("verbose", True) - project.get_property("filter_resources_glob").append("main/python/ddadevops/__init__.py") + project.get_property("filter_resources_glob").append( + "main/python/ddadevops/__init__.py" + ) project.set_property("dir_source_unittest_python", "src/test/python") 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/*") - project.get_property("copy_resources_glob").append("src/main/resources/docker/image/resources/*") + project.get_property("copy_resources_glob").append( + "src/main/resources/docker/image/resources/*" + ) project.include_file("ddadevops", "LICENSE") project.include_file("ddadevops", "src/main/resources/terraform/*") project.include_file("ddadevops", "src/main/resources/docker/image/resources/*") - - #project.set_property('distutils_upload_sign', True) - #project.set_property('distutils_upload_sign_identity', '') + + # project.set_property('distutils_upload_sign', True) + # project.set_property('distutils_upload_sign_identity', '') project.set_property("distutils_readme_description", True) project.set_property("distutils_description_overwrite", True) - project.set_property("distutils_classifiers", [ - 'License :: OSI Approved :: Apache Software License', - 'Programming Language :: Python', - 'Programming Language :: Python :: 3', - 'Programming Language :: Python :: 3.8', - 'Programming Language :: Python :: 3.10', - 'Operating System :: POSIX :: Linux', - 'Operating System :: OS Independent', - 'Development Status :: 5 - Production/Stable', - 'Environment :: Console', - 'Intended Audience :: Developers', - 'License :: OSI Approved :: Apache Software License', - 'Topic :: Software Development :: Build Tools', - 'Topic :: Software Development :: Quality Assurance', - 'Topic :: Software Development :: Testing' - ]) + project.set_property( + "distutils_classifiers", + [ + "License :: OSI Approved :: Apache Software License", + "Programming Language :: Python", + "Programming Language :: Python :: 3", + "Programming Language :: Python :: 3.8", + "Programming Language :: Python :: 3.10", + "Operating System :: POSIX :: Linux", + "Operating System :: OS Independent", + "Development Status :: 5 - Production/Stable", + "Environment :: Console", + "Intended Audience :: Developers", + "License :: OSI Approved :: Apache Software License", + "Topic :: Software Development :: Build Tools", + "Topic :: Software Development :: Quality Assurance", + "Topic :: Software Development :: Testing", + ], + ) input = { "name": name, @@ -88,52 +96,83 @@ def initialize(project): "build_types": [], "mixin_types": ["RELEASE"], "release_primary_build_file": "build.py", + "release_secondary_build_files": [ + "infrastructure/python/build.py", + "infrastructure/dind/build.py", + "infrastructure/ddadevops/build.py", + "infrastructure/clojure/build.py", + ], } build = ReleaseMixin(project, input) build.initialize_build_dir() + @task def test(project): run("pytest", check=True) + @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, check=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, check=True) - run("python -m mypy src/main/python/ddadevops/ --ignore-missing-imports "+ - "--disable-error-code=attr-defined --disable-error-code=union-attr", shell=True, check=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, check=True) + run( + "flake8 --max-line-length=120 --count --select=E9,F63,F7,F82 " + + "--show-source --statistics src/main/python/ddadevops/", + shell=True, + check=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, + check=True, + ) + run( + "python -m mypy src/main/python/ddadevops/ --ignore-missing-imports " + + "--disable-error-code=attr-defined --disable-error-code=union-attr", + shell=True, + check=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, + check=True, + ) + @task def patch(project): build(project, "PATCH") + @task def minor(project): build(project, "MINOR") + @task def major(project): build(project, "MAJOR") - + + @task def dev(project): build(project, "NONE") + @task def nothing(project): pass + @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) diff --git a/infrastructure/clojure/build.py b/infrastructure/clojure/build.py index 7d337ea..832e4e5 100644 --- a/infrastructure/clojure/build.py +++ b/infrastructure/clojure/build.py @@ -5,7 +5,7 @@ from ddadevops import * name = "ddadevops" MODULE = "clojure" PROJECT_ROOT_PATH = "../.." - +version = "4.0.0-dev73" @init def initialize(project): diff --git a/infrastructure/ddadevops/build.py b/infrastructure/ddadevops/build.py index c07b871..40ebb7c 100644 --- a/infrastructure/ddadevops/build.py +++ b/infrastructure/ddadevops/build.py @@ -5,6 +5,7 @@ from ddadevops import * name = "ddadevops" MODULE = "" PROJECT_ROOT_PATH = "../.." +version = "4.0.0-dev73" @init diff --git a/infrastructure/devops-build/build.py b/infrastructure/devops-build/build.py index a415b4d..94000c8 100644 --- a/infrastructure/devops-build/build.py +++ b/infrastructure/devops-build/build.py @@ -5,6 +5,7 @@ from ddadevops import * name = "devops-build" MODULE = "image" PROJECT_ROOT_PATH = "../.." +version = "4.0.0-dev73" @init diff --git a/infrastructure/dind/build.py b/infrastructure/dind/build.py index eddc7da..6173240 100644 --- a/infrastructure/dind/build.py +++ b/infrastructure/dind/build.py @@ -5,6 +5,7 @@ from ddadevops import * name = "ddadevops" MODULE = "dind" PROJECT_ROOT_PATH = "../.." +version = "4.0.0-dev73" @init diff --git a/infrastructure/python/build.py b/infrastructure/python/build.py index ba87e9d..da1c84c 100644 --- a/infrastructure/python/build.py +++ b/infrastructure/python/build.py @@ -1,15 +1,20 @@ from os import environ +from datetime import datetime from pybuilder.core import task, init from ddadevops import * name = "ddadevops" MODULE = "python" PROJECT_ROOT_PATH = "../.." - +version = "4.0.15-dev" @init def initialize(project): + image_version = version + if "dev" in image_version: + image_version += datetime.now().strftime("%Y-%m-%d-%H-%M-%S") + input = { "name": name, "module": MODULE, @@ -17,6 +22,8 @@ def initialize(project): "project_root_path": PROJECT_ROOT_PATH, "build_types": ["IMAGE"], "mixin_types": [], + 'image_naming': "NAME_AND_MODULE", + "image_version": f"{image_version}", } project.build_depends_on("ddadevops>=4.0.0") diff --git a/infrastructure/python/test/dummy b/infrastructure/python/test/dummy new file mode 100644 index 0000000..e69de29 diff --git a/src/main/python/ddadevops/application/image_build_service.py b/src/main/python/ddadevops/application/image_build_service.py index cc77ca3..03ea089 100644 --- a/src/main/python/ddadevops/application/image_build_service.py +++ b/src/main/python/ddadevops/application/image_build_service.py @@ -46,10 +46,12 @@ class ImageBuildService: self.file_api.cp_recursive("test", build_path) def image(self, devops: Devops): - self.image_api.image(devops.name, devops.build_path()) + image = devops.specialized_builds[BuildType.IMAGE] + self.image_api.image(image.image_name(), devops.build_path()) def drun(self, devops: Devops): - self.image_api.drun(devops.name) + image = devops.specialized_builds[BuildType.IMAGE] + self.image_api.drun(image.image_name()) def dockerhub_login(self, devops: Devops): image = devops.specialized_builds[BuildType.IMAGE] @@ -60,8 +62,9 @@ class ImageBuildService: def dockerhub_publish(self, devops: Devops): image = devops.specialized_builds[BuildType.IMAGE] self.image_api.dockerhub_publish( - devops.name, image.image_dockerhub_user, image.image_tag + image.image_name(), image.image_dockerhub_user, image.image_tag ) def test(self, devops: Devops): - self.image_api.test(devops.name, devops.build_path()) + image = devops.specialized_builds[BuildType.IMAGE] + self.image_api.test(image.image_name(), devops.build_path()) diff --git a/src/main/python/ddadevops/infrastructure/infrastructure.py b/src/main/python/ddadevops/infrastructure/infrastructure.py index aa3f137..2d375da 100644 --- a/src/main/python/ddadevops/infrastructure/infrastructure.py +++ b/src/main/python/ddadevops/infrastructure/infrastructure.py @@ -53,37 +53,37 @@ class ImageApi: self.execution_api = ExecutionApi() def image(self, name: str, path: Path): - self.execution_api.execute( + self.execution_api.execute_live( f"docker build -t {name} --file {path}/image/Dockerfile {path}/image" ) def drun(self, name: str): - self.execution_api.execute( + self.execution_api.execute_live( f'docker run -it --entrypoint="" {name} /bin/bash' ) def dockerhub_login(self, username: str, password: str): - self.execution_api.execute( + self.execution_api.execute_live( f"docker login --username {username} --password {password}" ) def dockerhub_publish(self, name: str, username: str, tag=None): if tag is not None: - self.execution_api.execute( + self.execution_api.execute_live( f"docker tag {name} {username}/{name}:{tag}" ) - self.execution_api.execute( + self.execution_api.execute_live( f"docker push {username}/{name}:{tag}" ) - self.execution_api.execute( + self.execution_api.execute_live( f"docker tag {name} {username}/{name}:latest" ) - self.execution_api.execute( + self.execution_api.execute_live( f"docker push {username}/{name}:latest" ) def test(self, name: str, path: Path): - self.execution_api.execute( + self.execution_api.execute_live( f"docker build -t {name} -test --file {path}/test/Dockerfile {path}/test" ) From 8b11a4fa6126c8a3fa70028efaabfc7bbc6c25f0 Mon Sep 17 00:00:00 2001 From: erik Date: Thu, 13 Jul 2023 11:07:59 +0200 Subject: [PATCH 04/19] Add execute_handled --- .../infrastructure/infrastructure.py | 19 +++++++++++++++++-- 1 file changed, 17 insertions(+), 2 deletions(-) diff --git a/src/main/python/ddadevops/infrastructure/infrastructure.py b/src/main/python/ddadevops/infrastructure/infrastructure.py index 2d375da..8b66ede 100644 --- a/src/main/python/ddadevops/infrastructure/infrastructure.py +++ b/src/main/python/ddadevops/infrastructure/infrastructure.py @@ -1,4 +1,4 @@ -from subprocess import Popen, PIPE, run +from subprocess import Popen, PIPE, run, CalledProcessError from pathlib import Path from sys import stdout from os import chmod, environ @@ -101,7 +101,7 @@ class ExecutionApi: output = output.rstrip() return output - def execute_live(self, command, dry_run=False, shell=True): + def execute_live(self, command: str, dry_run=False, shell=True): if dry_run: print(command) else: @@ -111,6 +111,21 @@ class ExecutionApi: process.stdout.close() process.wait() + def execute_handled(self, command: str, dry_run=False, shell=True, check=True): + if dry_run: + print(command) + else: + try: + run( + command, + shell=shell, + check=check, + stderr=PIPE, + text=True) + except CalledProcessError as exc: + print("Command failed with code: ", exc.returncode, " and message:", exc.stderr) + raise exc + class EnvironmentApi: def get(self, key): From 5c3d07e58c1f31fd15afc25c9656ba3d4b6124f1 Mon Sep 17 00:00:00 2001 From: bom Date: Thu, 13 Jul 2023 10:58:16 +0200 Subject: [PATCH 05/19] Update docker ci build --- .gitlab-ci.yml | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index 33aa37a..be7f4fe 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -1,4 +1,4 @@ -image: "domaindrivenarchitecture/devops-build:4.0.8" +image: "domaindrivenarchitecture/devops-build:latest" before_script: - python --version @@ -9,9 +9,6 @@ before_script: - export IMAGE_DOCKERHUB_USER=$DOCKERHUB_USER - export IMAGE_DOCKERHUB_PASSWORD=$DOCKERHUB_PASSWORD -variables: - DOCKER_HOST: tcp://localhost:2375/ - stages: - lint&test - upload From 02191274163719b30f22b916f356132c157be0ae Mon Sep 17 00:00:00 2001 From: bom Date: Thu, 13 Jul 2023 12:02:02 +0200 Subject: [PATCH 06/19] Add docker service to CI Enables CI to actually build docker images --- .gitlab-ci.yml | 3 +++ 1 file changed, 3 insertions(+) diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index be7f4fe..c4522ba 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -1,5 +1,8 @@ image: "domaindrivenarchitecture/devops-build:latest" +services: + - docker:dind + before_script: - python --version - python -m pip install --upgrade pip From 1d9674b097299485455df77f80abc55bc7c9423d Mon Sep 17 00:00:00 2001 From: bom Date: Thu, 13 Jul 2023 13:09:16 +0200 Subject: [PATCH 07/19] Use correct CI variable for Image tag --- .gitlab-ci.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index c4522ba..fe83c8d 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -8,7 +8,7 @@ before_script: - python -m pip install --upgrade pip - pip install -r requirements.txt - pip install ddadevops --upgrade - - export IMAGE_TAG=$CI_IMAGE_TAG + - export IMAGE_TAG=$CI_COMMIT_TAG - export IMAGE_DOCKERHUB_USER=$DOCKERHUB_USER - export IMAGE_DOCKERHUB_PASSWORD=$DOCKERHUB_PASSWORD From 459a1823887e58cb987b4f257fa7a23921f9a630 Mon Sep 17 00:00:00 2001 From: bom Date: Thu, 13 Jul 2023 13:12:02 +0200 Subject: [PATCH 08/19] Remove redundant pip install --- .gitlab-ci.yml | 1 - 1 file changed, 1 deletion(-) diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index fe83c8d..c065128 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -7,7 +7,6 @@ before_script: - python --version - python -m pip install --upgrade pip - pip install -r requirements.txt - - pip install ddadevops --upgrade - export IMAGE_TAG=$CI_COMMIT_TAG - export IMAGE_DOCKERHUB_USER=$DOCKERHUB_USER - export IMAGE_DOCKERHUB_PASSWORD=$DOCKERHUB_PASSWORD From c93875f491560b6915735895f79b4e0b02c7c9f9 Mon Sep 17 00:00:00 2001 From: bom Date: Thu, 13 Jul 2023 13:12:24 +0200 Subject: [PATCH 09/19] Pin devops-build Image version --- .gitlab-ci.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index c065128..fc18d57 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -1,4 +1,4 @@ -image: "domaindrivenarchitecture/devops-build:latest" +image: "domaindrivenarchitecture/devops-build:4.0.8" services: - docker:dind From e927ec9fcf4802823b31a67c5f81c60f2e18780e Mon Sep 17 00:00:00 2001 From: bom Date: Thu, 13 Jul 2023 13:20:57 +0200 Subject: [PATCH 10/19] Merge release tasks into one --- README.md | 2 +- build.py | 3 +-- 2 files changed, 2 insertions(+), 3 deletions(-) diff --git a/README.md b/README.md index accbf00..c3de758 100644 --- a/README.md +++ b/README.md @@ -186,7 +186,7 @@ def destroy(project): pyb dev publish upload pip3 install --upgrade ddadevops --pre -pyb [patch|minor|major] prepare_release tag_bump_and_push_release +pyb [patch|minor|major] release pip3 install --upgrade ddadevops ``` diff --git a/build.py b/build.py index 2a8ce58..c7b9bc9 100644 --- a/build.py +++ b/build.py @@ -168,7 +168,7 @@ def nothing(project): @task -def prepare_release(project): +def release(project): build = get_devops_build(project) build.prepare_release() @@ -178,7 +178,6 @@ 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) From 8ce3c74c34cf08a5d0268167de26760c42852d33 Mon Sep 17 00:00:00 2001 From: Michael Jerger Date: Fri, 14 Jul 2023 11:43:04 +0200 Subject: [PATCH 11/19] add some todos --- src/main/python/ddadevops/infrastructure/infrastructure.py | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/main/python/ddadevops/infrastructure/infrastructure.py b/src/main/python/ddadevops/infrastructure/infrastructure.py index 8b66ede..89351d0 100644 --- a/src/main/python/ddadevops/infrastructure/infrastructure.py +++ b/src/main/python/ddadevops/infrastructure/infrastructure.py @@ -101,6 +101,9 @@ class ExecutionApi: output = output.rstrip() return output + # TODO: check for exception handling + # TODO: can we return the output here also? + # TODO: should we also print stderr? def execute_live(self, command: str, dry_run=False, shell=True): if dry_run: print(command) @@ -111,6 +114,7 @@ class ExecutionApi: process.stdout.close() process.wait() + # TODO: move this enhancement to execute def execute_handled(self, command: str, dry_run=False, shell=True, check=True): if dry_run: print(command) From 9cb77f395f718457c9dd9b48ddd8760b805ca18b Mon Sep 17 00:00:00 2001 From: Michael Jerger Date: Fri, 14 Jul 2023 12:41:35 +0200 Subject: [PATCH 12/19] prepare minor --- build.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/build.py b/build.py index c7b9bc9..6673b2f 100644 --- a/build.py +++ b/build.py @@ -33,7 +33,7 @@ default_task = "dev" name = "ddadevops" MODULE = "not-used" PROJECT_ROOT_PATH = "." -version = "4.0.17-dev3" +version = "4.1.0-dev2" summary = "tools to support builds combining gopass, terraform, dda-pallet, aws & hetzner-cloud" description = __doc__ authors = [Author("meissa GmbH", "buero@meissa-gmbh.de")] From 355c457d57a7b87004c52616067177bf7f0bc97f Mon Sep 17 00:00:00 2001 From: Michael Jerger Date: Fri, 14 Jul 2023 12:41:54 +0200 Subject: [PATCH 13/19] add an test --- src/test/python/domain/test_devops_factory.py | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/src/test/python/domain/test_devops_factory.py b/src/test/python/domain/test_devops_factory.py index ceb12a1..b9f4008 100644 --- a/src/test/python/domain/test_devops_factory.py +++ b/src/test/python/domain/test_devops_factory.py @@ -7,7 +7,7 @@ from src.main.python.ddadevops.domain import ( ) -def test_devops_factory(): +def test_devops_creation(): with pytest.raises(Exception): DevopsFactory().build_devops({"build_types": ["NOTEXISTING"]}) @@ -66,3 +66,8 @@ def test_devops_factory(): ) assert sut is not None assert sut.mixins[MixinType.RELEASE] is not None + + +def test_on_merge_input_should_win(): + sut = DevopsFactory() + assert {'tag': 'inp'} == sut.merge(inp = {'tag': 'inp'}, context = {'tag': 'context'}, authorization={}) From 771ffe5229fbcdaef15ba76ee4c4ef821397f55d Mon Sep 17 00:00:00 2001 From: Michael Jerger Date: Fri, 14 Jul 2023 12:42:46 +0200 Subject: [PATCH 14/19] mv domain logic to domain --- .../application/image_build_service.py | 18 ++++++++++++------ .../ddadevops/infrastructure/infrastructure.py | 13 +++---------- 2 files changed, 15 insertions(+), 16 deletions(-) diff --git a/src/main/python/ddadevops/application/image_build_service.py b/src/main/python/ddadevops/application/image_build_service.py index 03ea089..59117da 100644 --- a/src/main/python/ddadevops/application/image_build_service.py +++ b/src/main/python/ddadevops/application/image_build_service.py @@ -4,7 +4,9 @@ from ..infrastructure import FileApi, ResourceApi, ImageApi class ImageBuildService: - def __init__(self, file_api: FileApi, resource_api: ResourceApi, image_api: ImageApi): + def __init__( + self, file_api: FileApi, resource_api: ResourceApi, image_api: ImageApi + ): self.file_api = file_api self.resource_api = resource_api self.image_api = image_api @@ -18,7 +20,9 @@ class ImageBuildService: ) def __copy_build_resource_file_from_package__(self, resource_name, devops: Devops): - data = self.resource_api.read_resource(f"src/main/resources/docker/{resource_name}") + data = self.resource_api.read_resource( + f"src/main/resources/docker/{resource_name}" + ) self.file_api.write_data_to_file( Path(f"{devops.build_path()}/{resource_name}"), data ) @@ -30,9 +34,7 @@ class ImageBuildService: def __copy_build_resources_from_dir__(self, devops: Devops): image = devops.specialized_builds[BuildType.IMAGE] - self.file_api.cp_force( - image.build_commons_path(), devops.build_path() - ) + self.file_api.cp_force(image.build_commons_path(), devops.build_path()) def initialize_build_dir(self, devops: Devops): image = devops.specialized_builds[BuildType.IMAGE] @@ -61,8 +63,12 @@ class ImageBuildService: def dockerhub_publish(self, devops: Devops): image = devops.specialized_builds[BuildType.IMAGE] + if image.image_tag is not None: + self.image_api.dockerhub_publish( + image.image_name(), image.image_dockerhub_user, image.image_tag + ) self.image_api.dockerhub_publish( - image.image_name(), image.image_dockerhub_user, image.image_tag + image.image_name(), image.image_dockerhub_user, 'latest' ) def test(self, devops: Devops): diff --git a/src/main/python/ddadevops/infrastructure/infrastructure.py b/src/main/python/ddadevops/infrastructure/infrastructure.py index 89351d0..14cc14c 100644 --- a/src/main/python/ddadevops/infrastructure/infrastructure.py +++ b/src/main/python/ddadevops/infrastructure/infrastructure.py @@ -67,19 +67,12 @@ class ImageApi: f"docker login --username {username} --password {password}" ) - def dockerhub_publish(self, name: str, username: str, tag=None): - if tag is not None: - self.execution_api.execute_live( - f"docker tag {name} {username}/{name}:{tag}" - ) - self.execution_api.execute_live( - f"docker push {username}/{name}:{tag}" - ) + def dockerhub_publish(self, name: str, username: str, tag: str): self.execution_api.execute_live( - f"docker tag {name} {username}/{name}:latest" + f"docker tag {name} {username}/{name}:{tag}" ) self.execution_api.execute_live( - f"docker push {username}/{name}:latest" + f"docker push {username}/{name}:{tag}" ) def test(self, name: str, path: Path): From cb486748642edfbbe9cc1185b301029b74a226d2 Mon Sep 17 00:00:00 2001 From: Michael Jerger Date: Fri, 14 Jul 2023 12:43:08 +0200 Subject: [PATCH 15/19] fix build --- infrastructure/python/build.py | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/infrastructure/python/build.py b/infrastructure/python/build.py index da1c84c..23e3b03 100644 --- a/infrastructure/python/build.py +++ b/infrastructure/python/build.py @@ -11,9 +11,9 @@ version = "4.0.15-dev" @init def initialize(project): - image_version = version - if "dev" in image_version: - image_version += datetime.now().strftime("%Y-%m-%d-%H-%M-%S") + image_tag = version + if "dev" in image_tag: + image_tag += datetime.now().strftime("%Y-%m-%d-%H-%M-%S") input = { "name": name, @@ -23,7 +23,7 @@ def initialize(project): "build_types": ["IMAGE"], "mixin_types": [], 'image_naming': "NAME_AND_MODULE", - "image_version": f"{image_version}", + "image_tag": f"{image_tag}", } project.build_depends_on("ddadevops>=4.0.0") From 3c9a86f67cbd9999f155795cbb4ec9cd058a98ee Mon Sep 17 00:00:00 2001 From: Michael Jerger Date: Fri, 14 Jul 2023 13:11:49 +0200 Subject: [PATCH 16/19] build all images --- .gitlab-ci.yml | 76 ++++++++++++++++++----------- infrastructure/clojure/build.py | 8 ++- infrastructure/ddadevops/build.py | 12 +++-- infrastructure/ddadevops/test/dummy | 0 infrastructure/dind/build.py | 10 +++- infrastructure/dind/test/dummy | 0 infrastructure/python/build.py | 8 +-- 7 files changed, 75 insertions(+), 39 deletions(-) create mode 100644 infrastructure/ddadevops/test/dummy create mode 100644 infrastructure/dind/test/dummy diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index fc18d57..b6b18ee 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -1,56 +1,74 @@ -image: "domaindrivenarchitecture/devops-build:4.0.8" - -services: - - docker:dind - -before_script: - - python --version - - python -m pip install --upgrade pip - - pip install -r requirements.txt - - export IMAGE_TAG=$CI_COMMIT_TAG - - export IMAGE_DOCKERHUB_USER=$DOCKERHUB_USER - - export IMAGE_DOCKERHUB_PASSWORD=$DOCKERHUB_PASSWORD - stages: - lint&test - upload - image +.py: &py + image: "domaindrivenarchitecture/ddadevops-python:latest" + before_script: + - python --version + - pip install -r requirements.txt + +.img: &img + image: "domaindrivenarchitecture/ddadevops-dind:latest" + services: + - docker:dind + before_script: + - export IMAGE_DOCKERHUB_USER=$DOCKERHUB_USER + - export IMAGE_DOCKERHUB_PASSWORD=$DOCKERHUB_PASSWORD + - export IMAGE_TAG=$CI_COMMIT_TAG + +.tag_only: &tag_only + rules: + - if: '$CI_PIPELINE_SOURCE == "merge_request_event"' + when: never + - if: '$CI_COMMIT_TAG =~ /^[0-9]+\.[0-9]+\.[0-9]+$/' + lint: + <<: *dev stage: lint&test script: - pip install -r dev_requirements.txt - pyb lint pytest: + <<: *dev stage: lint&test script: - pip install -r dev_requirements.txt - pyb test pypi-stable: + <<: *dev + <<: *tag_only stage: upload - rules: - - if: '$CI_PIPELINE_SOURCE == "merge_request_event"' - when: never - - if: '$CI_COMMIT_TAG =~ /^[0-9]+\.[0-9]+\.[0-9]+$/' script: - pyb -P version=$CI_COMMIT_TAG publish upload -clojure-image-test-publish: +clojure-image-publish: + <<: *img + <<: *tag_only stage: image - rules: - - if: '$CI_PIPELINE_SOURCE == "merge_request_event"' - when: never - - if: '$CI_COMMIT_TAG =~ /^[0-9]+\.[0-9]+\.[0-9]+$/' script: - - cd infrastructure/clojure && pyb image test publish + - cd infrastructure/clojure && pyb image publish -devops-build-image-test-publish: +python-image-publish: + <<: *img + <<: *tag_only stage: image - rules: - - if: '$CI_PIPELINE_SOURCE == "merge_request_event"' - when: never - - if: '$CI_COMMIT_TAG =~ /^[0-9]+\.[0-9]+\.[0-9]+$/' script: - - cd infrastructure/devops-build && pyb image test publish + - cd infrastructure/python && pyb image publish + +dind-image-publish: + <<: *img + <<: *tag_only + stage: image + script: + - cd infrastructure/dind && pyb image publish + +ddadevops-image-publish: + <<: *img + <<: *tag_only + stage: image + script: + - cd infrastructure/ddadevops && pyb image publish diff --git a/infrastructure/clojure/build.py b/infrastructure/clojure/build.py index 832e4e5..9966020 100644 --- a/infrastructure/clojure/build.py +++ b/infrastructure/clojure/build.py @@ -1,14 +1,18 @@ from os import environ +from datetime import datetime from pybuilder.core import task, init from ddadevops import * name = "ddadevops" MODULE = "clojure" PROJECT_ROOT_PATH = "../.." -version = "4.0.0-dev73" +version = "4.1.0-dev" @init def initialize(project): + image_tag = version + if "dev" in image_tag: + image_tag += datetime.now().strftime("%Y-%m-%d-%H-%M-%S") input = { "name": name, @@ -17,6 +21,8 @@ def initialize(project): "project_root_path": PROJECT_ROOT_PATH, "build_types": ["IMAGE"], "mixin_types": [], + "image_naming": "NAME_AND_MODULE", + "image_tag": f"{image_tag}", } project.build_depends_on("ddadevops>=4.0.0") diff --git a/infrastructure/ddadevops/build.py b/infrastructure/ddadevops/build.py index 40ebb7c..bbf6f10 100644 --- a/infrastructure/ddadevops/build.py +++ b/infrastructure/ddadevops/build.py @@ -1,15 +1,19 @@ from os import environ +from datetime import datetime from pybuilder.core import task, init from ddadevops import * name = "ddadevops" -MODULE = "" +MODULE = "ddadevops" PROJECT_ROOT_PATH = "../.." -version = "4.0.0-dev73" +version = "4.1.0-dev" @init def initialize(project): + image_tag = version + if "dev" in image_tag: + image_tag += datetime.now().strftime("%Y-%m-%d-%H-%M-%S") input = { "name": name, @@ -18,10 +22,12 @@ def initialize(project): "project_root_path": PROJECT_ROOT_PATH, "build_types": ["IMAGE"], "mixin_types": [], + "image_naming": "NAME_ONLY", + "image_tag": f"{image_tag}", } project.build_depends_on("ddadevops>=4.0.0") - + build = DevopsImageBuild(project, input) build.initialize_build_dir() diff --git a/infrastructure/ddadevops/test/dummy b/infrastructure/ddadevops/test/dummy new file mode 100644 index 0000000..e69de29 diff --git a/infrastructure/dind/build.py b/infrastructure/dind/build.py index 6173240..38093a1 100644 --- a/infrastructure/dind/build.py +++ b/infrastructure/dind/build.py @@ -1,15 +1,19 @@ from os import environ +from datetime import datetime from pybuilder.core import task, init from ddadevops import * name = "ddadevops" MODULE = "dind" PROJECT_ROOT_PATH = "../.." -version = "4.0.0-dev73" +version = "4.1.0-dev" @init def initialize(project): + image_tag = version + if "dev" in image_tag: + image_tag += datetime.now().strftime("%Y-%m-%d-%H-%M-%S") input = { "name": name, @@ -18,10 +22,12 @@ def initialize(project): "project_root_path": PROJECT_ROOT_PATH, "build_types": ["IMAGE"], "mixin_types": [], + "image_naming": "NAME_AND_MODULE", + "image_tag": f"{image_tag}", } project.build_depends_on("ddadevops>=4.0.0") - + build = DevopsImageBuild(project, input) build.initialize_build_dir() diff --git a/infrastructure/dind/test/dummy b/infrastructure/dind/test/dummy new file mode 100644 index 0000000..e69de29 diff --git a/infrastructure/python/build.py b/infrastructure/python/build.py index 23e3b03..89c7ee3 100644 --- a/infrastructure/python/build.py +++ b/infrastructure/python/build.py @@ -6,11 +6,11 @@ from ddadevops import * name = "ddadevops" MODULE = "python" PROJECT_ROOT_PATH = "../.." -version = "4.0.15-dev" +version = "4.1.0-dev" + @init def initialize(project): - image_tag = version if "dev" in image_tag: image_tag += datetime.now().strftime("%Y-%m-%d-%H-%M-%S") @@ -22,12 +22,12 @@ def initialize(project): "project_root_path": PROJECT_ROOT_PATH, "build_types": ["IMAGE"], "mixin_types": [], - 'image_naming': "NAME_AND_MODULE", + "image_naming": "NAME_AND_MODULE", "image_tag": f"{image_tag}", } project.build_depends_on("ddadevops>=4.0.0") - + build = DevopsImageBuild(project, input) build.initialize_build_dir() From a15030adaac952906b82bda2b74c9ce57fd3963c Mon Sep 17 00:00:00 2001 From: Michael Jerger Date: Fri, 14 Jul 2023 13:13:28 +0200 Subject: [PATCH 17/19] fix ci --- .gitlab-ci.yml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index b6b18ee..287b62e 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -25,21 +25,21 @@ stages: - if: '$CI_COMMIT_TAG =~ /^[0-9]+\.[0-9]+\.[0-9]+$/' lint: - <<: *dev + <<: *py stage: lint&test script: - pip install -r dev_requirements.txt - pyb lint pytest: - <<: *dev + <<: *py stage: lint&test script: - pip install -r dev_requirements.txt - pyb test pypi-stable: - <<: *dev + <<: *py <<: *tag_only stage: upload script: From 146e11a1dec9e4fe3757807a2ecf71ee6e191525 Mon Sep 17 00:00:00 2001 From: Michael Jerger Date: Fri, 14 Jul 2023 13:26:36 +0200 Subject: [PATCH 18/19] update doc --- doc/Images.md | 33 +++++++++++++++++++++++++++++++++ doc/dev/releasing.md | 8 -------- 2 files changed, 33 insertions(+), 8 deletions(-) create mode 100644 doc/Images.md delete mode 100644 doc/dev/releasing.md diff --git a/doc/Images.md b/doc/Images.md new file mode 100644 index 0000000..489b81e --- /dev/null +++ b/doc/Images.md @@ -0,0 +1,33 @@ +# ddadevops Images +## ddadevops-clojure + +Contains +* clojure +* shadowcljs +* lein +* java +* graalvm +* pybuilder, ddadevops + +## ddadevops + +Contains: +* pybuilder, ddadevops + +## devops-build + +Image is deprecated. + +## ddadevops-dind + +Contains: +* docker in docker +* pybuilder, ddadevops + +## ddadevops-python + +Contains: +* python 3.10 +* python linting +* python setup-tools +* pybuilder, ddadevops \ No newline at end of file diff --git a/doc/dev/releasing.md b/doc/dev/releasing.md deleted file mode 100644 index 4b00776..0000000 --- a/doc/dev/releasing.md +++ /dev/null @@ -1,8 +0,0 @@ -adjust version no in build.py to release version no. -git commit -am "release" -git tag -am "release" [release version no] -git push --follow-tags -increase version no in build.py -git commit -am "version bump" -git push -pip3 install --upgrade ddadevops \ No newline at end of file From 0a40e5e2133c7f5831615cb7ca2658fb94d05926 Mon Sep 17 00:00:00 2001 From: Michael Jerger Date: Fri, 14 Jul 2023 13:27:11 +0200 Subject: [PATCH 19/19] make release more simple --- README.md | 2 +- build.py | 28 ++++++++++++++++------------ 2 files changed, 17 insertions(+), 13 deletions(-) diff --git a/README.md b/README.md index c3de758..05f70ff 100644 --- a/README.md +++ b/README.md @@ -186,7 +186,7 @@ def destroy(project): pyb dev publish upload pip3 install --upgrade ddadevops --pre -pyb [patch|minor|major] release +pyb [patch|minor|major] pip3 install --upgrade ddadevops ``` diff --git a/build.py b/build.py index 6673b2f..ec2eea1 100644 --- a/build.py +++ b/build.py @@ -144,41 +144,45 @@ def lint(project): @task def patch(project): - build(project, "PATCH") + linttest(project, "PATCH") + release(project) @task def minor(project): - build(project, "MINOR") + linttest(project, "MINOR") + release(project) @task def major(project): - build(project, "MAJOR") + linttest(project, "MAJOR") + release(project) @task def dev(project): - build(project, "NONE") + linttest(project, "NONE") @task -def nothing(project): - pass - - -@task -def release(project): +def prepare(project): build = get_devops_build(project) build.prepare_release() @task -def tag_bump_and_push_release(project): +def tag(project): build = get_devops_build(project) build.tag_bump_and_push_release() -def build(project, release_type): + +def release(project): + prepare(project) + tag(project) + + +def linttest(project, release_type): build = get_devops_build(project) build.update_release_type(release_type) test(project)