Does anyone here run CI testing for multiple pants...
# plugins
g
Does anyone here run CI testing for multiple pants versions? I've had a bunch of breaks in my plugins from 2.13 to 2.14 and 2.15 so would be nice to run CI test on all versions together to validate they work. But the only way I can think of is
sed
to modify my config, which seems a bit brutish. Or maintaining X number of pants.toml...
h
cc @polite-garden-50641. At Toolchain, we usually have
main
branch using the latest stable release, and then also have a branch for each newer release series
g
Hmm! Yeah I was considering something like that, and doing +2.{14,15} local version releases. However, with 4 repositories x 3 versions it sounds awful to manage. 😞
c
I think it could make sense to have the
pants
setup script to respect any
PANTS_VERSION
env var, as an override to parsing it from
pants.toml
that would at least be less brutish than
sed
’ding the config..
g
Definitely! And would be OK to define as a matrix in GHA, with separate caches as well.
👍 1
Actually there is a PANTS_SHA config var already, maybe that would work already. Let me try...
c
I think it might, but hardly user friendly to put sha values into your env matrix 😛
@gorgeous-winter-99296 if you’d like to contribute this change https://github.com/pantsbuild/setup 🙂
1
I mean, the PANTS_VERSION is already recognized by pants itself, so just makes sense that the setup script does too:
Copy code
╰─❯ PANTS_VERSION=2.14.0 ./pants global --help-advanced | grep -A 5 PANTS_VERSION
  PANTS_VERSION
  pants_version
      default: <pants_version>
      current value: 2.14.0 (from command-line flag)
          overrode: 2.14.0 (from env var PANTS_VERSION)
          overrode: 2.14.0 (from pants.toml)
      Use this Pants version. Note that Pants only uses this to verify that you are using the
hopefully, the value from
pants.toml
doesn’t have to match the other sources value… 🤔
g
I'll have a check! I think the SHA is almost 95% of what is needed already... it can already resolve to the release tags etc.
👍 1
c
let me know if you opt not to, and I’ll pick this up as I think it’s a broken window to not respect this env var.
g
I've got a PR inc 😛 Just need some docs. Maybe needs a PR for the docs in the main repo too.
🙌 1
p
keep in mind that this won't solve all of your issues.... based on my experience (in the past ~2 years) running CI on multiple pants versions (to make sure the Toolchain pants plugin works properly with multiple pants versions) there are config changes, command changes and plugin api changes that are not compatible between versions. so that is why I maintain each version in its own upstream branch and have that branch have multiple commits to tweak the things I mentioned to accommodate the changes between different pants versions.
further more, since there are plugin API changes, we have code like this to allow the plugin to work with multiple pants versions:
👀 1
and this is an easy change... we had more complexity when we needed to support the changes to the option system (for example)
so unless you absolutely must... I suggest trying to stick to a single pants version at a time (we can't do that, because we have external customers using our plugin and we want to support both the latest stable version and the dev versions...)
g
Yeah; maybe I'll end up needing some more complex later. That's fine. I think this is just a good starting point, and for local validation it's a gods end. While figuring out what broke my plugins from 2.14 to 2.15a1 I ended up bouncing back and forth a lot... and doing that with a CLI arg is much better.
p
also... looked at the repos with your plugin and considering as pants is a monorepo tool. you can have multiple plugins live in the same repo and still publish them to different pypi packages... having a single repo for all of those will likely make your life easier.... just my 2c...
g
Yeah; I was thinking if I want to eventually upstream them it's easier to do it if they're separate. And easier to automate publishing. I'm using it as a monorepo tool for my other projects.