Azure / apiops

APIOps applies the concepts of GitOps and DevOps to API deployment. By using practices from these two methodologies, APIOps can enable everyone involved in the lifecycle of API design, development, and deployment with self-service and automated tools to ensure the quality of the specifications and APIs that they’re building.
https://azure.github.io/apiops
MIT License
321 stars 187 forks source link

[BUG] Extractor pipeline is failing with wrong API version #508

Closed nepsmaddy closed 5 months ago

nepsmaddy commented 7 months ago

Release version

v5.1.3

Describe the bug

While running extractor pipeline it is failing for the wrong api version used in management call.

' System.Net.Http.HttpRequestException: HTTP request to URI https://management.azure.com/subscriptions/***/resourceGroups/providers/Microsoft.ApiManagement/service/***/namedValues?api-version=2022-04-01-preview failed with status code 400. Content is '{"error":{"code":"InvalidApiVersionParameter","message":"The api-version '2022-04-01-preview' is invalid. The supported versions are '2024-03-01,2023-07-01,2023-07-01-preview,2023-03-01-preview,2022-12-01,2022-11-01-preview,2022-09-01,2022-06-01,2022-05-01,2022-03-01-preview,2022-01-01,2021-04-01,2021-01-01,2020-10-01,2020-09-01,2020-08-01,2020-07-01,2020-06-01,2020-05-01,2020-01-01,2019-11-01,2019-10-01,2019-09-01,2019-08-01,2019-07-01,2019-06-01,2019-05-10,2019-05-01,2019-03-01,2018-11-01,2018-09-01,2018-08-01,2018-07-01,2018-06-01,2018-05-01,2018-02-01,2018-01-01,2017-12-01,2017-08-01,2017-06-01,2017-05-10,2017-05-01,2017-03-01,2016-09-01,2016-07-01,2016-06-01,2016-02-01,2015-11-01,2015-01-01,2014-04-01-preview,2014-04-01,2014-01-01,2013-03-01,2014-02-26,2014-04'."}}'. at common.HttpPipelineExtensions.Validate(Response response, Uri requestUri) at common.HttpPipelineExtensions.GetContent(HttpPipeline pipeline, Uri uri, CancellationToken cancellationToken) at common.HttpPipelineExtensions.GetJsonObject(HttpPipeline pipeline, Uri uri, CancellationToken cancellationToken) at common.HttpPipelineExtensions.ListJsonObjects(HttpPipeline pipeline, Uri uri, CancellationToken cancellationToken)+MoveNext() at common.HttpPipelineExtensions.ListJsonObjects(HttpPipeline pipeline, Uri uri, CancellationToken cancellationToken)+System.Threading.Tasks.Sources.IValueTaskSource.GetResult() at System.Linq.AsyncEnumerable.SelectEnumerableAsyncIterator2.MoveNextCore() in /_/Ix.NET/Source/System.Linq.Async/System/Linq/Operators/Select.cs:line 221 at System.Linq.AsyncIteratorBase1.MoveNextAsync() in //Ix.NET/Source/System.Linq.Async/System/Linq/AsyncIterator.cs:line 70 at System.Linq.AsyncIteratorBase`1.MoveNextAsync() in //Ix.NET/Source/System.Linq.Async/System/Linq/AsyncIterator.cs:line 75 at System.Linq.AsyncEnumerable.WhereEnumerableAsyncIterator1.MoveNextCore() in /_/Ix.NET/Source/System.Linq.Async/System/Linq/Operators/Where.cs:line 233 at System.Linq.AsyncIteratorBase1.MoveNextAsync() in //Ix.NET/Source/System.Linq.Async/System/Linq/AsyncIterator.cs:line 70 at System.Linq.AsyncIteratorBase`1.MoveNextAsync() in //Ix.NET/Source/System.Linq.Async/System/Linq/AsyncIterator.cs:line 75 at System.Threading.Tasks.Parallel.<>c54`1.<b54_0>d.MoveNext() --- End of stack trace from previous location ---'

Expected behavior

it should work without any api version issue.

Actual behavior

it is failing for the api version mismatch from the allowed list.

Reproduction Steps

Set APIOps version to 5.1.3 and run extractor.

github-actions[bot] commented 7 months ago
  Thank you for opening this issue! Please be patient while we will look into it and get back to you as this is an open source project. In the meantime make sure you take a look at the [closed issues](https://github.com/Azure/apiops/issues?q=is%3Aissue+is%3Aclosed) in case your question has already been answered. Don't forget to provide any additional information if needed (e.g. scrubbed logs, detailed feature requests,etc.).
  Whenever it's feasible, please don't hesitate to send a Pull Request (PR) our way. We'd greatly appreciate it, and we'll gladly assess and incorporate your changes.
guythetechie commented 6 months ago

@nepsmaddy - you're missing a resource group name in your URL. Should have the format management.azure.com/subscriptions/***/resourceGroups/{MISSING_RESOURCE_GROUP_NAME} /providers/Microsoft.ApiManagement/service/***/namedValues?api-version=2022-04-01-preview.

If you're using our starter pipelines, make sure that the RESOURCE_GROUP_NAME parameter is set.

nepsmaddy commented 6 months ago

@guythetechie , i am using Girhub Workflows and it does not ask any params in the inputs. Though i have multiple resource group in the subscription. How should be proceed with this scenario? Is there any provision for such cases?

guythetechie commented 6 months ago

Take a look at these instructions. You need to configure the AZURE_RESOURCE_GROUP_NAME GitHub secret.