Closed
Bug 1286637
Opened 10 years ago
Closed 8 years ago
tc-vcs fails to add remote for headUrl to Git repo with error: remote origin already exists
Categories
(Taskcluster :: Services, defect)
Taskcluster
Services
Tracking
(Not tracked)
RESOLVED
INCOMPLETE
People
(Reporter: myk, Unassigned)
Details
When you specify both the baseUrl and headUrl arguments to "tc-vcs checkout", then tc-vcs tries to add an "origin" remote for headUrl. But "origin" already exists, because Git creates it by default when tc-vcs clones baseUrl. So the attempt to add a remote fails with the error "remote origin already exists."
> > tc-vcs checkout repo https://github.com/mozilla/positron.git https://github.com/mozilla/positron.git taskcluster-yml --force-clone
>[taskcluster-vcs] detectHg: start fetching head of https://github.com/mozilla/positron.git
>[taskcluster-vcs] detectHg: end fetching head of https://github.com/mozilla/positron.git
>[taskcluster-vcs:warning] No task indexed for namespace "tc-vcs.v1.clones.4790575b44a637c23ae2e352794b22fd"
>[taskcluster-vcs] detectHg: start fetching head of https://github.com/mozilla/positron.git
>[taskcluster-vcs] detectHg: end fetching head of https://github.com/mozilla/positron.git
>[taskcluster-vcs] 0 run start : (cwd: /Users/myk) git clone https://github.com/mozilla/positron.git /Users/myk/repo
>Cloning into '/Users/myk/repo'...
>Checking out files: 100% (142342/142342), done.
>[taskcluster-vcs] run end : git clone https://github.com/mozilla/positron.git /Users/myk/repo (0) in 413923 ms
>[taskcluster-vcs] 0 run start : (cwd: /Users/myk/repo) git remote add origin https://github.com/mozilla/positron.git
>fatal: remote origin already exists.
>[taskcluster-vcs:warning] run end (with error) NOT RETRYING!: git remote add origin https://github.com/mozilla/positron.git
Presumably this also means that when tc-vcs then attempts to check out headRev, it'll do so from baseUrl rather than headUrl, which could either fail or return unexpected results.
In the example above, baseUrl and headUrl are identical, so the checkout happens to work. But if I was to make baseUrl be headUrl's upstream repo <https://github.com/mozilla/gecko-dev.git>, then it would fail.
| Reporter | ||
Comment 1•10 years ago
|
||
(In reply to Myk Melez [:myk] [@mykmelez] from comment #0)
> Presumably this also means that when tc-vcs then attempts to check out
> headRev, it'll do so from baseUrl rather than headUrl, which could either
> fail or return unexpected results.
>
> In the example above, baseUrl and headUrl are identical, so the checkout
> happens to work. But if I was to make baseUrl be headUrl's upstream repo
> <https://github.com/mozilla/gecko-dev.git>, then it would fail.
Actually, after testing this, it turns out that tc-vcs changes the name of the remote it adds in the event that baseUrl and headUrl are different. Instead of calling it "origin", it calls it "tc-vcs-remote" and the remote is successfully added (after which headRev is successfully fetched):
>[taskcluster-vcs] 0 run start : (cwd: /Users/myk/repo) git remote add tc-vcs-remote https://github.com/mozilla/positron.git
>[taskcluster-vcs] run end : git remote add tc-vcs-remote https://github.com/mozilla/positron.git (0) in 7 ms
>[taskcluster-vcs] 0 run start : (cwd: /Users/myk/repo) git fetch -f https://github.com/mozilla/positron.git taskcluster-yml:refs/remotes/tc-vcs-remote/taskcluster-yml
>From https://github.com/mozilla/positron
> * [new branch] taskcluster-yml -> tc-vcs-remote/taskcluster-yml
>[taskcluster-vcs] run end : git fetch -f https://github.com/mozilla/positron.git taskcluster-yml:refs/remotes/tc-vcs-remote/taskcluster-yml (0) in 5377 ms
That makes this bug minor, since the failure doesn't actually prevent tc-vcs from doing what it's supposed to do. It still shouldn't fail (if for no other reason, then to avoid confused people filing bugs like this one). But it isn't a big deal that it does.
Updated•10 years ago
|
Component: Tools → Platform Libraries
| Reporter | ||
Comment 2•9 years ago
|
||
(In reply to Myk Melez [:myk] [@mykmelez] from comment #1)
> Actually, after testing this, it turns out that tc-vcs changes the name of
> the remote it adds in the event that baseUrl and headUrl are different.
> Instead of calling it "origin", it calls it "tc-vcs-remote" and the remote
> is successfully added (after which headRev is successfully fetched):
Actually actually, it doesn't do this, at least not in this task triggered by a merge into the master branch of Positron yesterday:
https://tools.taskcluster.net/task-graph-inspector/#Hyf4_HrnRzC38Rwjuc0OSA/OgmW5k0ASFKQlAPhC17exg/0
There, it tries to add a new "origin" remote, which fails:
> [taskcluster-vcs] 0 run start : (cwd: /repo) git remote add origin https://github.com/mozilla/positron.git
> fatal: remote origin already exists.
> [taskcluster-vcs:warning] run end (with error) NOT RETRYING!: git remote add origin https://github.com/mozilla/positron.git
Perhaps that's because the task no longer does --force-clone, which it used to do. Now it does:
> tc-vcs checkout repo https://github.com/mozilla/gecko-dev $GITHUB_HEAD_REPO_URL $GITHUB_HEAD_BRANCH
And after failing to add the remote, TaskCluster then tries to merge origin/master into master:
> [taskcluster-vcs] 0 run start : (cwd: /repo) git merge origin/master
(Which fails because user.email and user.name are not configured, but that's a separate issue that I'll fix by configuring them in the task.)
So this is actually more than a minor bug, as it will prevent TaskCluster from successfully testing any merge to master in a fork of gecko-dev on GitHub.
Comment 3•8 years ago
|
||
tc-vcs is being retired - https://github.com/taskcluster/taskcluster-rfcs/issues/43
Status: NEW → RESOLVED
Closed: 8 years ago
Resolution: --- → INCOMPLETE
| Assignee | ||
Updated•7 years ago
|
Component: Platform Libraries → Services
You need to log in
before you can comment on or make changes to this bug.
Description
•