From 3260cc39b07953f90b725420c9de06279c0e05d4 Mon Sep 17 00:00:00 2001 From: Michael Jerger Date: Fri, 7 Jul 2023 08:48:43 +0200 Subject: [PATCH] fix release validation --- .gitlab-ci.yml | 2 +- src/main/python/ddadevops/domain/release.py | 15 ++++++++------- 2 files changed, 9 insertions(+), 8 deletions(-) diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index 9dde123..83c0ca0 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -1,4 +1,4 @@ -image: "domaindrivenarchitecture/devops-build:4.0.1" +image: "domaindrivenarchitecture/devops-build:4.0.2" before_script: - python --version diff --git a/src/main/python/ddadevops/domain/release.py b/src/main/python/ddadevops/domain/release.py index 8d55c3e..982f3b0 100644 --- a/src/main/python/ddadevops/domain/release.py +++ b/src/main/python/ddadevops/domain/release.py @@ -29,7 +29,6 @@ class Release(Validateable): result = [] result += self.__validate_is_not_empty__("release_type") result += self.__validate_is_not_empty__("release_main_branch") - result += self.__validate_is_not_empty__("release_current_branch") result += self.__validate_is_not_empty__("release_primary_build_file") result += self.__validate_is_not_empty__("version") try: @@ -47,12 +46,14 @@ class Release(Validateable): ) if self.version: result += self.version.validate() - if ( - self.release_type is not None - and self.release_type != ReleaseType.NONE - and self.release_main_branch != self.release_current_branch - ): - result.append(f"Releases are allowed only on {self.release_main_branch}") + if self.release_type is not None: + result += self.__validate_is_not_empty__("release_current_branch") + if ( + self.release_current_branch is not None + and self.release_type != ReleaseType.NONE + and self.release_main_branch != self.release_current_branch + ): + result.append(f"Releases are allowed only on {self.release_main_branch}") return result def build_files(self) -> List[str]: