stephaneey / azure-apim-extension

Full Azure API Management suite and more VSTS extension
MIT License
66 stars 48 forks source link

Redeploying an existing versioned api imports swagger to the current version instead of the given version #51

Closed wouterdeman closed 5 years ago

wouterdeman commented 5 years ago

We are using the create/update versioned api task and could successfully created a second version using the task but when redeploying the new version the swagger definition gets imported on the current version instead of the new version.

I reviewed the powershell code and I think it goes wrong at line 265 in https://github.com/stephaneey/azure-apim-extension/blob/master/apimversioned/v3/apimversioned.ps1#L265 where the importurl gets set and the logic does not take into account the current version is different from the version we are deploying. The authurl gets set accordingly but we think the importurl also needs to take into account the current version could be 2019 and the version we are deploying is 2020 and was previously deployed. New deploys of versions run fine but redeploying new versions get deployed to the current version.

Thanks in advance for looking into this.

stephaneey commented 5 years ago

Hello,

I can't reproduce your issue. Could you provide me with more details on the exact configuration you're defining?

Thanks Best Regards

wouterdeman commented 5 years ago

Run 1 - Creates api and one api version (swagger file deploy) Task: API Management - Create or Update Versioned API (V3) OpenApi Version: V2 ProductName: MyProduct Api Name: Engine API Version: 2019 Microsoft API Version: 2018-01-01

Run 2 - Adds a new version 2020 to the Engine API (swagger file deploy) Task: API Management - Create or Update Versioned API (V3) OpenApi Version: V2 ProductName: MyProduct Api Name: Engine API Version: 2020 Microsoft API Version: 2018-01-01

Run 3 - Updates swagger of default/2019 version instead of the expected 2020 engines APi Task: API Management - Create or Update Versioned API (V3) OpenApi Version: V2 ProductName: MyProduct Api Name: Engine API Version: 2020 Microsoft API Version: 2018-01-01

So the first deploy of a new version runs fine but if you try to redeploy that same new version again it imports the swagger definition to the wrong API version. We can also see it in the logs of the task but they contain too much information to just share in a github comment. It notifies "current version 2019, version is 2020, version exists True" but then the "Importing swagger ..." goes to the wrong version.

stephaneey commented 5 years ago

Hello,

I'm able to reproduce it now..it's an awful bug. I'll try to fix it ASAP.

Thanks Best Regards

stephaneey commented 5 years ago

Hello,

I fixed the issue and republished the extension today. It should be rolled out to your tenant in the coming hours.

Thanks Best Regards