2

We are trying to setup CICD pipeline with Jenkins. Currently it's in Azure DevOps. Our code is in an Azure repo (GIT). We have Jenkins installed onto an on-prem windows server.

Via a dummy job we are trying to checkout the code from Azure repo. Our ID has access to view and clone the repo. When I run git clone <azure repo url http(not https)> locally I am able to download the package. But when I configure in job in SCM with GIT as an option along with our credential it's throwing an authentication error.

I even tried creating a personal access token and configured it to see if it is working.

Via http repo url.

Failed to connect to repository : Command "git.exe ls-remote -h -- http://**************************** HEAD" returned status code 128:
stdout:
stderr: fatal: Authentication failed for '***************************'

I tried generating ssh keys and pushed public key to azure repo under security tab "SSH Public Keys". Still same.

Via ssh repo url:

Failed to connect to repository : Command "git.exe ls-remote -h -- ssh://**********:22/******************* HEAD" returned status code 128:
stdout:
stderr: Unable to negotiate with *********** port 22: no matching key exchange method found. Their offer: diffie-hellman-group1-sha1,diffie-hellman-group14-sha1
fatal: Could not read from remote repository.

I am able to ping the repo url from jenkins box.

If the repo is TFS I would have tried TFS plugin to authenticate the repo. But it's in a GIT Azure repo.

Let us know if any specific settings needs to be enabled on the Azure DevOps side to make this work.

Does an Azure service hook have any effects? It's like normal webhook right? Just in case any action happened on repo we need to perform actions based on that. Do we need to configure the hook to have read access to repo too?

Kindly help me with solution or workaround.

benhorgen
  • 1,928
  • 1
  • 33
  • 38
Muralidharan
  • 41
  • 1
  • 3
  • What is the exact structure URL that you are using? Please provide an anonymised version like `https://user@dev.azure.com/user/project/_git/repo`... By experience, Azure DevOps uses kind of a special format. Try again with the clone URL taken from the UI. – Matt Jun 03 '21 at 18:40

1 Answers1

1

Following Azure DevOps Authentication overview, I would:

  • generate a PAT (Personal Access Token, although they do have an expiration date)

  • check the repository is accessible (using https, not http):

       git ls-remote https://<me>:<myPAT>@dev.azure.com/<me>/<myProject>/_git/<myrepo>
    
  • register the token in my Jenkins credentials

  • use the https URL: https://dev.azure.com///_git/, with the registered credential.

VonC
  • 1,262,500
  • 529
  • 4,410
  • 5,250