From fa213e5733ef4c4832e33bd79c04ec24d2d54128 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Peter=20=C5=A0urda?= Date: Mon, 8 Aug 2022 11:21:33 +0800 Subject: [PATCH] Add uploading --- lib/renderers.py | 11 +++++++++++ multibuild.py | 30 +++++++++++++++++++++++++++++- 2 files changed, 40 insertions(+), 1 deletion(-) diff --git a/lib/renderers.py b/lib/renderers.py index f8632f1..e638146 100644 --- a/lib/renderers.py +++ b/lib/renderers.py @@ -22,3 +22,14 @@ def is_test_script_available(props): @util.renderer def isnt_test_script_available(props): return not _is_test_script_available(props) + +def _files_to_upload(props): + return ','.join(props.getProperty(files_to_upload).split("\n"), default="") + +@util_renderer +def files_to_upload(props): + return files_to_upload(props) + +@util_renderer +def no_files_to_upload(props): + return not _files_to_upload(props) diff --git a/multibuild.py b/multibuild.py index 1d70c94..bcb64dc 100644 --- a/multibuild.py +++ b/multibuild.py @@ -63,9 +63,37 @@ def add_child_sh_steps(build_factory, directory=".buildbot"): build_factory.addStep( steps.ShellCommand( - name= util.Interpolate("test_%(prop:jobname)s"), + name=util.Interpolate("test_%(prop:jobname)s"), command=util.Interpolate("%(kw:directory)s/%(prop:jobname)s/test.sh", directory=directory), doStepIf=is_test_script_available, hideStepIf=isnt_test_script_available, ) ) + + build_factory.addStep( + steps.SetPropertyFromCommand( + name="Find files to upload", + command="find out -maxdepth 0 -mindepth 0 " + "-type f -printf {'%P\n'}", + workdir="out", + hideStepIf=True, + property="files_to_upload" + ) + ) + + build_factory.addStep( + steps.ShellCommand( + name="Upload files", + workdir="out", + doStepIf=files_to_upload, + hideStepIf=no_files_to_upload, + command=util.Interpolate( + "curl -T {%s} " + "https://buildbot@%{s}:artifacts.bitmessage.at/%s/%s/", + files_to_upload, + util.Secret('artifact_upload'), + util.Property('jobname'), + util.Property('buildnumber'), + ) + ) + )