Page MenuHomePhabricator

Changing the remote URI of a repository causes existing Drydock resources to break
Closed, DuplicatePublic

Description

When you have Drydock working copies set of a repository, and then you change the remote URI of that repository, the URIs on the local working copy don't get updated, so you get "fatal: reference is not a tree". For example:

Lease activation failed: [CommandException] Command failed with error #128! COMMAND ssh '-o' 'LogLevel=quiet' '-o' 'StrictHostKeyChecking=no' '-o' 'UserKnownHostsFile=/dev/null' '-o' 'BatchMode=yes' -l 'xxxxx' -p '22' -i 'xxxxx' '10.1.1.203' -- '(cd '\''/srv/leases/workingcopy-26934/repo/monogame/'\'' && git clean -x -d --force --force && git fetch && git reset --hard HEAD && git checkout '\''158db51c0240784c2c39cb4d7cac1d32e742e422'\'' --)' STDOUT HEAD is now at a38d7be If we fail to initialize the swap chain with multisampling on, disable multisampling and try again STDERR From https://github.com/hach-que/MonoGame + cbce0ef...8447f5a render-faster -> origin/render-faster (forced update) fatal: reference is not a tree: 158db51c0240784c2c39cb4d7cac1d32e742e422 
STDOUT
HEAD is now at a38d7be If we fail to initialize the swap chain with multisampling on, disable multisampling and try again 
STDERR
From https://github.com/hach-que/MonoGame 
+ cbce0ef...8447f5a render-faster -> origin/render-faster (forced update) 
fatal: reference is not a tree: 158db51c0240784c2c39cb4d7cac1d32e742e422

Reproduction Steps:

  1. Create a GitHub or other external repository where master points to some commit.
  2. Create another GitHub or other external repository where master points to some different commit, with this repository being at a different URI to the first one.
  3. Create a repository in Diffusion that is set up to clone the first repository.
  4. Configure Drydock to have working copies and hosts so that at least "Lease Working Copy" works in Harbormaster.
  5. Run a build in Harbormaster that does "Lease Working Copy" on that drydock resource. You can just run a manual build, it doesn't matter, as long as you get a Drydock resource to exist for that repository.
  6. Change the remote URI of the repository in Diffusion.
  7. Run a new build in Harbormaster on the newly imported commit (i.e. the commit that just got imported from the second repository).

Expected Results:
The Drydock working operation should set the URL of the remote to the new remote URI.

Actual Results:
It doesn't and the operation fails with "fatal: reference is not a tree".