conan-package-tools
conan-package-tools copied to clipboard
Consider complimentary "build_filter" commit message parsing
Currently we have a big pain point that we cannot re-run a single "build" within a job on Appveyor. I found the same true on Travis with parallel stages. We can do it for Travis through the UI, but not appveyor.
Conan package tools commit message parsing is a useful feature with a very small scope.
Now that we are parsing commit messages with CPT, and applying filtering of which builds to run as a result, it seems feasible to extend it to be able to specify something like the following:
[build_filter=<query>]
where <query>
uses the syntax of the conan search
command for example:
[build_policy=os=Windows AND compiler.version=15 AND build_type=Release]
With this, we would have precision control over triggering rebuilds any CI system, regardless of it's internal featureset.
The code and unit testing to be added for query parsing and the filtering layer is non-trivial, so a lot of people would have to vote for this feature to justify it. While non-trivial, it is certainly feasible, and we could potentially borrow some code from Conan client.
Note: I originally wrote this as an extension of build_policy
, however I have since updated the suggestion to use a new keyword build_filter
because the two are probably orthagonal.
I like the idea.
sorry, really low on time but want to drop this somewhere so i don't forget. i will try to make a PR next time i get to it. anyone else feel free to add it with tests if they have time/interest.
implementation...
def filter_builds(builder, build_filter_lambda):
filtered_builds = []
for build in builder.items:
if build_filter_lambda(build):
filtered_builds.append(build)
builder.builds = filtered_builds
usage:
helper.filter_builds(builder, lambda build: build.settings["build_type"] == "Release")
Also, another helper function that i am working with locally that others might use. Again, don't have time to make a nice PR with tests yet. Will make PR when i do.
implementation
def update_builds(builder, new_settings=None, new_options=None, new_env_vars=None, new_build_requires=None):
updated_builds = []
for settings, options, env_vars, build_requires, reference in builder.items:
if new_settings:
settings.update(new_settings)
if new_options:
options.update(new_options)
if new_env_vars:
env_vars.update(new_env_vars)
if new_build_requires:
build_requires.update(new_build_requires)
updated_builds.append([settings, options, env_vars, build_requires])
builder.builds = updated_builds
usage:
helper.update_builds(builder, options={"package_name:shared" : True})