Loading gitlab_butler/butler.py +33 −17 Original line number Diff line number Diff line Loading @@ -387,6 +387,7 @@ class Butler: # 2: clean subprojects subprojects = group.projects.list(all=True) if len(subprojects) > 0: print(f"- clean {len(subprojects)} sub projects...") for project in subprojects: manageable_project = self.client.projects.get(project.id) Loading @@ -395,11 +396,26 @@ class Butler: f" - 🏠 Project {AnsiColors.BLUE}{manageable_project.path_with_namespace}{AnsiColors.RESET} matches excludes: {AnsiColors.HGRAY}skip{AnsiColors.RESET}" ) else: # store current count of cleaned pipeline current_pipeline_count = self.pipelines_count start_time = time.monotonic() # clean project self.clean_project(manageable_project) # show number of pipelines deleted on this project if any if self.pipelines_count > current_pipeline_count: hours, remainder = divmod(time.monotonic() - start_time, 3600) minutes, seconds = divmod(remainder, 60) print( f" - {self.pipelines_count - current_pipeline_count} pipelines deleted in {int(hours)} hours, {int(minutes)} minutes, {int(seconds)} seconds" ) # 3: clean subgroups if not self.skip_subgroups: subgroups = group.descendant_groups.list(all=True) if len(subgroups) > 0: print(f"- clean {len(subgroups)} sub groups...") for subgroup in subgroups: if self.is_excluded(subgroup.full_path): Loading poetry.lock +10 −10 Original line number Diff line number Diff line Loading @@ -13,13 +13,13 @@ files = [ [[package]] name = "certifi" version = "2024.7.4" version = "2024.8.30" description = "Python package for providing Mozilla's CA Bundle." optional = false python-versions = ">=3.6" files = [ {file = "certifi-2024.7.4-py3-none-any.whl", hash = "sha256:c198e21b1289c2ab85ee4e67bb4b4ef3ead0892059901a8d5b622f24a1101e90"}, {file = "certifi-2024.7.4.tar.gz", hash = "sha256:5a1e7645bc0ec61a09e26c36f6106dd4cf40c6db3a1fb6352b0244e7fb057c7b"}, {file = "certifi-2024.8.30-py3-none-any.whl", hash = "sha256:922820b53db7a7257ffbda3f597266d435245903d80737e34f8a45ff3e3230d8"}, {file = "certifi-2024.8.30.tar.gz", hash = "sha256:bec941d2aa8195e248a60b31ff9f0558284cf01a52591ceda73ea9afffd69fd9"}, ] [[package]] Loading Loading @@ -218,13 +218,13 @@ toml = ["tomli"] [[package]] name = "idna" version = "3.7" version = "3.8" description = "Internationalized Domain Names in Applications (IDNA)" optional = false python-versions = ">=3.5" python-versions = ">=3.6" files = [ {file = "idna-3.7-py3-none-any.whl", hash = "sha256:82fee1fc78add43492d3a1898bfa6d8a904cc97d8427f683ed8e798d07761aa0"}, {file = "idna-3.7.tar.gz", hash = "sha256:028ff3aadf0609c1fd278d8ea3089299412a7a8b9bd005dd08b9f8285bcb5cfc"}, {file = "idna-3.8-py3-none-any.whl", hash = "sha256:050b4e5baadcd44d760cedbd2b8e639f2ff89bbc7a5730fcc662954303377aac"}, {file = "idna-3.8.tar.gz", hash = "sha256:d838c2c0ed6fced7693d5e8ab8e734d5f8fda53a039c0164afb0b82e771e3603"}, ] [[package]] Loading Loading @@ -692,13 +692,13 @@ files = [ [[package]] name = "urllib3" version = "2.2.2" version = "2.2.3" description = "HTTP library with thread-safe connection pooling, file post, and more." optional = false python-versions = ">=3.8" files = [ {file = "urllib3-2.2.2-py3-none-any.whl", hash = "sha256:a448b2f64d686155468037e1ace9f2d2199776e17f0a46610480d311f73e3472"}, {file = "urllib3-2.2.2.tar.gz", hash = "sha256:dd505485549a7a552833da5e6063639d0d177c04f23bc3864e41e5dc5f612168"}, {file = "urllib3-2.2.3-py3-none-any.whl", hash = "sha256:ca899ca043dcb1bafa3e262d73aa25c465bfb49e0bd9dd5d59f1d0acba2f8fac"}, {file = "urllib3-2.2.3.tar.gz", hash = "sha256:e7d814a81dad81e6caf2ec9fdedb284ecc9c73076b62654547cc64ccdcae26e9"}, ] [package.extras] Loading Loading
gitlab_butler/butler.py +33 −17 Original line number Diff line number Diff line Loading @@ -387,6 +387,7 @@ class Butler: # 2: clean subprojects subprojects = group.projects.list(all=True) if len(subprojects) > 0: print(f"- clean {len(subprojects)} sub projects...") for project in subprojects: manageable_project = self.client.projects.get(project.id) Loading @@ -395,11 +396,26 @@ class Butler: f" - 🏠 Project {AnsiColors.BLUE}{manageable_project.path_with_namespace}{AnsiColors.RESET} matches excludes: {AnsiColors.HGRAY}skip{AnsiColors.RESET}" ) else: # store current count of cleaned pipeline current_pipeline_count = self.pipelines_count start_time = time.monotonic() # clean project self.clean_project(manageable_project) # show number of pipelines deleted on this project if any if self.pipelines_count > current_pipeline_count: hours, remainder = divmod(time.monotonic() - start_time, 3600) minutes, seconds = divmod(remainder, 60) print( f" - {self.pipelines_count - current_pipeline_count} pipelines deleted in {int(hours)} hours, {int(minutes)} minutes, {int(seconds)} seconds" ) # 3: clean subgroups if not self.skip_subgroups: subgroups = group.descendant_groups.list(all=True) if len(subgroups) > 0: print(f"- clean {len(subgroups)} sub groups...") for subgroup in subgroups: if self.is_excluded(subgroup.full_path): Loading
poetry.lock +10 −10 Original line number Diff line number Diff line Loading @@ -13,13 +13,13 @@ files = [ [[package]] name = "certifi" version = "2024.7.4" version = "2024.8.30" description = "Python package for providing Mozilla's CA Bundle." optional = false python-versions = ">=3.6" files = [ {file = "certifi-2024.7.4-py3-none-any.whl", hash = "sha256:c198e21b1289c2ab85ee4e67bb4b4ef3ead0892059901a8d5b622f24a1101e90"}, {file = "certifi-2024.7.4.tar.gz", hash = "sha256:5a1e7645bc0ec61a09e26c36f6106dd4cf40c6db3a1fb6352b0244e7fb057c7b"}, {file = "certifi-2024.8.30-py3-none-any.whl", hash = "sha256:922820b53db7a7257ffbda3f597266d435245903d80737e34f8a45ff3e3230d8"}, {file = "certifi-2024.8.30.tar.gz", hash = "sha256:bec941d2aa8195e248a60b31ff9f0558284cf01a52591ceda73ea9afffd69fd9"}, ] [[package]] Loading Loading @@ -218,13 +218,13 @@ toml = ["tomli"] [[package]] name = "idna" version = "3.7" version = "3.8" description = "Internationalized Domain Names in Applications (IDNA)" optional = false python-versions = ">=3.5" python-versions = ">=3.6" files = [ {file = "idna-3.7-py3-none-any.whl", hash = "sha256:82fee1fc78add43492d3a1898bfa6d8a904cc97d8427f683ed8e798d07761aa0"}, {file = "idna-3.7.tar.gz", hash = "sha256:028ff3aadf0609c1fd278d8ea3089299412a7a8b9bd005dd08b9f8285bcb5cfc"}, {file = "idna-3.8-py3-none-any.whl", hash = "sha256:050b4e5baadcd44d760cedbd2b8e639f2ff89bbc7a5730fcc662954303377aac"}, {file = "idna-3.8.tar.gz", hash = "sha256:d838c2c0ed6fced7693d5e8ab8e734d5f8fda53a039c0164afb0b82e771e3603"}, ] [[package]] Loading Loading @@ -692,13 +692,13 @@ files = [ [[package]] name = "urllib3" version = "2.2.2" version = "2.2.3" description = "HTTP library with thread-safe connection pooling, file post, and more." optional = false python-versions = ">=3.8" files = [ {file = "urllib3-2.2.2-py3-none-any.whl", hash = "sha256:a448b2f64d686155468037e1ace9f2d2199776e17f0a46610480d311f73e3472"}, {file = "urllib3-2.2.2.tar.gz", hash = "sha256:dd505485549a7a552833da5e6063639d0d177c04f23bc3864e41e5dc5f612168"}, {file = "urllib3-2.2.3-py3-none-any.whl", hash = "sha256:ca899ca043dcb1bafa3e262d73aa25c465bfb49e0bd9dd5d59f1d0acba2f8fac"}, {file = "urllib3-2.2.3.tar.gz", hash = "sha256:e7d814a81dad81e6caf2ec9fdedb284ecc9c73076b62654547cc64ccdcae26e9"}, ] [package.extras] Loading