Skip to content

Azure Devops Repo Gets Relative/Undefined URL #331

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
mdarrik opened this issue Jun 12, 2019 · 12 comments · Fixed by #352
Closed

Azure Devops Repo Gets Relative/Undefined URL #331

mdarrik opened this issue Jun 12, 2019 · 12 comments · Fixed by #352
Assignees

Comments

@mdarrik
Copy link

mdarrik commented Jun 12, 2019

- Do you want to request a feature or report a bug?
bug

- What is the current behavior?
When using Azure Devops Repos, netlify-cli logs the repository url as "https://undefined.com/Team/Project/_git/repo. This ends up becoming a local URL in Netlify and prevents the site from being deployed.

- If the current behavior is a bug, please provide the steps to reproduce.
Create a repository in azure devops.
Run netlify init --manual
Check repository url

- What is the expected behavior?
Should get the full repository url
- Please mention your node.js, and operating system version.
Node: 10.15.1
OS: Windows 10

@mdarrik mdarrik changed the title Azure Devops Repo Gets Local/Undefined URL Azure Devops Repo Gets Relative/Undefined URL Jun 12, 2019
@DavidWells
Copy link
Contributor

Thanks for the report.

Can you share anything else about your build spec?

What are the CLI commands being run etc

Thanks!

@mdarrik
Copy link
Author

mdarrik commented Jun 13, 2019

So I'm just running netlify init --manual
And followed the steps (added the SSH key, added the webhook, etc).
It was for a standard Vue CLI 3 app with an Azure Devops git repo.
My netlify CLI version:
netlify-cli/2.11.22 win32-x64 node-v10.15.1

The initial build log after init looks like this:

7:47:56 PM: Build ready to start
7:47:57 PM: build-image version: 9e0f207a27642d0115b1ca97cd5e8cebbe492f63
7:47:57 PM: build-image tag: v3.3.2
7:47:57 PM: buildbot version: 75cd99f62ada9e21edea53208e8baf0eab85a045
7:47:58 PM: Fetching cached dependencies
7:47:58 PM: Failed to fetch cache, continuing with build
7:47:58 PM: Starting to prepare the repo for build
7:47:58 PM: git ref refs/heads/master does not exist or you do not have permission
7:47:58 PM: Failing build: Failed to prepare repo
7:47:58 PM: failed during stage 'preparing repo': git ref refs/heads/master does not exist

Here's a screenshot of the repository setting in the netlify dashboard.

Netlify Repository Screenshot

When I ran netlify unlink and ran netlify init --manual , I would get the following options:

? What would you like to do? ⇄  Link this directory to an existing site

netlify link will connect a site in app.netlify.com to this folder

? How do you want to link this folder to a site? (Use arrow keys)
> Use current git remote url https://undefined.com/MOBY235/sharktank-collaboration-presentation
  Site Name
  Site ID

The actual repository url: https://[email protected]/MOBY235/sharktank-collaboration-presentation/_git/sharktank-collaboration-presentation

I thought maybe the @ symbol was causing some problems. URL encoding the "@" symbol broke the repository, but I found I could remove the "MOBY235@" part of the url and still be able to pull/push from the remote repository. However, it still had the same undefined.com url.

@DavidWells
Copy link
Contributor

In the CI process you want to avoid netlify link and netlify init

Instead you can use the site, auth with the netlify deploy command

This is the "whole flow"

npm install
npm install netlify-cli -g
netlify deploy --prod --dir yourbuilddir --message "my deploy message" --auth xyz --site 123

The auth token is a personal access token you can grab from your account settings page and the site ID is inside the site settings

@DavidWells
Copy link
Contributor

It seems like our dep https://github.com/netlify/cli/blob/master/src/utils/get-repo-data.js#L5 isn't picking up the git remote in your setup for whatever reason. Perhaps the git remote isn't listed as origin?

Anywho, If this is for an automated CI build, the netlify deploy with args should work for ya

@mdarrik
Copy link
Author

mdarrik commented Jun 13, 2019

I wonder if this is related to #258 since azure devops repos are private by default.

@DavidWells
Copy link
Contributor

@mdarrik did you try the following commands?

npm install
npm install netlify-cli -g
netlify deploy --prod --dir yourbuilddir --message "my deploy message" --auth xyz --site 123

@mdarrik
Copy link
Author

mdarrik commented Jun 20, 2019

That worked for manual deploys.

@mdarrik
Copy link
Author

mdarrik commented Jun 28, 2019

I want to add that this issue isn't related to CI purposes. I was using Azure Dev Ops as my git repository so I didn't have to link to my personal Github from my work PC.

@DavidWells
Copy link
Contributor

Interesting! TIL

It looks like the issue might be here then https://github.com/netlify/cli/blob/master/src/utils/get-repo-data.js#L40-L49 which means it will show undefined here:

repoUrl = `https://${repoInfo.provider}.com/${repoInfo.remoteData.repo}`

What is the git remote -v origin of your repo? We can add that to the supported list of hosts

@mdarrik
Copy link
Author

mdarrik commented Jul 3, 2019

So it's a little weird with Azure. When you grab it from Azure, it sets it at {username}@dev.azure.com/{username}/{repository}.

It also works with https://dev.azure.com/{username}/{repository} which probably fits your existing schema better.

@RaeesBhatti
Copy link
Contributor

Hey @mdarrik, can you please try out raees/fix-repo-url branch and let me know if it works correctly.

@andwilr
Copy link

andwilr commented Feb 3, 2020

I am having this same issue. Within Netlify the repo is a relative path, which is then not found.

stored as:

USER/PROJECT/_git/REPO

as opposed to the correct repo URL:

https://[email protected]/USER/PROJECT/_git/REPO

What can be done? Is there a manual way to set the repo url?

$ netlify -v
netlify-cli/2.31.0 darwin-x64 node-v13.7.0

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants