From 4bf6fb73b2e971f9e652d548bd7d8b7d21e173e9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Peter=20=C5=A0urda?= Date: Mon, 8 Aug 2022 16:20:14 +0800 Subject: [PATCH] Fix upload --- lib/renderers.py | 11 +++++++++-- multibuild.py | 12 +++++++----- 2 files changed, 16 insertions(+), 7 deletions(-) diff --git a/lib/renderers.py b/lib/renderers.py index dfcbbaf..e52016d 100644 --- a/lib/renderers.py +++ b/lib/renderers.py @@ -24,11 +24,18 @@ 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="") + try: + return ','.join(props.getProperty("files_to_upload", default="").rstrip().split("\n")) + except AttributeError: + return "" @util.renderer def files_to_upload(props): - return files_to_upload(props) + return _files_to_upload(props) + +@util.renderer +def has_files_to_upload(props): + return bool(_files_to_upload(props)) @util.renderer def no_files_to_upload(props): diff --git a/multibuild.py b/multibuild.py index bcb64dc..4d1bb83 100644 --- a/multibuild.py +++ b/multibuild.py @@ -13,6 +13,7 @@ Requires docker from os import listdir from os.path import isfile, join from buildbot.plugins import steps, util +from buildbot.process.results import SUCCESS from .lib.renderers import * @@ -73,10 +74,11 @@ def add_child_sh_steps(build_factory, directory=".buildbot"): build_factory.addStep( steps.SetPropertyFromCommand( name="Find files to upload", - command="find out -maxdepth 0 -mindepth 0 " - "-type f -printf {'%P\n'}", + command="find . -maxdepth 1 -mindepth 1 " + "-type f -printf '%P\n'", workdir="out", hideStepIf=True, + decodeRC={0:SUCCESS, 1:SUCCESS}, property="files_to_upload" ) ) @@ -85,11 +87,11 @@ def add_child_sh_steps(build_factory, directory=".buildbot"): steps.ShellCommand( name="Upload files", workdir="out", - doStepIf=files_to_upload, + doStepIf=has_files_to_upload, hideStepIf=no_files_to_upload, command=util.Interpolate( - "curl -T {%s} " - "https://buildbot@%{s}:artifacts.bitmessage.at/%s/%s/", + "curl -T {%s} -u buildbot:%s " + "https://artifacts.bitmessage.at/%s/%s/", files_to_upload, util.Secret('artifact_upload'), util.Property('jobname'),