1
0
Fork 0

scripts: setup k8s from env + commit arg for bk

This commit is contained in:
Mikhail Goncharov 2023-07-17 13:19:09 +02:00
parent a725f9ea89
commit 377ea890b8
2 changed files with 16 additions and 3 deletions

View file

@ -2,15 +2,18 @@ import os
import json
import argparse
import requests
import time
if __name__ == '__main__':
parser = argparse.ArgumentParser(description='Run sample build on buildkite.')
parser.add_argument('--dryrun', action='store_true')
parser.add_argument('--commit')
pipeline='upstream-bazel-test'
args = parser.parse_args()
time.sleep(2)
d = json.dumps({
'branch': 'main',
'commit': '43b38696aa038a83b12850aab25377650e301cde',
'commit': args.commit,
'env': {
'ph_log_level': 'DEBUG',
#'ph_skip_linux': 'skip',
@ -34,7 +37,7 @@ if __name__ == '__main__':
exit(1)
print(f"token {token}")
re = requests.post('https://api.buildkite.com/v2/organizations/llvm-project/pipelines/llvm-main/builds',
re = requests.post(f'https://api.buildkite.com/v2/organizations/llvm-project/pipelines/{pipeline}/builds',
data=d,
headers={'Authorization': f'Bearer {token}'})
print(re.status_code)

10
setup_k8s.sh Executable file
View file

@ -0,0 +1,10 @@
# Setups kubernetes with env variables.
echo GCP_PROJECT=$GCP_PROJECT
echo GCP_ZONE=$GCP_ZONE
echo GCP_CLUSTER=$GCP_CLUSTER
gcloud config set project ${GCP_PROJECT}
gcloud config set compute/zone ${GCP_ZONE}
# setup docker for pushing containers
gcloud auth configure-docker
gcloud container clusters get-credentials $GCP_CLUSTER