https://pantsbuild.org/ logo
#general
Title
# general
g

glamorous-nail-59544

01/12/2023, 2:52 PM
Hey, Why does the
run
goal fail when the applied filters return nothing? I am trying to run DB migrations if there is any change detected in my microservice migrations, but if I use the
--changed-since
flag and nothing is detected, it fails my ci. I also tried the
list
goal and piped the result into a run, same thing. Any ideas?
Had to do it the hard way
Copy code
for line in $(./pants --tag=migration --changed-since=tags/${{steps.get-latest-tag.outputs.tag}} --changed-dependees=transitive list); do
            echo "Running migration for $line"
            ./pants run $line -- migrate app
          done
e

enough-analyst-54434

01/12/2023, 4:06 PM
It comes down to expecatations, Pants has behaved different ways in its past: Do you silently do nothing for
./pants <verb>
when no targets / changes apply to that verb? Or do you error. We are currently erroring, assuming
./pants run
is a signal you want something to run; so the absence of a run must be an error. This choice is highly debatable of course.
Basically, our current choice is maybe good for interactive use / newer users and its hostile to automation. Your case is automation.
g

glamorous-nail-59544

01/12/2023, 4:11 PM
In either case, having an option to override the default is very useful and would please everyone. I also agree that failing is safer as a default.
e

enough-analyst-54434

01/12/2023, 4:22 PM
I actually am not a fan of failing as the default, but my opinion is in the minority on that one!
g

glamorous-nail-59544

01/12/2023, 5:26 PM
it is newbie proof. But as you get more comfortable with a tool, yes it becomes annoying