Anyone have experience running Pants using Jenkins...
# general
b
Anyone have experience running Pants using Jenkins. I am running into an issue where some revisions are not being found when using
--changed
flag. In this case Jenkins is running from a different branch and
master
is the main branch, my suspicision is that master is that master is not existing in the clone, but wanted to check if anyone has running into this issue
Copy code
+ pants --filter-target-type=run_shell_command '--filter-tag-regex=^cdk_ecr$' --changed-since=origin/master --changed-dependents=transitive list

Bootstrapping Pants 2.17.0
Installing pantsbuild.pants==2.17.0 into a virtual environment at /home/ec2-user/.cache/nce/68f5608a60df9b97aab453d453817a4ded400d1d8ec7ede7ec14bcac83421a7b/bindings/venvs/2.17.0

11:53:28.82 [INFO] waiting for pantsd to start...
11:53:31.23 [INFO] pantsd started
11:53:31.45 [INFO] Initializing scheduler...
11:53:31.75 [INFO] Scheduler initialized.
11:53:31.92 [ERROR] fatal: bad revision 'origin/master...HEAD'
e
This question should have nothing to do with Pants, IIUC you can answer it purely using git. Can you change your Jenkins script to 1st run
git branch --list
and
git rev-list origin/master...HEAD
? For example, in a repo with a master branch but no main branch (a pyenv clone), I find - no Pants in sight:
Copy code
jsirois@Gill-Windows:~/.pyenv (master) $ git rev-list origin/master...HEAD
jsirois@Gill-Windows:~/.pyenv (master) $ git rev-list origin/main...HEAD
fatal: ambiguous argument 'origin/main...HEAD': unknown revision or path not in the working tree.
Use '--' to separate paths from revisions, like this:
'git <command> [<revision>...] -- [<file>...]'
The most likely thing is the bit of your Jenkins config that clones the repo is doing a shallow clone. People run into this sort of thing all the time in GitHub actions too because they are using a shallow clone and don't realize it.
b
Ok. thx
c
Yea, what John says is likely spot on. Jenkins does not include remote git refs by default, iirc.