chenges for dockerfile and oscodename

This commit is contained in:
Muzahid 2022-02-22 21:15:15 +05:30
parent d354d031d9
commit ca943c6864
Signed by: cis-muzahid
GPG Key ID: 1DC85E7D3AB613EA
2 changed files with 15 additions and 18 deletions

View File

@ -15,8 +15,8 @@ request_headers = {
ty = "/change_hook/base" ty = "/change_hook/base"
path =".buildbot" path =".buildbot"
dockerfile_extra_contents = {}
dockerfile_extra_contents_focal = """ dockerfile_extra_contents['focal'] = """
# Buildbot # Buildbot
RUN apt-get install -yq --no-install-suggests --no-install-recommends \ RUN apt-get install -yq --no-install-suggests --no-install-recommends \
@ -35,7 +35,7 @@ ENTRYPOINT /usr/local/bin/buildbot_entrypoint.sh "$BUILDMASTER" "$WORKERNAME" "$
""" """
dockerfile_extra_contents_bionic = """ dockerfile_extra_contents['bionic'] = """
# Buildbot # Buildbot
RUN apt-get install -yq --no-install-suggests --no-install-recommends \ RUN apt-get install -yq --no-install-suggests --no-install-recommends \
@ -69,7 +69,7 @@ def list_jobs(directory=".buildbot"):
return results return results
def _get_dockerfile_contents(jobname, os_codename): 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
""" """
@ -78,10 +78,7 @@ def _get_dockerfile_contents(jobname, os_codename):
# remove any line containing FROM or RUN keywords # remove any line containing FROM or RUN keywords
re.match(r"(?m)^(FROM|RUN).*$", "", contents) re.match(r"(?m)^(FROM|RUN).*$", "", contents)
return contents + { return contents + dockerfile_extra_contents[os_codename]
"focal": dockerfile_extra_contents_focal,
"bionic": dockerfile_extra_contents_bionic,
}[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):

View File

@ -29,9 +29,9 @@ def find_artifacts(directory="out"):
return join(directory, _) return join(directory, _)
@util.renderer # @util.renderer
def get_dockerfile_contents(props): # def get_dockerfile_contents(props):
return _get_dockerfile_contents(props.getProperty('jobname', default=None), util.Interpolate("%(prop:os_codename)s")) # return _get_dockerfile_contents(props.getProperty('jobname', default=None), util.Interpolate("%(prop:os_codename)s"))
def add_parent_step(build_factory): def add_parent_step(build_factory):
@ -44,13 +44,13 @@ def add_parent_step(build_factory):
command=["sudo", "wget", "-O", "https://git.bitmessage.org/Bitmessage/buildbot_multibuild/raw/branch/master/lib/worker_multibuild.py", "worker_multibuild.py"] command=["sudo", "wget", "-O", "https://git.bitmessage.org/Bitmessage/buildbot_multibuild/raw/branch/master/lib/worker_multibuild.py", "worker_multibuild.py"]
)) ))
build_factory.addStep( # build_factory.addStep(
steps.SetPropertyFromCommand( # steps.SetPropertyFromCommand(
name="Get OS codename", # name="Get OS codename",
command="grep ^VERSION_CODENAME= /etc/os-release | cut -d= -f2", # command="grep ^VERSION_CODENAME= /etc/os-release | cut -d= -f2",
property="os_codename", # property="os_codename",
) # )
) # )
build_factory.addStep( build_factory.addStep(
steps.ShellCommand( steps.ShellCommand(