From ef14356863a617a1533db434e751f87b95e5cf5f Mon Sep 17 00:00:00 2001 From: Mikhail Goncharov Date: Mon, 28 Nov 2022 11:31:43 +0100 Subject: [PATCH] script to start a sample build at the moment requires a manual tuning each time you run it but a good starting point --- scripts/buildkite/sample_build.py | 37 +++++++++++++++++++++++++++++++ 1 file changed, 37 insertions(+) create mode 100644 scripts/buildkite/sample_build.py diff --git a/scripts/buildkite/sample_build.py b/scripts/buildkite/sample_build.py new file mode 100644 index 0000000..9e5e974 --- /dev/null +++ b/scripts/buildkite/sample_build.py @@ -0,0 +1,37 @@ +import os +import json +import argparse +import requests + +# print(json.loads(re.json())) + +if __name__ == '__main__': + parser = argparse.ArgumentParser(description='Run sample build on buildkite.') + parser.add_argument('--dryrun', action='store_true') + args = parser.parse_args() + + d = json.dumps({ + 'branch': 'main', + 'commit': 'HEAD', + 'env': { + #'ph_skip_linux': 'skip', + 'ph_skip_generated': 'skip', + 'ph_log_level': 'DEBUG', + 'ph_skip_windows': 'skip', + 'ph_linux_agents': '{"queue": "linux-test"}', + # 'ph_windows_agents': f'{{"name": "", "queue": "{queue}"}}', + }}) + print(d) + if (args.dryrun): + exit(0) + token = os.getenv('BUILDKITE_API_TOKEN') + if token is None: + print("'BUILDKITE_API_TOKEN' environment variable is not set") + exit(1) + + print(f"token {token}") + re = requests.post('https://api.buildkite.com/v2/organizations/llvm-project/pipelines/llvm-main/builds', + data=d, + headers={'Authorization': f'Bearer {token}'}) + print(re.status_code) + print(re) \ No newline at end of file