NixOS / ofborg

@ofborg tooling automation https://monitoring.ofborg.org/dashboard/db/ofborg
https://ofborg.org
MIT License
246 stars 164 forks source link

Add tags based on files that are touched. #56

Closed FRidh closed 6 years ago

FRidh commented 6 years ago

If certain Python-related files are touched I would like to have a python tag.

I don't think we could use the codeowners file, but we may use a similar file. Basically, a list of regexes and a tag.

grahamc commented 6 years ago

I could probably do this today. Could you put together an initial mapping of paths to tags?

grahamc commented 6 years ago

Currently all the tags I add already, I remove if they're no longer relevant. ie:

  1. a PR is created
  2. it rebuilds 100 packages, I add the rebuild-100 tag.
  3. a commit is pushed
  4. now it builds only 10 packages, I remove the rebuild-100 and add the rebuild-10 tag.

In other words, this behavior would also override a human's judgement. Is this desirable, or would you rather these tags be append-only?

FRidh commented 6 years ago

I think whoever adds paths should be careful not making the scope to wide. Therefore, I think we should do the same as you currently do with the rebuild tags.

FRidh commented 6 years ago

Nix format:

{
  # Python-related code and docs
  "topic: python" = [
      "/pkgs/top-level/python-packages.nix"
      "/pkgs/development/interpreters/python"
      "/pkgs/development/python-modules"
      "/doc/languages-frameworks/python.md"
  ],

  "topic: ruby" = [
    "/pkgs/development/interpreters/ruby"
    "/pkgs/development/ruby-modules"
  ],

}

Should we perhaps use glob patterns?

grahamc commented 6 years ago

What would it look like with a glob pattern?

grahamc commented 6 years ago

If I just match *python*:

./maintainers/scripts/update-python-libraries
./doc/languages-frameworks/python.md
./pkgs/top-level/python-packages.nix
./pkgs/top-level/release-python.nix
./pkgs/development/python-modules
./pkgs/development/libraries/boost/cygwin-1.40.0-python-cygwin.patch
./pkgs/development/libraries/boost/cygwin-fedora-boost-1.54.0-python-unused_typedef.patch
./pkgs/development/libraries/gstreamer/legacy/gst-python
./pkgs/development/libraries/gdal/python.patch
./pkgs/development/interpreters/python
./pkgs/tools/text/unoconv/unoconv-python3.patch
./pkgs/tools/filesystems/ceph/fix-pythonpath.patch
./pkgs/tools/filesystems/glusterfs/glusterfs-python-remove-find_library.patch
./pkgs/tools/package-management/createrepo_c/fix-python-install-path.patch
./pkgs/tools/package-management/python2nix
./pkgs/tools/networking/unbound/python.nix
./pkgs/misc/vscode-extensions/python
./pkgs/misc/frescobaldi/python-path.patch
./pkgs/desktops/gnome-2/bindings/gnome-python
./pkgs/desktops/gnome-2/bindings/gnome-python-desktop
./pkgs/desktops/mate/python-caja
./pkgs/servers/http/apache-modules/mod_python
./pkgs/applications/virtualization/xen/0000-fix-install-python.patch
./pkgs/applications/science/math/sage/spkg-python.patch
./pkgs/applications/networking/instant-messengers/blink/pythonpath.patch
./pkgs/applications/networking/browsers/eolie/0001-Extend-the-python-path-rather-than-replacing-it.patch

The python patches are slightly obnoxious to include, but would be annoying to write code to exclude.

Ruby:

./doc/languages-frameworks/ruby.xml
./pkgs/development/tools/misc/chruby
./pkgs/development/tools/misc/watson-ruby
./pkgs/development/interpreters/jruby
./pkgs/development/interpreters/ruby
./pkgs/development/ruby-modules
./pkgs/tools/text/ruby-zoom
./pkgs/applications/editors/neovim/ruby_provider
./pkgs/applications/audio/rubyripper
FRidh commented 6 years ago

Maybe just checking if a string is contained in the path given by the API? E.g., say that /pkgs/development/python-modules/numpy/default.nix is touched. Then doing

pr_path = '`/pkgs/development/python-modules/numpy/default.nix'
tag_path = '/pkgs/development/python-modules'

if tag_path in pr_path:
    ...
grahamc commented 6 years ago

Ah! Yes, ok, that makes sense. Thanks!