Compare commits

...

2 Commits

Author SHA1 Message Date
jaydee c6bba8c9a5 Update .gitlab-ci.yml file 2026-03-19 10:11:14 +01:00
jaydee 06b281ccc8 build-all 2026-03-19 09:25:47 +01:00
3 changed files with 47 additions and 2 deletions
+1 -1
View File
@@ -43,7 +43,7 @@ include:
- template: Security/Dependency-Scanning.gitlab-ci.yml
- template: Security/Secret-Detection.gitlab-ci.yml
- template: Security/DAST.gitlab-ci.yml
- template: Security/Container-Scanning.gitlab-ci.yml
#- template: Security/Container-Scanning.gitlab-ci.yml
build-job: # This job runs in the build stage, which runs first.
stage: build
+17
View File
@@ -405,6 +405,8 @@ if __name__ == "__main__":
("update_service","update_service"),
("update_containers","update_containers"),
("list_stacks","list_stacks"),
("list_all_stacks", "list_all_stacks"),
("delete_ophaned_stacks", "delete_ophaned_stacks"),
("update_stack","update_stack"),
("secrets","secrets"),
("print_all_data","print_all_data"),
@@ -591,6 +593,21 @@ if __name__ == "__main__":
# print(json.dumps(por.all_data, indent=2))
sys.exit()
if args.action == "list_all_stacks":
por.get_stacks_failed()
if args.launcher:
input("Press ENTER to continue...")
# print(json.dumps(por.all_data, indent=2))
sys.exit()
if args.action == "delete_ophaned_stacks":
por.delete_failed_stack()
if args.launcher:
input("Press ENTER to continue...")
# print(json.dumps(por.all_data, indent=2))
sys.exit()
if args.action == "list_containers":
print("Getting containers")
args = prompt_missing_args(
+29 -1
View File
@@ -237,6 +237,34 @@ class PortainerApi:
self.get_containers(self)
return True
def get_stacks_failed(self, timeout=20):
'''Get a list of stacks for a specific endpoint or all endpoints.'''
path = "/stacks"
stcks = []
stacks = self._api_get(path, timeout=timeout)
self.stacks_all = {}
fail_endponts = [20, 39, 41, 32, 43]
# print(json.dumps(stacks,indent=2))
for s in stacks:
stcks.append((s["EndpointId"], s["Id"]))
print(f"{s['EndpointId']} : {s['Id']}")
return stcks
def delete_failed_stack(self, timeout=20):
'''Get a list of stacks for a specific endpoint or all endpoints.'''
path = "/stacks"
stcks = []
stacks = self._api_get(path, timeout=timeout)
# print(json.dumps(stacks,indent=2))
eid = input("Enter endpoint : ")
for s in stacks:
# print(s)
# print(f"{s['EndpointId']} : {s['Id']}")
if int(eid) == s["EndpointId"]:
print(f"deleting stack {s['Id']}")
self._delete_single_stack(s["Id"], "50")
def get_stacks(self, endpoint_id="all", timeout=20):
'''Get a list of stacks for a specific endpoint or all endpoints.'''
if endpoint_id != "all":
@@ -245,7 +273,7 @@ class PortainerApi:
stcks = []
stacks = self._api_get(path, timeout=timeout)
self.stacks_all = {}
fail_endponts = [20, 39, 41]
fail_endponts = [20, 39, 41, 32, 43]
# print(json.dumps(stacks,indent=2))
webhooks = {}
for s in stacks: