Skip to content

[Issue] azd pipeline config panics with ssh origin configuration #870

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
1 task done
weikanglim opened this issue Oct 11, 2022 · 3 comments
Closed
1 task done

[Issue] azd pipeline config panics with ssh origin configuration #870

weikanglim opened this issue Oct 11, 2022 · 3 comments
Labels
azdo Azure DevOps pipelines
Milestone

Comments

@weikanglim
Copy link
Contributor

Output from azd version
Run azd version and copy and paste the output here:
azd version 0.3.0-beta.2 (commit 91a2c01)

Output from az version
Run az version and copy and paste the output here (minimum required version is 2.38.0):

{
  "azure-cli": "2.38.0",
  "azure-cli-core": "2.38.0",
  "azure-cli-telemetry": "1.0.6",
  "extensions": {
    "azure-devops": "0.25.0"
  }
}

Describe the bug
If git origin is configured to a SSH URL, azd panics on azd pipeline config

To Reproduce

  1. In a git repository, configure origin to use Azure DevOps via SSH, i.e., git remote set-url origin git@ssh.dev.azure.com:v3/<project>/<organization>/<repo>. This can be obtained by using the SSH connection when viewing an Azure DevOps repository.
  2. Run azd pipeline config --provider azdo
  3. Provide a PAT when prompted
  4. azd errors out. See below:
root@weilim-z4:~/todo-java-mongo# azd pipeline config --provider azdo
Using pipeline provider: Azure DevOps
You need an Azure DevOps Personal Access Token (PAT). Please create a PAT by following the instructions here
 https://aka.ms/azure-dev/azdo-pat
(skip this prompt by setting the PAT to env var: AZURE_DEVOPS_EXT_PAT)
? Personal Access Token (PAT): ******
Creating or updating service principal az-dev-10-11-2022-18-18-02.
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(0xc00041c200, {0xc43a78, 0xc000412360}, {0xc000126500, 0x3b})
        /mnt/vss/_work/1/s/cli/azd/pkg/commands/pipeline/azdo_provider.go:459 +0xb5e
github.com/azure/azure-dev/cli/azd/pkg/commands/pipeline.(*PipelineManager).ensureRemote(0xc0001a1580, {0xc43a78, 0xc000412360}, {0xc000028024, 0x15}, {0xb3026f, 0x6})
        /mnt/vss/_work/1/s/cli/azd/pkg/commands/pipeline/pipeline_manager.go:67 +0x107
github.com/azure/azure-dev/cli/azd/pkg/commands/pipeline.(*PipelineManager).getGitRepoDetails(0xc0001a1580, {0xc43a78, 0xc000412360})
        /mnt/vss/_work/1/s/cli/azd/pkg/commands/pipeline/pipeline_manager.go:81 +0xfc
github.com/azure/azure-dev/cli/azd/pkg/commands/pipeline.(*PipelineManager).Configure(0xc0001a1580, {0xc43a78, 0xc000412360})
        /mnt/vss/_work/1/s/cli/azd/pkg/commands/pipeline/pipeline_manager.go:223 +0x478
github.com/azure/azure-dev/cli/azd/cmd.(*pipelineConfigAction).Run(0xc000014310, {0xc43a78, 0xc0003e7b90}, 0x0?, {0x0?, 0x0?, 0x0?}, 0xc00038cb30)
        /mnt/vss/_work/1/s/cli/azd/cmd/pipeline.go:110 +0x2f0
github.com/azure/azure-dev/cli/azd/pkg/commands.Build.func1.1({0xc43a78?, 0xc0003e7b90?})
        /mnt/vss/_work/1/s/cli/azd/pkg/commands/builder.go:64 +0x49
github.com/azure/azure-dev/cli/azd/pkg/commands.runCmdWithTelemetry({0xc43a78, 0xc0003e7b60}, 0x8?, 0xc0002dfa40)
        /mnt/vss/_work/1/s/cli/azd/pkg/commands/builder.go:88 +0x148
github.com/azure/azure-dev/cli/azd/pkg/commands.Build.func1(0xc0003ebb80, {0xc0000add40, 0x0, 0x2})
        /mnt/vss/_work/1/s/cli/azd/pkg/commands/builder.go:70 +0x147
github.com/spf13/cobra.(*Command).execute(0xc0003ebb80, {0xc0000add20, 0x2, 0x2})
        /home/cloudtest/go/pkg/mod/github.com/spf13/cobra@v1.3.0/command.go:856 +0x67c
github.com/spf13/cobra.(*Command).ExecuteC(0xc0003a8f00)
        /home/cloudtest/go/pkg/mod/github.com/spf13/cobra@v1.3.0/command.go:974 +0x3bd
github.com/spf13/cobra.(*Command).Execute(...)
        /home/cloudtest/go/pkg/mod/github.com/spf13/cobra@v1.3.0/command.go:902
github.com/azure/azure-dev/cli/azd/cmd.Execute({0xc0000240b0, 0x4, 0x4})
        /mnt/vss/_work/1/s/cli/azd/cmd/root.go:106 +0x6e
main.main()
        /mnt/vss/_work/1/s/cli/azd/main.go:51 +0x1d2

Expected behavior
azd pipeline config should ideally support git configured via ssh. Otherwise, it should handle it more gracefully.

Environment

Additional context

@rajeshkamal5050 rajeshkamal5050 added this to the On Deck milestone Oct 18, 2022
@rajeshkamal5050 rajeshkamal5050 modified the milestones: On Deck, Backlog Oct 26, 2022
@ghost ghost added the needs-triage For new issues label Oct 31, 2022
@rajeshkamal5050 rajeshkamal5050 added pipelines and removed needs-triage For new issues labels Dec 14, 2022
@rmeshksar
Copy link

Hi, I am having the same problem. Is there any workaround?

@vhvb1989
Copy link
Member

This is for non-github repositories, IIRC.

We don't support Azdo with ssh. azd uses PAT and HTTPS

@weikanglim
Copy link
Contributor Author

Fixed with #4104

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

No branches or pull requests

4 participants