buildbot_multibuild/lib/renderers.py

80 lines
2.4 KiB
Python
Raw Normal View History

2021-12-23 09:01:52 +01:00
from buildbot.plugins import util
import re
def _is_build_script_available(props):
return props.getProperty("build_script_available", default=False)
2021-12-23 09:01:52 +01:00
@util.renderer
2021-12-25 07:57:44 +01:00
def is_build_script_available(props):
return _is_build_script_available(props)
2021-12-23 09:01:52 +01:00
@util.renderer
2021-12-25 07:57:44 +01:00
def isnt_build_script_available(props):
return not _is_build_script_available(props)
2021-12-23 09:01:52 +01:00
def _is_test_script_available(props):
return props.getProperty("test_script_available", default=False)
2021-12-23 09:01:52 +01:00
@util.renderer
2021-12-25 07:57:44 +01:00
def is_test_script_available(props):
return _is_test_script_available(props)
2021-12-23 09:01:52 +01:00
@util.renderer
2021-12-25 07:57:44 +01:00
def isnt_test_script_available(props):
return not _is_test_script_available(props)
2022-08-08 05:21:33 +02:00
def _files_to_upload(props):
2022-08-08 10:20:14 +02:00
try:
return ','.join(props.getProperty("files_to_upload", default="").rstrip().split("\n"))
except AttributeError:
return ""
2022-08-08 05:21:33 +02:00
2022-08-08 05:40:59 +02:00
@util.renderer
2022-08-08 05:21:33 +02:00
def files_to_upload(props):
2022-08-08 10:20:14 +02:00
return _files_to_upload(props)
@util.renderer
def has_files_to_upload(props):
return bool(_files_to_upload(props))
2022-08-08 05:21:33 +02:00
2022-08-08 05:40:59 +02:00
@util.renderer
2022-08-08 05:21:33 +02:00
def no_files_to_upload(props):
return not _files_to_upload(props)
2024-03-29 09:46:07 +01:00
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
def build_env(props):
default_envs = {
2024-03-29 11:09:58 +01:00
"BUILDBOT_REPOSITORY": props.getProperty("repository"),
"BUILDBOT_BRANCH": props.getProperty("branch"),
2024-03-29 11:14:27 +01:00
"BUILDBOT_JOBNAME": props.getProperty("jobname")
2024-03-29 09:46:07 +01:00
}
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