https://pantsbuild.org/ logo
#development
Title
# development
s

sparse-lifeguard-95737

05/19/2022, 4:15 PM
still working on minimizing it to file a bug report, but wanted to flag it early: we just hit a bug / behavior change with tag-based filtering when upgrading to
v2.11.1rc0
. We have a CI step that essentially does
./pants --changed-dependees=transitive --changed-since=$(git rev-parse HEAD~) --tag=push_to_ecr filter --target-type=docker_image
. After upgrading to
v2.11.1rc0
, the filter fails to notice images with the tag - removing the
--tag
arg fixes things. We upgraded from commit
9ac327d46d8ef98a6f635c9795e26433b50e62b8
(on the 2.11.x branch) so one of the commits between it and the RC changed the behavior
h

hundreds-father-404

05/19/2022, 4:16 PM
hmm, thank you for the report - definitely appreciated if you're able to minimize more. 2.11.1rc0 indeed has what is supposed to be several fixes to
--tags
s

sparse-lifeguard-95737

05/19/2022, 4:18 PM
the other probably-relevant thing to note is that the change we expected to be detected was in a transitive dependency without the tag. I could see a change to filter’s order-of-operations breaking that (i.e. filtering out everything w/o the tag up-front, then checking transitive deps that have changed, but now there are no transitive deps left because none of them had the tag)
h

hundreds-father-404

05/19/2022, 4:22 PM
the other probably-relevant thing to note is that the change we expected to be detected was in a transitive dependency without the tag.
Oh, so you're using
--tag=foo
and expecting to get back a target without
tags=["foo"]
specifically because it's a transitive dep of something w/ the tag?
s

sparse-lifeguard-95737

05/19/2022, 4:26 PM
the setup is effectively:
Copy code
app/
  Dockerfile
  entrypoint.sh
  BUILD.pants
and then in `BUILD.pants`:
Copy code
shell_source(name="entrypoint", source="entrypoint.sh")

docker_image(tags=["push_to_ecr"], dependencies=[":entrypoint"])
we made a change to
entrypoint.sh
, then ran an equivalent of:
Copy code
./pants --changed-dependees=transitive --changed-since=$(git rev-parse HEAD~) --tag=push_to_ecr filter --target-type=docker_image
pre-2.11.1rc0 this would print the target for
app/Dockerfile
. on 2.11.1rc0 the target for
app/Dockerfile
is not printed
(also I typed all of that in slack as a guess at a minimization without trying it out - apologies if there are typos / if it works and a more complex setup is needed to repro the behavior)
confirmed that
fcaac9840256ac52b57b3dc2281d07a6b1e02455
(cherry-pick commit of the PR you linked) is where the behavior changes -
88b73ee0712928d1a63796907ab2924fe721bff6
(commit immediately before it) works the way it did in 2.11.0
ok, minimized & repro’d locally. will open an issue
❤️ 1
b

busy-vase-39202

05/19/2022, 5:16 PM
Thanks for reporting, and the work on narrowing it down!
h

hundreds-father-404

05/19/2022, 5:25 PM
Got it. So this was in theory intentional...The idea is when you use
--tag
, you will only get back things w/ the tag. I'm trying to think about what is desirable though.
--changed-dependees
is a wild-card here I didn't consider enough. In the meantime, I think we should revert the changes to 2.11, as it looks like it's breaking and violates the stability we try to offer
Possible workaround (not tested)
Copy code
./pants --tag=push_to_ecr --changed-since=HEAD list :: | xargs ./pants dependees --transitive | xargs ./pants filter --target-type=docker_image
Ah ha, thanks for writing the issue - great minimal case. Bug fix inbound 🙌
❤️ 1
s

sparse-lifeguard-95737

05/19/2022, 6:43 PM
so speedy! thank you 🎉
❤️ 1