isomorphic-git / isomorphic-git

A pure JavaScript implementation of git for node and browsers!
https://isomorphic-git.org
MIT License
7.49k stars 378 forks source link

Disable failing test that require credentials on Azure DevOps #1876

Closed jcubic closed 7 months ago

jcubic commented 8 months ago

There are yet again some issue with CI/CD. The tests are failing, see this useless PR that change whitespace in README https://github.com/isomorphic-git/isomorphic-git/pull/1874

  ● Hosting Providers › Azure DevOps ›
 push

    HttpError: HTTP Erro
r: 401 Unauth
orized

 131 |     if
 (res.statu
sCode !== 20
0) {

132 |      
 const { re
sponse } = 
await string
ifyBody(res)

    > 133 |
       thro
w new HttpEr
ror(res.statu
sCode, res.
statusMessag
e, response
)

|           
  ^
      1
34 |     }

      135 |
     // Git 
"smart" HTTP
 servers sh
ould respond
 with the c
orrect Cont
ent-Type hea
der.

136 |     if
 (

at Function.
discover (s
rc/managers
/GitRemoteHTT
P.js:133:13
)
      at _
push (src/c
ommands/pus
h.js:103:22
)
      at 
push (src/a
pi/push.js:
81:12)

 at Object.<
anonymous> 
(__tests__/
test-hostin
g-prov
i
d
e
r
s
.
j
s
:
8
9
:
1
9
)
seanpoulter commented 8 months ago

Interesting. We're using a hard-coded username and password/PAT trying to force push to ADO which is throwing a HTTP 401. https://github.com/isomorphic-git/isomorphic-git/blob/main/__tests__/test-hosting-providers.js#L85-L103

seanpoulter commented 8 months ago

Did the PAT expire in ADO?

jcubic commented 8 months ago

I have no idea what those are. Where can I check this? Will migration to GitHub action fix this?

seanpoulter commented 8 months ago

It looks like we are using a username and password to authenticate to Azure DevOps in the test: https://github.com/isomorphic-git/isomorphic-git/blob/79a38e017653a4dfe3b93e390bf3ffa73db42e82/__tests__/test-hosting-providers.js#L66-L67


The authentication method was deprecated in 2020. https://learn.microsoft.com/en-us/azure/devops/repos/git/auth-overview?view=azure-devops#alternate-credentials

Azure DevOps no longer supports Alternate Credentials authentication since the beginning of March 2, 2020.


The authentication method was removed in January 2024: https://devblogs.microsoft.com/devops/azure-devops-will-no-longer-support-alternate-credentials-authentication/

This feature will be fully deprecated in January 2024.


The test analytics don't go back that far but it has been failing for the last 14 days. https://dev.azure.com/isomorphic-git/isomorphic-git/_test/analytics?definitionId=1&contextType=build


The solution is to change the authentication method for the test case.

--

Next steps:

--

To answer your two questions:

Where can I check this?

If we had a PAT set up, you could follow these docs: https://learn.microsoft.com/en-us/azure/devops/organizations/accounts/use-personal-access-tokens-to-authenticate?toc=%2Fazure%2Fdevops%2Forganizations%2Ftoc.json&view=azure-devops&tabs=Windows

Will migration to GitHub action fix this?

No.

jcubic commented 8 months ago

If this to test the git server, then maybe we can use Docker for this.

seanpoulter commented 8 months ago

They look like integration tests that check we can fetch and push to real servers. I'd suggest we split them out as a separate npm test script, keep them in a separate folder, and only run them in CI between the unit tests and Sauce Labs.

jcubic commented 7 months ago

I think that for now we need to disable those tests so we can merge open PR. We will think what to do with them when we migrate to GitHub actions.

seanpoulter commented 7 months ago

I've disabled the test in #1879. If/when we get the GitHub Actions set up we get use this issue and get those tests back in.

ipeychev commented 7 months ago

We need to get out of this deadlock. @jcubic, if there is no way to fix this issue, can't we disable it for now in the whole repo? All other PR are blocked.

jcubic commented 7 months ago

@seanpoulter can you maybe add a PR with those tests disabled on separated PR/branch. So we can merge right away? Just use cherry-pick on different branch.

seanpoulter commented 7 months ago

PR is up

jcubic commented 7 months ago

I think we can close this one.

seanpoulter commented 7 months ago

Do you want to keep it open to fix it and update the authentication to use a PAT in CI?

jcubic commented 7 months ago

Can you remind me what is PAT?