Fix upload

This commit is contained in:
Peter Šurda 2022-08-08 16:20:14 +08:00
parent f65acbc243
commit 4bf6fb73b2
Signed by: 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) return not _is_test_script_available(props)
def _files_to_upload(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 @util.renderer
def files_to_upload(props): 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 @util.renderer
def no_files_to_upload(props): def no_files_to_upload(props):

View File

@ -13,6 +13,7 @@ Requires docker
from os import listdir from os import listdir
from os.path import isfile, join from os.path import isfile, join
from buildbot.plugins import steps, util from buildbot.plugins import steps, util
from buildbot.process.results import SUCCESS
from .lib.renderers import * from .lib.renderers import *
@ -73,10 +74,11 @@ def add_child_sh_steps(build_factory, directory=".buildbot"):
build_factory.addStep( build_factory.addStep(
steps.SetPropertyFromCommand( steps.SetPropertyFromCommand(
name="Find files to upload", name="Find files to upload",
command="find out -maxdepth 0 -mindepth 0 " command="find . -maxdepth 1 -mindepth 1 "
"-type f -printf {'%P\n'}", "-type f -printf '%P\n'",
workdir="out", workdir="out",
hideStepIf=True, hideStepIf=True,
decodeRC={0:SUCCESS, 1:SUCCESS},
property="files_to_upload" property="files_to_upload"
) )
) )
@ -85,11 +87,11 @@ def add_child_sh_steps(build_factory, directory=".buildbot"):
steps.ShellCommand( steps.ShellCommand(
name="Upload files", name="Upload files",
workdir="out", workdir="out",
doStepIf=files_to_upload, doStepIf=has_files_to_upload,
hideStepIf=no_files_to_upload, hideStepIf=no_files_to_upload,
command=util.Interpolate( command=util.Interpolate(
"curl -T {%s} " "curl -T {%s} -u buildbot:%s "
"https://buildbot@%{s}:artifacts.bitmessage.at/%s/%s/", "https://artifacts.bitmessage.at/%s/%s/",
files_to_upload, files_to_upload,
util.Secret('artifact_upload'), util.Secret('artifact_upload'),
util.Property('jobname'), util.Property('jobname'),