clearml-agent icon indicating copy to clipboard operation
clearml-agent copied to clipboard

Issue of checkout PR commit by sha

Open thaikoh opened this issue 1 year ago • 1 comments

We have company's repo on github, as a developers I have my own fork of that repo and I merge changes to main repo with PRs on github. So I currently have issue with checking out by PRs sha with ClearML agent dockerised task. Task params: as a repo I use company's repo, as a branch I use dev, as a commit I use sha of PR, created on github.

The error is:

fatal: reference is not a tree: f3575326826a912e2ffe55bd13417a18679fd6b4
Repository cloning failed: Command '['git', 'checkout', 'f3575326826a912e2ffe55bd13417a18679fd6b4', '--force']' returned non-zero exit status 128.
clearml_agent: ERROR: Failed cloning repository. 
1) Make sure you pushed the requested commit:
(repository='[email protected]:company/repo.git', branch='dev', commit_id='f3575326826a912e2ffe55bd13417a18679fd6b4', tag='', docker_cmd='...', entry_point='...', working_dir='...')
2) Check if remote-worker has valid credentials [see worker configuration file]

Looks like it is necessary to run git fetch before git checkout f3575326826a912e2ffe55bd13417a18679fd6b4 --force.

How to do that? Or there is other way to go?

thaikoh avatar Dec 13 '23 16:12 thaikoh

Hi @thaikoh,

This seems to be a cache issue. The agent is always running:

git fetch --all --recurse-submodules

before checking out the specific version.

Try disabling the cache and see if it helps 🙂

jkhenning avatar Dec 13 '23 20:12 jkhenning