Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Refactor utils.py #637

Merged
merged 2 commits into from
Jan 7, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
33 changes: 22 additions & 11 deletions common_factories.py
Original file line number Diff line number Diff line change
Expand Up @@ -34,8 +34,9 @@
mtrEnv,
mtrJobsMultiplier,
printEnv,
savedPackageBranches,
saveLogs,
savePackage,
savePackageIfBranchMatch,
)


Expand Down Expand Up @@ -142,7 +143,7 @@ def addPostTests(factory):
steps.SetPropertyFromCommand(
command="basename mariadb-*-linux-*.tar.gz",
property="mariadb_binary",
doStepIf=savePackage,
doStepIf=lambda step: savePackageIfBranchMatch(step, savedPackageBranches),
)
)
factory.addStep(
Expand All @@ -158,7 +159,7 @@ def addPostTests(factory):
&& sync /packages/%(prop:tarbuildnum)s
"""
),
doStepIf=savePackage,
doStepIf=lambda step: savePackageIfBranchMatch(step, savedPackageBranches),
)
)
factory.addStep(
Expand All @@ -174,7 +175,10 @@ def addPostTests(factory):
"master_branch": Property("master_branch"),
"parentbuildername": Property("buildername"),
},
doStepIf=lambda step: savePackage(step) and hasEco(step),
doStepIf=(
lambda step: savePackageIfBranchMatch(step, savedPackageBranches)
and hasEco(step)
),
)
)
factory.addStep(
Expand Down Expand Up @@ -747,7 +751,10 @@ def getRpmAutobakeFactory(mtrDbPool):
sync /packages/%(prop:tarbuildnum)s
"""
),
doStepIf=lambda step: hasFiles(step) and savePackage(step),
doStepIf=(
lambda step: hasFiles(step)
and savePackageIfBranchMatch(step, savedPackageBranches)
),
descriptionDone=util.Interpolate(
"""
Repository available with: curl %(kw:url)s/%(prop:tarbuildnum)s/%(prop:buildername)s/MariaDB.repo -o /etc/yum.repos.d/MariaDB.repo""",
Expand Down Expand Up @@ -784,9 +791,11 @@ def getRpmAutobakeFactory(mtrDbPool):
"master_branch": Property("master_branch"),
"parentbuildername": Property("buildername"),
},
doStepIf=lambda step: hasInstall(step)
and savePackage(step)
and hasFiles(step),
doStepIf=(
lambda step: hasInstall(step)
and savePackageIfBranchMatch(step, savedPackageBranches)
and hasFiles(step)
),
)
)
f_rpm_autobake.addStep(
Expand All @@ -801,9 +810,11 @@ def getRpmAutobakeFactory(mtrDbPool):
"master_branch": Property("master_branch"),
"parentbuildername": Property("buildername"),
},
doStepIf=lambda step: hasUpgrade(step)
and savePackage(step)
and hasFiles(step),
doStepIf=(
lambda step: hasUpgrade(step)
and savePackageIfBranchMatch(step, savedPackageBranches)
and hasFiles(step)
),
)
)
f_rpm_autobake.addStep(
Expand Down
2 changes: 1 addition & 1 deletion master-bintars/master.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -265,7 +265,7 @@ def getBintarFactory(
+ " && sync /packages/"
+ "%(prop:tarbuildnum)s"
),
doStepIf=savePackage,
doStepIf=lambda step: savePackageIfBranchMatch(step, savedPackageBranches),
)
)

Expand Down
14 changes: 9 additions & 5 deletions master-docker-nonstandard-2/master.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -502,7 +502,6 @@ f_big_test.addStep(
command="basename mariadb-*-linux-*.tar.gz", property="mariadb_binary"
)
)
# f_big_test.addStep(steps.ShellCommand(name='save_packages', timeout=7200, haltOnFailure=True, command=util.Interpolate('mkdir -p ' + '/packages/' + '%(prop:tarbuildnum)s' + '/' + '%(prop:buildername)s'+ ' && sha256sum %(prop:mariadb_binary)s >> sha256sums.txt && cp ' + '%(prop:mariadb_binary)s sha256sums.txt' + ' /packages/' + '%(prop:tarbuildnum)s' + '/' + '%(prop:buildername)s' + '/' + ' && sync /packages/' + '%(prop:tarbuildnum)s'), doStepIf=savePackage))
f_big_test.addStep(
steps.ShellCommand(
name="cleanup", command="rm -r * .* 2> /dev/null || true", alwaysRun=True
Expand Down Expand Up @@ -757,7 +756,8 @@ f_without_server.addStep(
+ " && sync /packages/"
+ "%(prop:tarbuildnum)s"
),
doStepIf=savePackage,
doStepIf=lambda step: savePackageIfBranchMatch(step,
savedPackageBranches),
)
)
f_without_server.addStep(
Expand Down Expand Up @@ -1044,7 +1044,8 @@ f_bintar.addStep(
steps.SetPropertyFromCommand(
command="basename mariadb-*-linux-*.tar.gz",
property="mariadb_binary",
doStepIf=savePackage,
doStepIf=lambda step: savePackageIfBranchMatch(step,
savedPackageBranches),
)
)
f_bintar.addStep(
Expand All @@ -1068,7 +1069,8 @@ f_bintar.addStep(
+ " && sync /packages/"
+ "%(prop:tarbuildnum)s"
),
doStepIf=savePackage,
doStepIf=lambda step: savePackageIfBranchMatch(step,
savedPackageBranches),
)
)
f_bintar.addStep(
Expand All @@ -1085,7 +1087,9 @@ f_bintar.addStep(
"master_branch": Property("master_branch"),
"parentbuildername": Property("buildername"),
},
doStepIf=lambda step: savePackage(step) and hasEco(step),
doStepIf=(lambda step: savePackageIfBranchMatch(step,
savedPackageBranches)
and hasEco(step)),
)
)
f_bintar.addStep(
Expand Down
9 changes: 4 additions & 5 deletions master-docker-nonstandard/master.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -997,7 +997,6 @@ f_big_test.addStep(
command="basename mariadb-*-linux-*.tar.gz", property="mariadb_binary"
)
)
# f_big_test.addStep(steps.ShellCommand(name='save_packages', timeout=7200, haltOnFailure=True, command=util.Interpolate('mkdir -p ' + '/packages/' + '%(prop:tarbuildnum)s' + '/' + '%(prop:buildername)s'+ ' && sha256sum %(prop:mariadb_binary)s >> sha256sums.txt && cp ' + '%(prop:mariadb_binary)s sha256sums.txt' + ' /packages/' + '%(prop:tarbuildnum)s' + '/' + '%(prop:buildername)s' + '/' + ' && sync /packages/' + '%(prop:tarbuildnum)s'), doStepIf=savePackage))
f_big_test.addStep(
steps.ShellCommand(
name="cleanup", command="rm -r * .* 2> /dev/null || true", alwaysRun=True
Expand Down Expand Up @@ -1134,7 +1133,7 @@ f_without_server.addStep(
+ " && sync /packages/"
+ "%(prop:tarbuildnum)s"
),
doStepIf=savePackage,
doStepIf=lambda step: savePackageIfBranchMatch(step, savedPackageBranches),
)
)
f_without_server.addStep(
Expand Down Expand Up @@ -1422,7 +1421,7 @@ f_bintar.addStep(
steps.SetPropertyFromCommand(
command="basename mariadb-*-linux-*.tar.gz",
property="mariadb_binary",
doStepIf=savePackage,
doStepIf=lambda step: savePackageIfBranchMatch(step, savedPackageBranches),
)
)
f_bintar.addStep(
Expand All @@ -1446,7 +1445,7 @@ f_bintar.addStep(
+ " && sync /packages/"
+ "%(prop:tarbuildnum)s"
),
doStepIf=savePackage,
doStepIf=lambda step: savePackageIfBranchMatch(step, savedPackageBranches),
)
)
f_bintar.addStep(
Expand All @@ -1463,7 +1462,7 @@ f_bintar.addStep(
"master_branch": Property("master_branch"),
"parentbuildername": Property("buildername"),
},
doStepIf=lambda step: savePackage(step) and hasEco(step),
doStepIf=lambda step: savePackageIfBranchMatch(step, savedPackageBranches) and hasEco(step),
)
)
f_bintar.addStep(
Expand Down
8 changes: 4 additions & 4 deletions master-galera/master.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -265,7 +265,7 @@ def dpkgDeb():
"""
),
],
doStepIf=lambda step: savePackage(step, savedPackageBranches),
doStepIf=lambda step: savePackageIfBranchMatch(step, savedPackageBranches),
)


Expand All @@ -284,7 +284,7 @@ def rpmSave():
"""
),
],
doStepIf=lambda step: savePackage(step, savedPackageBranches),
doStepIf=lambda step: savePackageIfBranchMatch(step, savedPackageBranches),
)


Expand Down Expand Up @@ -366,7 +366,7 @@ EOF
""",
url=os.getenv("ARTIFACTS_URL", default="https://ci.mariadb.org"),
),
doStepIf=lambda step: savePackage(step, savedPackageBranches),
doStepIf=lambda step: savePackageIfBranchMatch(step, savedPackageBranches),
)
)
f_deb_build.addStep(
Expand Down Expand Up @@ -423,7 +423,7 @@ EOF
""",
url=os.getenv("ARTIFACTS_URL", default="https://ci.mariadb.org"),
),
doStepIf=lambda step: savePackage(step, savedPackageBranches),
doStepIf=lambda step: savePackageIfBranchMatch(step, savedPackageBranches),
)
)
f_rpm_build.addStep(
Expand Down
1 change: 1 addition & 0 deletions master-libvirt/master.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ sys.setrecursionlimit(10000)
sys.path.insert(0, "/srv/buildbot/master")

from utils import *
RazvanLiviuVarzaru marked this conversation as resolved.
Show resolved Hide resolved
from constants import os_info

# This is the dictionary that the buildmaster pays attention to. We also use
# a shorter alias to save typing.
Expand Down
6 changes: 4 additions & 2 deletions master-nonlatent/master.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -535,7 +535,8 @@ f_windows_msi.addStep(
'/'

),
doStepIf=savePackage,
doStepIf=lambda step: savePackageIfBranchMatch(step,
savedPackageBranches),
)
)
f_windows_msi.addStep(
Expand All @@ -557,7 +558,8 @@ f_windows_msi.addStep(
'%(prop:buildername)s'
'/'
),
doStepIf=savePackage,
doStepIf=lambda step: savePackageIfBranchMatch(step,
savedPackageBranches),
)
)
f_windows_msi.addStep(
Expand Down
3 changes: 0 additions & 3 deletions master-protected-branches/master.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -422,9 +422,6 @@ f_tarball.addStep(
doStepIf=lambda step: isStagingBranch(step),
)
)
# f_tarball.addStep(steps.ShellSequence( commands=[
# util.ShellArg(command=util.Interpolate("git checkout " + "%(prop:staging_branch)s"), logfile="rebase"),
# util.ShellArg(command=util.Interpolate("git merge %(prop:branch)s"), logfile="rebase")], workdir="build/server", haltOnFailure="true", doStepIf=ifStagingSucceeding))
f_tarball.addStep(
steps.ShellCommand(
name="cleanup", command="rm -r * .* 2> /dev/null || true", alwaysRun=True
Expand Down
10 changes: 7 additions & 3 deletions master.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -235,7 +235,7 @@ f_deb_autobake.addStep(
"master_branch": Property("master_branch"),
"parentbuildername": Property("buildername"),
},
doStepIf=lambda step: savePackage(step),
doStepIf=lambda step: savePackageIfBranchMatch(step, savedPackageBranches),
)
)
f_deb_autobake.addStep(
Expand All @@ -250,7 +250,9 @@ f_deb_autobake.addStep(
"master_branch": Property("master_branch"),
"parentbuildername": Property("buildername"),
},
doStepIf=lambda step: hasInstall(step) and savePackage(step) and hasFiles(step),
doStepIf=(lambda step: hasInstall(step)
and savePackageIfBranchMatch(step, savedPackageBranches)
and hasFiles(step)),
)
)
f_deb_autobake.addStep(
Expand All @@ -265,7 +267,9 @@ f_deb_autobake.addStep(
"master_branch": Property("master_branch"),
"parentbuildername": Property("buildername"),
},
doStepIf=lambda step: hasUpgrade(step) and savePackage(step) and hasFiles(step),
doStepIf=(lambda step: hasUpgrade(step)
and savePackageIfBranchMatch(step, savedPackageBranches)
and hasFiles(step)),
)
)
f_deb_autobake.addStep(
Expand Down
Loading