read dockerfile
This commit is contained in:
parent
483db0d732
commit
98c4b1261f
|
@ -73,12 +73,24 @@ def _get_dockerfile_contents(jobname, os_codename='bionic'):
|
||||||
"""
|
"""
|
||||||
Read contents of a Dockerfile and add extra contents for the given os_codename
|
Read contents of a Dockerfile and add extra contents for the given os_codename
|
||||||
"""
|
"""
|
||||||
|
res = ""
|
||||||
with open(join(path + jobname), "r") as file:
|
with open(join(path + jobname), "r") as file:
|
||||||
contents = file.read()
|
contents = file.read()
|
||||||
# accept any line containing FROM or RUN keywords
|
# accept any line containing FROM or RUN keywords
|
||||||
re.match(r"(?m)^(FROM|RUN).*$", contents)
|
# re.match(r"(?m)^(FROM|RUN).*$", contents)
|
||||||
|
|
||||||
return contents + dockerfile_extra_contents[os_codename]
|
for i in range(len(contents)):
|
||||||
|
if re.match(r"(?m)^(FROM|RUN).*$", contents[i]):
|
||||||
|
res += contents[i]
|
||||||
|
j = i
|
||||||
|
while True:
|
||||||
|
if "\\" in contents[j]:
|
||||||
|
res += contents[j+1]
|
||||||
|
j = j + 1
|
||||||
|
else:
|
||||||
|
break
|
||||||
|
|
||||||
|
return res + dockerfile_extra_contents[os_codename]
|
||||||
|
|
||||||
|
|
||||||
def trigger_child_hooks(buildbotUrl: str, os_codename: str, repository, branch, jobname, directory=".buildbot", is_build_script_available, is_test_script_available):
|
def trigger_child_hooks(buildbotUrl: str, os_codename: str, repository, branch, jobname, directory=".buildbot", is_build_script_available, is_test_script_available):
|
||||||
|
|
Loading…
Reference in New Issue