2023-12-15 21:31:38 +01:00
|
|
|
#!/usr/bin/env python
|
|
|
|
|
|
|
|
from shlex import quote
|
|
|
|
from subprocess import run
|
|
|
|
import os
|
|
|
|
import sys
|
|
|
|
|
|
|
|
for line in sys.stdin:
|
2023-12-17 08:50:11 +01:00
|
|
|
precommit, postcommit, refname = line.strip().split(' ')
|
2023-12-15 21:31:38 +01:00
|
|
|
|
|
|
|
if not refname == "refs/heads/main":
|
2023-12-17 08:50:11 +01:00
|
|
|
print(f"Skipping ref \"{refname}\"")
|
2023-12-15 21:31:38 +01:00
|
|
|
continue
|
|
|
|
|
2023-12-17 08:50:11 +01:00
|
|
|
os.putenv("LAMINAR_REASON", "Push to git repository")
|
|
|
|
cmd = "laminarc queue freeloadio " \
|
|
|
|
f"CI_COMMIT_BEFORE_SHA={quote(precommit)} " \
|
|
|
|
f"CI_COMMIT_SHA={quote(postcommit)} " \
|
|
|
|
f"CI_COMMIT_REF_NAME={quote(refname)}"
|
|
|
|
print(cmd)
|
|
|
|
process = run(cmd, shell=True, capture_output=True)
|
|
|
|
buildname, buildrun = process.stdout.decode().strip().split(':')
|
|
|
|
print(f"Queued build: https://laminar.ryuslash.org/jobs/{buildname}/{buildrun}")
|