This commit is contained in:
alyssa 2024-09-06 16:34:56 +09:00
parent 573470ba3f
commit 52e87805e0
2 changed files with 10 additions and 1 deletions

View file

@ -3,6 +3,8 @@
import os, sys, json, subprocess, random, time, datetime
import urllib.request
global_fail = False
def must_get_env(name):
val = os.environ.get(name)
if val == "":
@ -62,6 +64,7 @@ def report_status(name, start_time, exit=None):
response_code = e.getcode()
response_data = e.read()
print(f"{response_code} failed to update status {name}: {response_data}")
global_fail = True
def run_job(data):
subprocess.run(["git", "clone", must_get_env("REPO_URL")])
@ -93,6 +96,9 @@ def main():
print("job failed!")
traceback.format_exc()
if global_fail:
ok = False
report_status(data["action"], time_started, ok)
return 0 if ok else 1

View file

@ -3,6 +3,8 @@
import os, sys, json, subprocess, random, time, re
import urllib.request
global_fail = False
def must_get_env(name):
val = os.environ.get(name)
if val == "":
@ -41,6 +43,7 @@ def spawn_job(name):
response_code = e.getcode()
response_data = e.read()
print(f"{response_code} failed to spawn job {name}: {response_data}")
global_fail = True
def create_jobs():
modify_regexes = {
@ -100,7 +103,7 @@ def create_jobs():
if len(jobs) == 0:
print("no jobs to run (??)")
return 0
return 0 if not global_fail else 1
if __name__ == "__main__":
print("hello from python!")