Hi all, I have a question, I asked something simi...
# general
a
Hi all, I have a question, I asked something similar in the past, but I still find this a bit strange. Let's say I am running in CI the following command
./pants --changed-diffspec=origin/main --changed-dependees=transitive test
and I have a failing test 1. first time CI runs -> fail 2. I trigger manually another build / push something else unrelated -> pass Is there a way to tell pants to run over "changes + transitive dependees + earlier failures"? Thank you
w
Hey @acceptable-guitar-79854 I’m wondering if you’d want to use
--changed-since
instead of
--changed-diffspec
Seems like when using
--changed-since
you get:
Copy code
Calculate changes since this Git spec (commit range/SHA/ref).
and when using `--changed-diffspec`:
Copy code
Calculate changes contained within a given Git spec (commit range/SHA/ref).
so to your point, you want the “earlier failures” which are included in an earlier commit and from my understanding if you’re using
--changed-diffspec
you’re only comparing your current commit (or repo state) to that specific one…
--changed-since
will get all the differences from all commits since
origin/main
, in your case.
a
I am not sure if that would change it, because i cannot be sure what commit the error is coming from
In the general case
i.e. if a test fails at some point, it would be great if the CI keeps failing until that issue is solved
w
yeah, I only use
--changed-since
here on my CIs and I always point to the branch that I’m trying to merge it to and the behavior that I get is what you’re pursuing.
a
Even if you branch from a failing branch?
w
yup, it just keeps failing haha which is sad but yeah, expected behavior
a
Oh cool, thank you!
w
Well, a disclaimer too - I don’t have any kind of caching here.
a
Oh i see
w
Oh but I’m always comparing it to either “dev” or “master” here.. so let me see if I can “draw this”:
Copy code
---dev----------------
     \___branchA---------
           \___branchB---
so if
branchA
when compared to
dev
fails bc of changes and then you create a
branchB
off of
branchA
and is comparing those directly to
dev
then yeah, you’ll still get those “failing cases” but if you’re only comparing
branchB
with
branchA
then you might not see it unless those same files changes again and the error is persistent.
a
And changed since basically runs on all of your changes since you branched right?
w
yeah, pretty much
a
I see
w
I might be wrong but I think that the
cache
won’t matter bc I just tested here and my tests are still failing even after so many commits (locally) lmao
a
I am coming from bazel which only runs on the diff between the last time it ran plus earlier failures
Failing is good haha
w
haha and I’m also fairly new at
pants
too so take it with a grain of salt, the true knowledgeable folks might not show up bc is a holiday to them today.
a
Your advice is welcome, as long as i get something reasonable going i can wait
w
the “last failure” information would need to be recorded somewhere
Jenkins does actually record that: IIRC, there are environment variables like “last green build”
so if you have the SHA of your last green build, you can use
--changed
against that.
a
i will see if i can get that going, thank you @witty-crayon-22786