Add signing and environment variables
This commit is contained in:
parent
970e2f1f0f
commit
ec69e113bf
|
@ -40,3 +40,42 @@ def has_files_to_upload(props):
|
|||
@util.renderer
|
||||
def no_files_to_upload(props):
|
||||
return not _files_to_upload(props)
|
||||
|
||||
def _should_build_sign(props):
|
||||
if props.getProperty('branch') == 'v0.6' \
|
||||
and props.getProperty('jobname') == 'android' \
|
||||
and props.getProperty('repository') in (
|
||||
'git@github.com:Bitmessage/PyBitmessage.git',
|
||||
'https://github.com/Bitmessage/PyBitmessage'
|
||||
):
|
||||
return True
|
||||
return False
|
||||
|
||||
@util.renderer
|
||||
def should_build_sign(props):
|
||||
return _is_build_script_available(props) and _should_build_sign(props)
|
||||
|
||||
@util.renderer
|
||||
def shouldnt_build_sign(props):
|
||||
return _is_build_script_available(props) and not _should_build_sign(props)
|
||||
|
||||
@util.renderer
|
||||
|
||||
@util.renderer
|
||||
def build_env(props):
|
||||
default_envs = {
|
||||
BUILDBOT_REPOSITORY: props.getProperty("repository")
|
||||
BUILDBOT_BRANCH: props.getProperty("branch")
|
||||
BUILDBOT_JOB: props.getProperty("job")
|
||||
}
|
||||
new_envs = {}
|
||||
if props.getProperty("jobname", default="") == "android":
|
||||
new_envs = {
|
||||
"P4A_RELEASE_KEYSTORE": "/var/lib/buildbot/keystore",
|
||||
"P4A_RELEASE_KEYSTORE_PASSWD": util.Secret("bitmessage-keystore"),
|
||||
"P4A_RELEASE_KEYALIAS_PASSWD": util.Secret("bitmessage-keystore"),
|
||||
"P4A_RELEASE_KEYALIAS": "bitmessagetest"
|
||||
}
|
||||
if _should_build_sign(props):
|
||||
return {**default_envs, **new_envs}
|
||||
return default_envs
|
||||
|
|
|
@ -53,18 +53,52 @@ def add_child_sh_steps(build_factory, directory=".buildbot"):
|
|||
Add a step to the download, build and test factory
|
||||
"""
|
||||
|
||||
build_factory.addStep(
|
||||
steps.FileDownload(
|
||||
name="Upload keystore",
|
||||
workerdest="/var/lib/buildbot/keystore",
|
||||
mastersrc=util.Interpolate("keystore/%(prop:jobname)s.keystore")
|
||||
doStepIf=should_build_sign,
|
||||
hideStepIf=True,
|
||||
mode=0o600
|
||||
)
|
||||
)
|
||||
|
||||
build_factory.addStep(
|
||||
steps.ShellCommand(
|
||||
name=util.Interpolate("build_%(prop:jobname)s"),
|
||||
command=util.Interpolate("%(kw:directory)s/"
|
||||
"%(prop:jobname)s/build.sh",
|
||||
directory=directory),
|
||||
doStepIf=is_build_script_available,
|
||||
env=build_env,
|
||||
doStepIf=should_build_sign,
|
||||
hideStepIf=isnt_build_script_available,
|
||||
timeout=7200,
|
||||
)
|
||||
)
|
||||
|
||||
build_factory.addStep(
|
||||
steps.ShellCommand(
|
||||
name=util.Interpolate("build_and_sign_%(prop:jobname)s"),
|
||||
command=util.Interpolate("%(kw:directory)s/"
|
||||
"%(prop:jobname)s/build.sh",
|
||||
directory=directory),
|
||||
env=build_env,
|
||||
doStepIf=should_build_sign,
|
||||
hideStepIf=isnt_build_script_available,
|
||||
timeout=7200,
|
||||
)
|
||||
)
|
||||
|
||||
build_factory.addStep(
|
||||
steps.ShellCommand(
|
||||
name="Delete keystore",
|
||||
command="rm -f /var/lib/buildbot/keystore",
|
||||
doStepIf=should_build_sign,
|
||||
hideStepIf=True,
|
||||
)
|
||||
)
|
||||
|
||||
build_factory.addStep(
|
||||
steps.ShellCommand(
|
||||
name=util.Interpolate("test_%(prop:jobname)s"),
|
||||
|
|
Loading…
Reference in New Issue
Block a user