Skip to content
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

[Feature] Support AzDo using SSH #1896

Closed
1 task
ardeshir opened this issue Apr 6, 2023 · 5 comments · Fixed by #4104
Closed
1 task

[Feature] Support AzDo using SSH #1896

ardeshir opened this issue Apr 6, 2023 · 5 comments · Fixed by #4104
Labels
Milestone

Comments

@ardeshir
Copy link

ardeshir commented Apr 6, 2023

Output from azd version
azd version 0.7.0-beta.1 (commit 9ce7165)

Describe the bug
Command: azd pipeline config --provider azdo

To Reproduce
Command: azd pipeline config --provider azdo

Expected behavior
Expected to have ado pipeline for template

Environment
Information on your environment:
* Language name and version: macOS Monterey 12.6.3, python 3.10
* IDE and version : Visual Studio 1.77.0

Additional context
The repository is a Microsoft Demo [https://github.com/Azure-Samples/azure-search-openai-demo/ ]

panic: runtime error: index out of range [1] with length 1
goroutine 1 [running]:
[github.com/azure/azure-dev/cli/azd/pkg/commands/pipeline.(*AzdoScmProvider).gitRepoDetails(0xc00054a900](http://github.com/azure/azure-dev/cli/azd/pkg/commands/pipeline.(*AzdoScmProvider).gitRepoDetails(0xc00054a900), {0x100b7c0e8, 0xc00056e870}, {0xc0003b8040, 0x3d})
        /Users/runner/work/1/s/cli/azd/pkg/commands/pipeline/azdo_provider.go:480 +0xb85
[github.com/azure/azure-dev/cli/azd/pkg/commands/pipeline.(*PipelineManager).ensureRemote(0xc00013e0c0](http://github.com/azure/azure-dev/cli/azd/pkg/commands/pipeline.(*PipelineManager).ensureRemote(0xc00013e0c0), {0x100b7c0e8, 0xc00056e870}, {0xc000038154?, 0x2d?}, {0x100a32993?, 0xc0006b2280?})
        /Users/runner/work/1/s/cli/azd/pkg/commands/pipeline/pipeline_manager.go:146 +0xd1
[github.com/azure/azure-dev/cli/azd/pkg/commands/pipeline.(*PipelineManager).getGitRepoDetails(0xc00013e0c0](http://github.com/azure/azure-dev/cli/azd/pkg/commands/pipeline.(*PipelineManager).getGitRepoDetails(0xc00013e0c0), {0x100b7c0e8, 0xc00056e870})
        /Users/runner/work/1/s/cli/azd/pkg/commands/pipeline/pipeline_manager.go:171 +0x1c5
[github.com/azure/azure-dev/cli/azd/pkg/commands/pipeline.(*PipelineManager).Configure(0xc00013e0c0](http://github.com/azure/azure-dev/cli/azd/pkg/commands/pipeline.(*PipelineManager).Configure(0xc00013e0c0), {0x100b7c0e8, 0xc00056e870})
        /Users/runner/work/1/s/cli/azd/pkg/commands/pipeline/pipeline_manager.go:306 +0x245
[github.com/azure/azure-dev/cli/azd/cmd.(*pipelineConfigAction).Run(0xc00068e2a0](http://github.com/azure/azure-dev/cli/azd/cmd.(*pipelineConfigAction).Run(0xc00068e2a0), {0x100b7c0e8, 0xc00056e870})
        /Users/runner/work/1/s/cli/azd/cmd/pipeline.go:153 +0x1a5
[github.com/azure/azure-dev/cli/azd/cmd/middleware.(*MiddlewareRunner).RunAction.func1({0x100b7c0e8](http://github.com/azure/azure-dev/cli/azd/cmd/middleware.(*MiddlewareRunner).RunAction.func1(%7B0x100b7c0e8)?, 0xc00056e870?})
        /Users/runner/work/1/s/cli/azd/cmd/middleware/middleware.go:109 +0x23e
[github.com/azure/azure-dev/cli/azd/cmd/middleware.(*TelemetryMiddleware).Run(0xc0006a4350](http://github.com/azure/azure-dev/cli/azd/cmd/middleware.(*TelemetryMiddleware).Run(0xc0006a4350), {0x100b7c0e8, 0xc0004fc570}, 0xc00054a7c0)
        /Users/runner/work/1/s/cli/azd/cmd/middleware/telemetry.go:40 +0x175
[github.com/azure/azure-dev/cli/azd/cmd/middleware.(*MiddlewareRunner).RunAction.func1({0x100b7c0e8](http://github.com/azure/azure-dev/cli/azd/cmd/middleware.(*MiddlewareRunner).RunAction.func1(%7B0x100b7c0e8), 0xc0004fc570})
        /Users/runner/work/1/s/cli/azd/cmd/middleware/middleware.go:107 +0x1f2
[github.com/azure/azure-dev/cli/azd/cmd/middleware.(*DebugMiddleware).Run(0xc000120678](http://github.com/azure/azure-dev/cli/azd/cmd/middleware.(*DebugMiddleware).Run(0xc000120678), {0x100b7c0e8, 0xc0004fc570}, 0xc00054a7c0)
        /Users/runner/work/1/s/cli/azd/cmd/middleware/debug.go:48 +0x2b0
[github.com/azure/azure-dev/cli/azd/cmd/middleware.(*MiddlewareRunner).RunAction.func1({0x100b7c0e8](http://github.com/azure/azure-dev/cli/azd/cmd/middleware.(*MiddlewareRunner).RunAction.func1(%7B0x100b7c0e8), 0xc0004fc570})
        /Users/runner/work/1/s/cli/azd/cmd/middleware/middleware.go:107 +0x1f2
[github.com/azure/azure-dev/cli/azd/cmd/middleware.(*MiddlewareRunner).RunAction(0xc00007ff60](http://github.com/azure/azure-dev/cli/azd/cmd/middleware.(*MiddlewareRunner).RunAction(0xc00007ff60), {0x100b7c0e8, 0xc0004fc570}, 0x1008510e0?, {0x100b72fa0?, 0xc00068e2a0})
        /Users/runner/work/1/s/cli/azd/cmd/middleware/middleware.go:113 +0x23d
[github.com/azure/azure-dev/cli/azd/cmd.(*CobraBuilder).configureActionResolver.func1(0xc000485900](http://github.com/azure/azure-dev/cli/azd/cmd.(*CobraBuilder).configureActionResolver.func1(0xc000485900), {0xc000506260, 0x0, 0x2})
        /Users/runner/work/1/s/cli/azd/cmd/cobra_builder.go:132 +0x426
[github.com/spf13/cobra.(*Command).execute(0xc000485900](http://github.com/spf13/cobra.(*Command).execute(0xc000485900), {0xc000506240, 0x2, 0x2})
        /Users/runner/go/pkg/mod/github.com/spf13/cobra@v1.3.0/command.go:856 +0x67c
[github.com/spf13/cobra.(*Command).ExecuteC(0xc0003d8a00)](http://github.com/spf13/cobra.(*Command).ExecuteC(0xc0003d8a00))
        /Users/runner/go/pkg/mod/github.com/spf13/cobra@v1.3.0/command.go:974 +0x3bd
[github.com/spf13/cobra.(*Command).Execute(...)](http://github.com/spf13/cobra.(*Command).Execute(...))
        /Users/runner/go/pkg/mod/github.com/spf13/cobra@v1.3.0/command.go:902
[github.com/spf13/cobra.(*Command).ExecuteContext(0xc000036000](http://github.com/spf13/cobra.(*Command).ExecuteContext(0xc000036000)?, {0x100b7c078?, 0xc00003c098?})
        /Users/runner/go/pkg/mod/github.com/spf13/cobra@v1.3.0/command.go:895 +0x4a
main.main()
        /Users/runner/work/1/s/cli/azd/main.go:57 +0x159 
        ```
@ghost ghost added needs-triage For new issues customer-reported identify a customer issue question labels Apr 6, 2023
@weikanglim
Copy link
Contributor

Hi @ardeshir, sorry to see that you're having issues.

In your local repository where you're running azd pipeline config --provider azdo, can you also run git remote get-url --all origin and provide the results?

The output should look like:
git@ssh.dev.azure.com:v3/<project collection>/<project>/<repo> for example.

@ardeshir
Copy link
Author

ardeshir commented Apr 7, 2023

$ git remote get-url --all origin
git@ssh.dev.azure.com:v3/fsdi/TechOps/CDS-Azure-Search-OpenAi

@weikanglim
Copy link
Contributor

weikanglim commented Apr 7, 2023

@ardeshir Thanks for that. I had looked at the code briefly, but couldn't find the immediate coding error when I confused myself. I can now confirm that it is indeed a bug that affects SSH URIs.

I hope you're not blocked by this. If you are, the quickest workaround is probably to switch to HTTPS when cloning the repository.

@vhvb1989 I was able to get a minimal repro for the panic by commenting out lines 195 and 197 below (to trigger the parsing of project name and repository name into IDs), then rerunning the tests in azdo_provider_test.go.

azdo.AzDoEnvironmentProjectName: "project1",
azdo.AzDoEnvironmentProjectIdName: "12345",
azdo.AzDoEnvironmentRepoName: "repo1",
azdo.AzDoEnvironmentRepoIdName: "9876",

I think we need to adjust the parsing logic for handling SSH URIs.

@vhvb1989
Copy link
Member

vhvb1989 commented Apr 8, 2023

ssh doesn't work on azd for azdo.
All the connection is done with a PAT.

You can remove your local origin remote (git remote remove origin) and then run azd pipeline config to set the origin again. azd will ask you if you want to create a new repo or use existing. But azd will use a PAT and not ssh.

Another option is you run azd pipeline config --provider azdo --remote-name foo . This will ignore your origin remote and will set up a new foo remote for you

@ardeshir
Copy link
Author

ardeshir commented Apr 8, 2023 via email

@ghost ghost removed the needs-triage For new issues label Apr 13, 2023
@rajeshkamal5050 rajeshkamal5050 changed the title [Issue] Golang panic: runtime error: index out of range [1] with length 1 [Feature] Support AzDo using SSH Apr 13, 2023
@rajeshkamal5050 rajeshkamal5050 added this to the Backlog milestone Apr 13, 2023
@rajeshkamal5050 rajeshkamal5050 modified the milestones: Backlog, On Deck Mar 13, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants