Fix upload

This commit is contained in:
Peter Šurda 2022-08-08 16:20:14 +08:00
parent f65acbc243
commit 4bf6fb73b2
Signed by untrusted user: PeterSurda
GPG Key ID: 3E47497CF67ABB95
2 changed files with 16 additions and 7 deletions

View File

@ -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):

View File

@ -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'),