mirror of
https://github.com/PluralKit/PluralKit.git
synced 2026-02-14 01:30:13 +00:00
test
This commit is contained in:
parent
573470ba3f
commit
52e87805e0
2 changed files with 10 additions and 1 deletions
|
|
@ -3,6 +3,8 @@
|
||||||
import os, sys, json, subprocess, random, time, datetime
|
import os, sys, json, subprocess, random, time, datetime
|
||||||
import urllib.request
|
import urllib.request
|
||||||
|
|
||||||
|
global_fail = False
|
||||||
|
|
||||||
def must_get_env(name):
|
def must_get_env(name):
|
||||||
val = os.environ.get(name)
|
val = os.environ.get(name)
|
||||||
if val == "":
|
if val == "":
|
||||||
|
|
@ -62,6 +64,7 @@ def report_status(name, start_time, exit=None):
|
||||||
response_code = e.getcode()
|
response_code = e.getcode()
|
||||||
response_data = e.read()
|
response_data = e.read()
|
||||||
print(f"{response_code} failed to update status {name}: {response_data}")
|
print(f"{response_code} failed to update status {name}: {response_data}")
|
||||||
|
global_fail = True
|
||||||
|
|
||||||
def run_job(data):
|
def run_job(data):
|
||||||
subprocess.run(["git", "clone", must_get_env("REPO_URL")])
|
subprocess.run(["git", "clone", must_get_env("REPO_URL")])
|
||||||
|
|
@ -93,6 +96,9 @@ def main():
|
||||||
print("job failed!")
|
print("job failed!")
|
||||||
traceback.format_exc()
|
traceback.format_exc()
|
||||||
|
|
||||||
|
if global_fail:
|
||||||
|
ok = False
|
||||||
|
|
||||||
report_status(data["action"], time_started, ok)
|
report_status(data["action"], time_started, ok)
|
||||||
|
|
||||||
return 0 if ok else 1
|
return 0 if ok else 1
|
||||||
|
|
|
||||||
|
|
@ -3,6 +3,8 @@
|
||||||
import os, sys, json, subprocess, random, time, re
|
import os, sys, json, subprocess, random, time, re
|
||||||
import urllib.request
|
import urllib.request
|
||||||
|
|
||||||
|
global_fail = False
|
||||||
|
|
||||||
def must_get_env(name):
|
def must_get_env(name):
|
||||||
val = os.environ.get(name)
|
val = os.environ.get(name)
|
||||||
if val == "":
|
if val == "":
|
||||||
|
|
@ -41,6 +43,7 @@ def spawn_job(name):
|
||||||
response_code = e.getcode()
|
response_code = e.getcode()
|
||||||
response_data = e.read()
|
response_data = e.read()
|
||||||
print(f"{response_code} failed to spawn job {name}: {response_data}")
|
print(f"{response_code} failed to spawn job {name}: {response_data}")
|
||||||
|
global_fail = True
|
||||||
|
|
||||||
def create_jobs():
|
def create_jobs():
|
||||||
modify_regexes = {
|
modify_regexes = {
|
||||||
|
|
@ -100,7 +103,7 @@ def create_jobs():
|
||||||
if len(jobs) == 0:
|
if len(jobs) == 0:
|
||||||
print("no jobs to run (??)")
|
print("no jobs to run (??)")
|
||||||
|
|
||||||
return 0
|
return 0 if not global_fail else 1
|
||||||
|
|
||||||
if __name__ == "__main__":
|
if __name__ == "__main__":
|
||||||
print("hello from python!")
|
print("hello from python!")
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue