Skip to content

Commit 635040a

Browse files
[CI] Convert dispatch_jobs.py into an annotated builder
This script should be used directly as an annotated builder and this script sets it up to do so. There are two main changes: 1. We print out a build step command. The monolithic scripts will eventually need to be upgraded to print out more fine grained build step information. 2. We take in a BUILDBOT_REVISION rather than the SHA on the command line. Passing the commit SHA along on the command line is complicated while BUILDBOT_REVISION is set by default for all annotated builders. Reviewers: dschuff, Keenuts, cmtice, lnihlen, gburgessiv Reviewed By: cmtice Pull Request: #536
1 parent a11cd41 commit 635040a

File tree

1 file changed

+8
-3
lines changed

1 file changed

+8
-3
lines changed

premerge/buildbot/dispatch_job.py

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@
1313
import dateutil
1414
import datetime
1515
import json
16+
import os
1617

1718
import kubernetes
1819

@@ -154,6 +155,7 @@ def main(commit_sha: str, platform: str):
154155
namespace = PLATFORM_TO_NAMESPACE[platform]
155156
latest_time = datetime.datetime.min
156157
v1_api = kubernetes.client.CoreV1Api()
158+
print("@@@BUILD_STEP Build/Test@@@")
157159
while True:
158160
try:
159161
pod_finished, latest_time = print_logs(
@@ -173,7 +175,10 @@ def main(commit_sha: str, platform: str):
173175

174176

175177
if __name__ == "__main__":
176-
if len(sys.argv) != 3:
177-
logging.fatal("Expected usage is dispatch_job.py {commit SHA} {platform}")
178+
if len(sys.argv) != 2:
179+
logging.fatal("Expected usage is dispatch_job.py {platform}")
178180
sys.exit(1)
179-
main(sys.argv[1], sys.argv[2])
181+
if "BUILDBOT_REVISION" not in os.environ:
182+
logging.fatal("Expected to have BUILDBOT_REVISION environment variable set.")
183+
sys.exit(1)
184+
main(sys.argv[1], os.environ["BUILDBOT_REVISION"])

0 commit comments

Comments
 (0)