Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

v2.11.1rc0 changed behavior of filter when filtering on transitive changed-since AND tags #15544

Closed
danxmoran opened this issue May 19, 2022 · 0 comments · Fixed by #15546
Closed
Assignees
Labels

Comments

@danxmoran
Copy link
Contributor

Describe the bug

Setup

app/
    pants
    pants.toml
    BUILD.pants
    Dockerfile
    entrypoint.sh

pants generated with:

curl -L -O https://static.pantsbuild.org/setup/pants && chmod +x ./pants

In pants.toml:

[GLOBAL]
pants_version = "2.11.0"
backend_packages = [
    "pants.backend.shell",
    "pants.backend.docker",
]

In BUILD.pants:

shell_source(name="entrypoint", source="entrypoint.sh")
docker_image(name="docker", dependencies=[":entrypoint"], tags=["buildme"])

In Dockerfile:

FROM ubuntu:20.04

COPY ./entrypoint.sh .

ENTRYPOINT ["/entrypoint.sh"]

In entrypoint.sh:

#!/usr/bin/env bash

echo "${@}"

Commit these contents as an initial commit:

git init .
git add .
git commit -m "Initial commit"

The Bug

Update entrypoint.sh:

echo 'exec "${@}"' >> entrypoint.sh

In Pants v2.11.0, running:

./pants --changed-dependees=transitive --changed-since=$(git rev-parse HEAD) --tag=buildme \
    filter --target-type=docker_image

Outputs //:docker.

If you upgrade to Pants v2.11.1rc0, the command no longer outputs //:docker:

# (Using the SHA of v2.11.1rc0 for an easier demo)
PANTS_SHA=9f9dfa58e8744d51c49316dccc14d3667c07ed04 ./pants \
    --changed-dependees=transitive --changed-since=$(git rev-parse HEAD) --tag=buildme \
    filter --target-type=docker_image

Bisecting the commits between v2.11.0 and v2.11.1rc0 shows that fcaac98 is where the behavior changed:

# Commit before the change, prints '//:docker'
PANTS_SHA=88b73ee0712928d1a63796907ab2924fe721bff6 ./pants \
    --changed-dependees=transitive --changed-since=$(git rev-parse HEAD) --tag=buildme \
    filter --target-type=docker_image

# Behavior change, doesn't print '//:docker'
PANTS_SHA=fcaac9840256ac52b57b3dc2281d07a6b1e02455 ./pants \
    --changed-dependees=transitive --changed-since=$(git rev-parse HEAD) --tag=buildme \
    filter --target-type=docker_image

Pants version
2.11.x

OS
Observed in both MacOS and Linux

@danxmoran danxmoran added the bug label May 19, 2022
@danxmoran danxmoran changed the title v2.11.1rc0 changed behavior of filter when filtering on transitive dependencies AND tags v2.11.1rc0 changed behavior of filter when filtering on transitive changed-since AND tags May 19, 2022
@Eric-Arellano Eric-Arellano self-assigned this May 19, 2022
Eric-Arellano added a commit that referenced this issue May 20, 2022
Closes #15544.

[ci skip-rust]
[ci skip-build-wheels]
Eric-Arellano added a commit that referenced this issue May 20, 2022
Revert #15413. It did fix two bugs, but was too risky.

In particular, it resulted in #15544. I wasn't able to cherry-pick the fix #15546 because the tests have diverged too much. So instead, we should revert.

However, we keep the fix for `python_tests`, which was a 2.11-specific regression.

[ci skip-rust]
Eric-Arellano added a commit to Eric-Arellano/pants that referenced this issue May 20, 2022
Closes pantsbuild#15544.

[ci skip-rust]
[ci skip-build-wheels]
Eric-Arellano added a commit that referenced this issue May 20, 2022
#15564)

Fix `tag` filtering with `--changed-dependees` (#15546)

Closes #15544.

[ci skip-rust]
[ci skip-build-wheels]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants