Skip to content

Commit dc64111

Browse files
committedMay 4, 2019
CNG bot: add ability to specify runs by commit hash
1 parent 8ff862a commit dc64111

File tree

1 file changed

+18
-4
lines changed

1 file changed

+18
-4
lines changed
 

‎server/scripts/contiki-ng-bot/cng-bot-schedule.py

+18-4
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,15 @@
3939
# xppath: examples/benchmarks/rpl-req-resp
4040
# flags:
4141
# CONFIG: CONFIG_CSMA
42+
# - setup: other
43+
# duration: 120
44+
# label: A custom run, by commit hash
45+
# repository: contiki-ng/contiki-ng
46+
# commit: 4928a5e1e035d42313b0e3ed73e14565d972510b
47+
# xppath: examples/benchmarks/rpl-req-resp
48+
# flags:
49+
# CONFIG: CONFIG_CSMA
50+
#
4251

4352
def lock_is_taken():
4453
return os.path.exists(LOCK_PATH)
@@ -67,16 +76,21 @@ def run(task):
6776
setupData.update(task)
6877
setup = task["setup"]
6978
repository = setupData["repository"]
70-
branch = setupData["branch"]
79+
branch = setupData["branch"] if "branch" in setupData else None
80+
commit = setupData["commit"] if "commit" in setupData else None
7181
log("Preparing")
7282
# Go to Contiki-NG
7383
os.chdir(PATH_CONTIKI_NG)
7484
# Add remote
7585
os.system("git remote add %s git@github.com:%s.git\n"%(repository, repository))
7686
# Fetch and check out branch
77-
os.system("git fetch %s %s\n"%(repository, branch))
78-
os.system("git checkout %s/%s\n"%(repository, branch))
79-
os.system("git reset --hard %s/%s\n"%(repository, branch))
87+
os.system("git fetch %s\n"%(repository))
88+
if commit is None:
89+
os.system("git checkout %s/%s\n"%(repository, branch))
90+
os.system("git reset --hard %s/%s\n"%(repository, branch))
91+
else:
92+
os.system("git checkout %s\n"%(commit))
93+
os.system("git reset --hard %s\n"%(commit))
8094
os.system("git clean -fd\n")
8195
# Get git commit hash
8296
task["commit"] = subprocess.check_output(['git', 'rev-parse', 'HEAD']).strip().decode("utf-8")

0 commit comments

Comments
 (0)
Please sign in to comment.