Closed anotherRedbeard closed 3 months ago
@anotherRedbeard - when you have a chance, can you please see if this branch fixes your issue?
@guythetechie - I tried that branch and still get an error. It is different than the last error and it seems to indicate it's trying to delete the rev=2 api (because that folder was removed/renamed in the repo) but fails because it is the current revision.
Here is the error:
crit: Publisher[0]
System.InvalidOperationException: HTTP request to URI https://management.azure.com/subscriptions/***/resourceGroups/***/providers/Microsoft.ApiManagement/service/***/apis/echo-api;rev=2?api-version=2021-12-01-preview failed with status code 400. Content is '{"error":{"code":"ValidationError","message":"Cannot delete the current revision of an API.","details":null}}'.
at common.HttpPipelineExtensions.Validate(Response response, Uri requestUri)
at common.HttpPipelineExtensions.DeleteResource(HttpPipeline pipeline, Uri uri, CancellationToken cancellationToken)
at publisher.Program.<>c__DisplayClass10_0.<<GetDeleteRestResource>b__0>d.MoveNext()
--- End of stack trace from previous location ---
at publisher.Api.Delete(ApiName apiName, ServiceUri serviceUri, DeleteRestResource deleteRestResource, ILogger logger, CancellationToken cancellationToken)
at publisher.Api.ProcessDeletedApi(ApiName apiName, ApiInformationFile deletedApiInformationFile, ApiSpecificationFile deletedSpecificationFile, JsonObject configurationApiJson, ServiceDirectory serviceDirectory, ServiceUri serviceUri, PutRestResource putRestResource, DeleteRestResource deleteRestResource, ILogger logger, CancellationToken cancellationToken)
at publisher.Api.<>c__DisplayClass0_0.<<ProcessDeletedArtifacts>b__4>d.MoveNext()
--- End of stack trace from previous location ---
at System.Threading.Tasks.Parallel.<>c__50`1.<<ForEachAsync>b__50_0>d.MoveNext()
--- End of stack trace from previous location ---
at common.IEnumerableExtensions.ForEachParallel[T](IEnumerable`1 enumerable, Func`2 action, CancellationToken cancellationToken)
at publisher.Api.ProcessDeletedArtifacts(IReadOnlyCollection`1 files, JsonObject configurationJson, ServiceDirectory serviceDirectory, ServiceUri serviceUri, PutRestResource putRestResource, DeleteRestResource deleteRestResource, ILogger logger, CancellationToken cancellationToken)
at publisher.Service.ProcessDeletedArtifacts(IReadOnlyCollection`1 files, JsonObject configurationJson, ServiceDirectory serviceDirectory, ServiceUri serviceUri, ListRestResources listRestResources, PutRestResource putRestResource, DeleteRestResource deleteRestResource, ILogger logger, CancellationToken cancellationToken)
at publisher.Publisher.ProcessDeletedCommitIdFiles(IReadOnlyCollection`1 deletedCommitIdFiles, CancellationToken cancellationToken)
at publisher.Publisher.RunWithCommitId(CommitId commitId, CancellationToken cancellationToken)
at publisher.Publisher.Run(CancellationToken cancellationToken)
at publisher.Publisher.ExecuteAsync(CancellationToken cancellationToken)
@anotherRedbeard - based on our discussion, I've added a check to ensure the revision is not current prior to deletion. Can you try again with the latest code in the branch?
This error also shows up in our environments but for different reasons, I'll check the details and see if this branch fixes it.
@aristosvo can we close this issue?
Sure! Thanks a lot:)
Hi, I'm using the latest release V5.1.4. our api has 3 revisions, when I want to make second revision current, by removing isCurrent: true in the first revision (apiInformation.json.json) and add it in the second revision apiInformation.json.json its not working as expected. Still its keeping reviosn1 active, please suggest how can I set revision2 active?
Yes this is a known issue and will be fixed in the next release.
Hi,
The next major version has been released (v6.0.0-alpha.1.0.4). It is still in alpha but it seems that it is worse than before.
It is not capable to publish additional revisions to an api. For this use case, I am having the error "Can't set new revision as current". And there is no issue, if I created the revision manually in advance. Can you check ?
Please avoid using v6 for now. We are working on fixing some issues with that version. For now please use v5.x.
@simonTTIS we just tested under v6.0.0-rc1 and the issue has been resolved. Please test and let us know.
@waelkdouh The publish of new revisions does still not work completely with v6.0.0-rc1. The exception and the error message described above is no longer thrown, but the publisher does not publish the revision set as current in the target APIM.
New revision can be extracted and are also reflecting the setting (isCurrent: true) in the apiInformation. Also the path structure is valid and the other revisions are put in the folder with their revision id. However the publisher does not change the current revision when this is published and keeps the previous revision as the current.
Release version
v.3.0.1
Describe the bug
When I create a new revision in my API and extract and publish the changes, everything works as expected, but when I make that revision current, extract and publish the changes I get the following error attempting to publish from the last commit.
Expected behavior
Revisions should match lower level environments and have the same version id as the current revision.
Actual behavior
I'm not 100% sure what's happening, but it appears that when you make the revision current it changes the url which is changing the folder in the extractor run.
Here is the error:
Reproduction Steps
Add a revision to an api in your lower level environment and make that the current revision. Run the extractor, approve and complete the PR and you will see the error in the dev publisher run.