onlyutkarsh / ExportImportBuildDefinition

Export and Import your build definitions. Useful for recreating all the build steps, variables, schedules, etc in a different team project/account.
http://bit.ly/exportimportbuild
Other
17 stars 8 forks source link

401 when trying to import #16

Closed lnu closed 7 years ago

lnu commented 7 years ago

Whenever I try to import a definition it fails: image

image

We're using the latest version of the extension 0.0.8

It fails with a 401 when checking the queues

onlyutkarsh commented 7 years ago

@lnu Hey Laurent, Are you on TFS 2017? If not, you need to use v0.0.2 as the new scopes are not available in versions below TFS 2017. Let me know if it works for you. Thanks!

lnu commented 7 years ago

We're using tfs 2017

thank you

lnu commented 7 years ago

Sorry but in the end, What should I do? I'm using tfs 2017 with the latest version so it should work?

onlyutkarsh commented 7 years ago

Ah okay, yes, in that case, it should work. Can you try using a different browser? If that does not work, can you let me know...

As a workaround, try removing the queue section (like below) from exported JSON and see if you can import successfully.

"queue": {
    "pool": {
    "id": 1,
    "name": "Default"
    },
    "id": 10,
    "name": "MyQueue"
}

Also, Is it possible to share the export json, so that I can try to find the root cause?

lnu commented 7 years ago

I already tried to remove the queue section, but even if there's no queue section a check is done:

    let queues = await taskAgentRestClient.getAgentQueues(webContext.project.id);
    console.log("Got queues...");
    if (definition.queue && definition.queue.id && definition.queue.name) {

I'm also a member of the Build Administrators group. The definition I try to import comes from the same collection. I'm using chrome. I tried with ie11 but it's even worse. I get a Promise is undefined error.

onlyutkarsh commented 7 years ago

Yeah looks like a bug to me. I took a quick look at the code and I think, I need to move that queues assignment in above snippet to the inside of the if block. I am currently traveling so fix might take some time. Can you try 0.0.2 version till that time? You might need to remove queue element from JSON as 0.0.2 did not have the logic to assign the first available queue. Also, can you share the JSON (after removing the sensitive data), so that I can try it on your definition?

onlyutkarsh commented 7 years ago

Did not intend to close :-(

lnu commented 7 years ago

I tried to update the manifest with this:

        "vso.build_execute",
        "vso.build",
        "vso.serviceendpoint",
        "vso.serviceendpoint_manage",
        "vso.agentpools",
        "vso.agentpools_manage"
    ],

But it stills the same. The strange thing is it's giving a 401 but if i take the link in chrome I get the results: image

onlyutkarsh commented 7 years ago

I think it is working in browser URL because the request is using your credentials. It fails in the extension because the defined scopes in the extension are somehow not working for you. I will try to follow this up with the product group and see if I can find the answer. Meanwhile, I would suggest trying 0.0.2 version from releases.

Can you also send me the exact version of your TFS? it should be in about box when you click ellipses (...) from the top navigation bar.

lnu commented 7 years ago

Version 15.105.25910.0

onlyutkarsh commented 7 years ago

@lnu thanks and sorry for responding late. The version tells me that you are on TFS 2017 RTM version and the scope vso.agentpools is available from TFS Update 1 RC2 onwards. However, TFS 2017 Update 1 is now available and applying that to your version should fix the above issue.

lnu commented 7 years ago

@onlyutkarsh Thanks! I did not notice it was available only in update1.