Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
59 commits
Select commit Hold shift + click to select a range
befd922
FileUploadIfNotExist
steven-johnson Jan 22, 2024
0089100
Update custom_steps.py
steven-johnson Jan 22, 2024
138d3ff
Update custom_steps.py
steven-johnson Jan 22, 2024
2b4ccc8
Update custom_steps.py
steven-johnson Jan 22, 2024
81a6bc0
Update custom_steps.py
steven-johnson Jan 22, 2024
f69c68e
Update custom_steps.py
steven-johnson Jan 22, 2024
c07b25d
Update custom_steps.py
steven-johnson Jan 22, 2024
7f3b843
Update custom_steps.py
steven-johnson Jan 22, 2024
de84a73
Update custom_steps.py
steven-johnson Jan 22, 2024
2e7faf9
Update custom_steps.py
steven-johnson Jan 22, 2024
a45bd6e
Merge branch 'master' into srj/conditional-upload
steven-johnson Jan 23, 2024
b5af93c
Clean old uploads by commit, not by timestamp
steven-johnson Jan 23, 2024
f2c78f1
Update custom_steps.py
steven-johnson Jan 23, 2024
355a028
Update custom_steps.py
steven-johnson Jan 23, 2024
a59d15e
Update custom_steps.py
steven-johnson Jan 23, 2024
5aa383c
Merge branch 'srj/conditional-upload' into srj/clean-other
steven-johnson Jan 23, 2024
79bc139
Update custom_steps.py
steven-johnson Jan 23, 2024
2771afa
Update custom_steps.py
steven-johnson Jan 23, 2024
2a2abc6
Update custom_steps.py
steven-johnson Jan 23, 2024
b54c0a2
Update custom_steps.py
steven-johnson Jan 23, 2024
99763b0
Update custom_steps.py
steven-johnson Jan 23, 2024
7b7c1e5
Merge branch 'srj/conditional-upload' into srj/clean-other
steven-johnson Jan 23, 2024
e4f3967
Update master.cfg
steven-johnson Jan 23, 2024
f8ed6c0
sdf
steven-johnson Jan 23, 2024
c20c7bb
Update master.cfg
steven-johnson Jan 23, 2024
36d6e9d
Update master.cfg
steven-johnson Jan 23, 2024
65c3bd1
Update master.cfg
steven-johnson Jan 23, 2024
ba76fbc
Update custom_steps.py
steven-johnson Jan 23, 2024
80d69af
Update custom_steps.py
steven-johnson Jan 23, 2024
613ade3
Update custom_steps.py
steven-johnson Jan 23, 2024
abce494
Update custom_steps.py
steven-johnson Jan 23, 2024
0c0f3ea
Update custom_steps.py
steven-johnson Jan 23, 2024
04673ae
Update custom_steps.py
steven-johnson Jan 24, 2024
dd8ae05
Update custom_steps.py
steven-johnson Jan 24, 2024
5cdeece
Update custom_steps.py
steven-johnson Jan 24, 2024
658305e
sdf
steven-johnson Jan 24, 2024
786ccb0
Update master.cfg
steven-johnson Jan 24, 2024
c8eb354
Merge branch 'srj/conditional-upload' into srj/clean-other
steven-johnson Jan 24, 2024
cb5677e
sdf
steven-johnson Jan 24, 2024
38d2136
Update custom_steps.py
steven-johnson Jan 24, 2024
9484079
Update custom_steps.py
steven-johnson Jan 24, 2024
3e06c2e
Update master.cfg
steven-johnson Jan 24, 2024
7835e9d
Update master.cfg
steven-johnson Jan 24, 2024
77b4bab
Update master.cfg
steven-johnson Jan 24, 2024
c0027d9
Update master.cfg
steven-johnson Jan 24, 2024
ecfd619
Merge branch 'master' into srj/clean-other
steven-johnson Jan 24, 2024
761d490
sdf
steven-johnson Jan 24, 2024
8672ac3
Update custom_steps.py
steven-johnson Jan 24, 2024
ee4fc26
Update master.cfg
steven-johnson Jan 24, 2024
69e6444
Update master.cfg
steven-johnson Jan 24, 2024
cfb1073
Merge branch 'master' into srj/clean-other
steven-johnson Jan 25, 2024
ddd4ac6
Merge branch 'master' into srj/clean-other
steven-johnson Jan 26, 2024
3d86bb7
Update master.cfg
steven-johnson Jan 26, 2024
c7df6f2
Update master.cfg
steven-johnson Jan 26, 2024
b13481e
sdf
steven-johnson Jan 26, 2024
7ca882b
Update master.cfg
steven-johnson Jan 26, 2024
a2d2655
Update custom_steps.py
steven-johnson Jan 26, 2024
580be57
Update custom_steps.py
steven-johnson Jan 26, 2024
1fd21ed
sdf
steven-johnson Jan 26, 2024
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
39 changes: 38 additions & 1 deletion master/custom_steps.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
from buildbot.steps.worker import CompositeStepMixin
from twisted.internet import defer

__all__ = ['CleanOldFiles', 'CTest', 'FileUploadIfNotExist', 'SetPropertiesFromCMakeCache']
__all__ = ['CleanOldFiles', 'CTest', 'DeleteMatchingFilesInDir', 'FileUploadIfNotExist', 'SetPropertiesFromCMakeCache']


class SetPropertiesFromCMakeCache(CompositeStepMixin, BuildStep):
Expand Down Expand Up @@ -131,6 +131,43 @@ def run(self):
return status


# Delete all files in workdir that match must_match_re but do not match must_not_match_re.
# If must_not_match_re is None, delete all files that match must_match_re.
# Note that the regexps are compared against the (leaf) name, not the full pathname.
class DeleteMatchingFilesInDir(BuildStep):
name = 'delete-matching-files-in-dir'

renderables = ['must_match_re', 'must_not_match_re']

def __init__(self, *, workdir, must_match_re, must_not_match_re=None, **kwargs):
super().__init__(**kwargs)
self.workdir = workdir
self.must_match_re = must_match_re
self.must_not_match_re = must_not_match_re

@defer.inlineCallbacks
def run(self):
stdio = yield self.addLog('stdio')
status = SUCCESS

for entry in Path(self.workdir).iterdir():
if not entry.is_file():
continue
if not re.match(self.must_match_re, entry.name):
continue
if self.must_not_match_re and re.match(self.must_not_match_re, entry.name):
continue
try:
entry.unlink()
stdio.addStdout(f'Removed: {entry.resolve()}\n')
except (FileNotFoundError, OSError) as e:
stdio.addStderr(f'Could not delete {entry.resolve()}: {e}\n')
status = FAILURE

yield stdio.finish()
return status


# Like FileUpload, but if the dest file already exists,
# just log that to stdio and do nothing. Useful when the
# filename contains (eg) a git commit or SHA that uniquely
Expand Down
41 changes: 29 additions & 12 deletions master/master.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,8 @@ from buildbot.www.authz.roles import RolesFromUsername
from buildbot.www.hooks.github import GitHubEventHandler
from twisted.internet import defer

from custom_steps import CTest, CleanOldFiles, FileUploadIfNotExist, SetPropertiesFromCMakeCache
from custom_steps import (CTest, CleanOldFiles, DeleteMatchingFilesInDir,
FileUploadIfNotExist, SetPropertiesFromCMakeCache)

# This is the dictionary that the buildmaster pays attention to. We also use
# a shorter alias to save typing.
Expand Down Expand Up @@ -722,8 +723,7 @@ def get_cmake_build_command(builder_type, build_dir, targets=None):
return cmd


# options in LLVM that we always want OFF because they aren't needed
# for Halide buildbot usage.
# options in LLVM that we always want OFF because they aren't needed for Halide.
_LLVM_OFF_OPTS = [
"CLANG_ENABLE_ARCMT"
"CLANG_ENABLE_CLANGD"
Expand Down Expand Up @@ -1119,10 +1119,13 @@ def add_llvm_steps(factory, builder_type, clean_rebuild):
env=Property('env'),
command=get_llvm_latest_commit_cmd(builder_type)))

def get_packaged_version(builder_type):
v = LLVM_BRANCHES[builder_type.llvm_branch].version
return "%d.%d.%d" % (v.major, v.minor, v.patch)

# Note that this must only be called by a Renderer
def get_packaged_name(props, builder_type):
v = LLVM_BRANCHES[builder_type.llvm_branch].version
version = "%d.%d.%d" % (v.major, v.minor, v.patch)
version = get_packaged_version(builder_type)
# 'halide_target()' is correct here because we want the halide-style
# triple that this llvm was build for
target = builder_type.halide_target()
Expand Down Expand Up @@ -1198,17 +1201,31 @@ def add_llvm_steps(factory, builder_type, clean_rebuild):
mode=0o644,
masterdest=get_upload_dest_path(builder_type)))

def pkg_version_and_target(path: Path):
# Archives names are formatted like: llvm-[version]-[arch]-[commit].[ext]
# This grabs "llvm-[version]-[arch]".
match = re.match(r'^(.*)-[a-f0-9]+\.zst', path.name)
return match.group(1) if match else None
def matches_version_and_target():
@renderer
def render(props):
version = get_packaged_version(builder_type)
target = builder_type.halide_target()
return rf'^llvm-{version}-{target}-([a-f0-9]+)\.zst$'

factory.addStep(CleanOldFiles(
return render

def matches_version_and_target_and_commit():
@renderer
def render(props):
version = get_packaged_version(builder_type)
target = builder_type.halide_target()
commit = props.getProperty('got_revision')['llvm']
return rf'^llvm-{version}-{target}-{commit}\.zst$'

return render

factory.addStep(DeleteMatchingFilesInDir(
name='Clean old LLVM packages',
workdir=ARTIFACTS_DIR,
locks=[performance_lock.access('counting')],
groupfn=pkg_version_and_target))
must_match_re=matches_version_and_target(),
must_not_match_re=matches_version_and_target_and_commit()))


def add_halide_cmake_build_steps(factory, builder_type):
Expand Down