Hey folks, We're planning to use Pants in our repo...
# general
s
Hey folks, We're planning to use Pants in our repo. And during POC, I ran into an issue in CI/CD pipeline. This is my
Gitlab
step I want to run: This is my template where I install stuff, like jq, curl, git and Pants itself.
Copy code
.install-deps:
  stage: install-and-authenticate
  image: python:3.10.14-slim
  before_script:
    - apt-get update && apt-get -y install gettext-base jq default-jdk
    - apt-get -y install curl git
    - export PATH="/root/.local/bin:$PATH"
    - curl --proto '=https' --tlsv1.2 -fsSL <https://static.pantsbuild.org/setup/get-pants.sh> | bash
    - pip install --no-cache-dir -i <https://some_wweb/repository/pypi-group/simple> poetry==1.8.1
I just curled pants here for testing. And this is the stage in my
gitlab-ci.yaml
that I run Pants:
Copy code
run-unit-tests-pants:
  extends: .install-deps
  stage: run_pants_tests
  script:
    - pants --version
    - pants --print-stacktrace -ldebug --changed-since=origin/main tailor --check fmt
    - pants --changed-since=origin/main --changed-dependents=transitive test
  rules:
    - changes:
        - src/**/*
        - pyproject.toml
        - poetry.lock
        - .gitlab-ci.yml
      if: $DEPLOYMENT_ENV != "prod"
  cache:
    key: "$CI_COMMIT_REF_SLUG"
    paths:
      - .pants.d/
  needs: [ ]
Pants works properly, I can see the
version
But somehow git interaction has some problems in my setup. I get this error:
Copy code
16:08:01.34 [DEBUG] Detected git repository at /builds/repo/processing on branch None
16:08:01.34 [DEBUG] computed 1 nodes in 0.019808 seconds. there are 45 total nodes.
16:08:01.34 [DEBUG] Launching 1 roots (poll=false).
16:08:01.34 [DEBUG] Starting: Find all targets in the project
16:08:01.45 [DEBUG] Starting: Generate `python_requirement` targets from Poetry pyproject.toml
16:08:01.47 [DEBUG] Completed: Generate `python_requirement` targets from Poetry pyproject.toml
16:08:01.61 [DEBUG] Completed: Find all targets in the project
16:08:01.61 [DEBUG] computed 1 nodes in 0.272870 seconds. there are 2613 total nodes.
16:08:01.65 [DEBUG] Executing: /usr/bin/git --git-dir=/builds/repo/processing/.git --work-tree=/builds/repo/processing diff --name-only origin/main...HEAD -- /builds/repo/processing
16:08:01.66 [ERROR] fatal: bad revision 'origin/main...HEAD'
And afterwards again:
Copy code
pants.core.util_rules.system_binaries.GitBinaryException: fatal: bad revision 'origin/main...HEAD'
Have you faced this issue, any ideas how to solve?
s
Try running in CI
Copy code
git diff origin/main...HEAD
Does it work?
1
s
Try setting these two variables
Copy code
variables:
    GIT_STRATEGY: clone
    GIT_DEPTH: "0"
1
s
Yes setting
GIT_DEPTH
did the trick. Ty!
Now weirdly tests are running around 30+ minutes unexpectedly. Normally it's 5 mins max. And pants is dying after a while:
Copy code
native_engine.PantsdClientException: The pantsd process was killed during the run.
If this was not intentionally done by you, Pants may have been killed by the operating system due to memory overconsumption (i.e. OOM-killed). If you keep seeing this error message, try the troubleshooting steps below. If none of those help, please consider filing a GitHub issue or reaching out on Slack so that we can investigate the possible memory overconsumption (<https://www.pantsbuild.org/docs/getting-help>).
And during test run, somehow I see
Building pytest_runner.pex
multiple times. Maybe a cache related issue?
s
try to disable pantsd, it doesn't really make sense in ci
1
s
👍 1
s
Hey guys, Thx, yes, disabled the pantsd, didn't work 😕 Will check this concurrency options