···60 pkgs.gnupg
61 pkgs.jq
62 pkgs.file
63- pkgs.htmlq
64 ];
65 services.openssh.enable = true;
66···253 client.succeed("git -C /tmp/repo push origin main")
254255 def poll_workflow_action_status(_) -> bool:
256- output = server.succeed(
257- "curl --fail http://localhost:3000/test/repo/actions | "
258- + 'htmlq ".flex-item-leading span" --attribute "data-tooltip-content"'
259- ).strip()
260261- # values taken from https://codeberg.org/forgejo/forgejo/src/commit/af47c583b4fb3190fa4c4c414500f9941cc02389/options/locale/locale_en-US.ini#L3649-L3661
262- if output in [ "Failure", "Canceled", "Skipped", "Blocked" ]:
263- raise Exception(f"Workflow status is '{output}', which we consider failed.")
264- server.log(f"Command returned '{output}', which we consider failed.")
265266- elif output in [ "Unknown", "Waiting", "Running", "" ]:
267- server.log(f"Workflow status is '{output}'. Waiting some more...")
268- return False
269270- elif output in [ "Success" ]:
271- return True
272273- raise Exception(f"Workflow status is '{output}', which we don't know. Value mappings likely need updating.")
274275 with server.nested("Waiting for the workflow run to be successful"):
276- retry(poll_workflow_action_status)
277278 with subtest("Testing backup service"):
279 server.succeed("${serverSystem}/specialisation/dump/bin/switch-to-configuration test")
···60 pkgs.gnupg
61 pkgs.jq
62 pkgs.file
063 ];
64 services.openssh.enable = true;
65···252 client.succeed("git -C /tmp/repo push origin main")
253254 def poll_workflow_action_status(_) -> bool:
255+ try:
256+ response = server.succeed("curl --fail http://localhost:3000/api/v1/repos/test/repo/actions/tasks")
257+ status = json.loads(response).get("workflow_runs")[0].get("status")
0258259+ except IndexError:
260+ status = "???"
00261262+ server.log(f"Workflow status: {status}")
00263264+ if status == "failure":
265+ raise Exception("Workflow failed")
266267+ return status == "success"
268269 with server.nested("Waiting for the workflow run to be successful"):
270+ retry(poll_workflow_action_status, 60)
271272 with subtest("Testing backup service"):
273 server.succeed("${serverSystem}/specialisation/dump/bin/switch-to-configuration test")