Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ShiftLeft pipeline support request by Fuming Zhang: Sync Swagger to GitHub task is producing an empty diff #5725

Closed
konrad-jamrozik opened this issue Mar 16, 2023 · 13 comments
Assignees
Labels
Central-EngSys This issue is owned by the Engineering System team. Spec PR Tools Tooling that runs in azure-rest-api-specs repo. Support

Comments

@konrad-jamrozik
Copy link
Contributor

konrad-jamrozik commented Mar 16, 2023

Relevant post on API Service Toolset Teams channel.

I had calls with Ray Chen about it. Recordings available on https://www.microsoft365.com/mycontent

Recording 1 - about ShiftLeft in general
Recording 2 - debugging this issue specifically

Urgency:

[Tuesday 3/14/2023 7:55 PM] Fuming Zhang
got it, it takes 6 days before service is ready to perform swagger release, so we could wait a little bit

Tasks that didn't diff anything:

@ghost ghost added the needs-triage Workflow: This is a new issue that needs to be triaged to the appropriate team. label Mar 16, 2023
@konrad-jamrozik konrad-jamrozik self-assigned this Mar 16, 2023
@konrad-jamrozik konrad-jamrozik added Central-EngSys This issue is owned by the Engineering System team. and removed needs-triage Workflow: This is a new issue that needs to be triaged to the appropriate team. labels Mar 16, 2023
@konrad-jamrozik konrad-jamrozik changed the title ShiftLeft: Sync Swagger to GitHub is not creating diff (reported by Fuming Zhang) ShiftLeft support request: Sync Swagger to GitHub is not creating diff (reported by Fuming Zhang) Mar 16, 2023
@konrad-jamrozik konrad-jamrozik changed the title ShiftLeft support request: Sync Swagger to GitHub is not creating diff (reported by Fuming Zhang) ShiftLeft support request by Fuming Zhang: Sync Swagger to GitHub is not creating diff Mar 16, 2023
@konrad-jamrozik konrad-jamrozik changed the title ShiftLeft support request by Fuming Zhang: Sync Swagger to GitHub is not creating diff ShiftLeft support request by Fuming Zhang: Sync Swagger to GitHub is not creating diff PR Mar 16, 2023
@konrad-jamrozik konrad-jamrozik changed the title ShiftLeft support request by Fuming Zhang: Sync Swagger to GitHub is not creating diff PR ShiftLeft pipeline support request by Fuming Zhang: Sync Swagger to GitHub is not creating diff PR Mar 16, 2023
@FumingZhang
Copy link
Member

Hey @konrad-jamrozik, may I ask how is the progress of this bug fix? We want to do swagger release as soon as possible.

@konrad-jamrozik
Copy link
Contributor Author

@FumingZhang apologizes for the delay! I am going to work on this over the next 12 hours, expect an update from me in that time window.

@konrad-jamrozik
Copy link
Contributor Author

konrad-jamrozik commented Mar 21, 2023

I have advised @FumingZhang to create a PR directly to the azure-rest-api-specs repo. This is in violation of the ShiftLeft rules, as can be seen e.g. here: Azure/azure-rest-api-specs#22309 (comment) .

However, the rule assumes timely support if issues like this one arise, which is currently not possible, as I am new to the codebase and I am still working through it, making progress, albeit slow. Fuming confirmed he is working on submitting a PR to the main repo.

@FumingZhang
Copy link
Member

Manually created PR #23189.

@konrad-jamrozik
Copy link
Contributor Author

I submitted a PR against ShiftLeft source adding diagnostic info to help diagnose the root-cause:
https://devdiv.visualstudio.com/DevDiv/_git/openapi-pipeline/pullrequest/459818

@konrad-jamrozik
Copy link
Contributor Author

konrad-jamrozik commented Mar 22, 2023

@FumingZhang I believe I found the root cause. In our call we had few days ago you gave as an example that the following directory should have been included in the diff PR:

/swagger/containerservice/resource-manager/Microsoft.ContainerService/aks/stable/2023-02-01

I ran another build from that branch with additional diagnostic output which you find here. In this build you can see:

CaldDirForArm='swagger/containerservice/fleets.management' CadlDirForDataplane=''
Executing Apply-PatchTsp src='/home/vsts/work/1/s/../Azure-azure-rest-api-specs-pr/swagger/containerservice/fleets.management' tar='specification' ServiceName='containerservice' tspFolder='fleets.management' targetTspFolder='specification/containerservice/fleets.management'
Executing Remove-DeletedTsp src='/home/vsts/work/1/s/../Azure-azure-rest-api-specs-pr/swagger/containerservice/fleets.management' tar='specification/containerservice/fleets.management'
removing whole folder specification/containerservice/fleets.management
Skipped processing CadlDirForDataplane as it is an empty string
Executing Push-Changes branch='containerservice/official/aks-api-release' commitMsg='[AutoSyncTsp] bae8054ad7e Merged PR 7768257: Revert "Merged PR 7726419: [API Release] 2023-03-02-preview Create Swagger ba...'
No tsp changes

Please note the:
CaldDirForArm='swagger/containerservice/fleets.management'

this is a different path than the example you gave, of:

/swagger/containerservice/resource-manager/Microsoft.ContainerService/aks/stable/2023-02-01

it differs by suffix: fleets.management vs resource-manager.

Hence it seems to me that if you would change the value of the CadlDirForArm variable, which currently is swagger/containerservice/fleets.management, the PR should be properly created.

Now all future builds using ShiftLeft should have this diagnostic information, thus making it easier to figure out what went wrong.

Let me know if this solves the issue, thanks!

@konrad-jamrozik konrad-jamrozik changed the title ShiftLeft pipeline support request by Fuming Zhang: Sync Swagger to GitHub is not creating diff PR ShiftLeft pipeline support request by Fuming Zhang: Sync Tsp to GitHub and Sync Swagger toGitHub tasks are not creating diff PR Mar 22, 2023
@konrad-jamrozik konrad-jamrozik changed the title ShiftLeft pipeline support request by Fuming Zhang: Sync Tsp to GitHub and Sync Swagger toGitHub tasks are not creating diff PR ShiftLeft pipeline support request by Fuming Zhang: Sync Tsp to GitHub and Sync Swagger toGitHub tasks are not creating diff PRs Mar 22, 2023
@konrad-jamrozik konrad-jamrozik changed the title ShiftLeft pipeline support request by Fuming Zhang: Sync Tsp to GitHub and Sync Swagger toGitHub tasks are not creating diff PRs ShiftLeft pipeline support request by Fuming Zhang: Sync Tsp to GitHub and Sync Swagger to GitHub tasks are not creating diff PR Mar 22, 2023
@FumingZhang
Copy link
Member

FumingZhang commented Mar 22, 2023

@konrad-jamrozik, there are 2 sub-services under the Microsoft.ContainerService namespace, the first one is aks (with path /swagger/containerservice/resource-manager/Microsoft.ContainerService/aks) developed in the traditional way (modify the json file directly), and the second one is fleet (with path /swagger/containerservice/resource-manager/Microsoft.ContainerService/fleet) developed with cadl.

The API changes of these two services will be released independently, so we defined the manifest file like

"official/aks-api-release": {
    "includedPaths": [
        "containerservice/resource-manager/Microsoft.ContainerService/aks/*"
    ]
},
"official/fleet-api-release": {
    "includedPaths": [
        "containerservice/resource-manager/Microsoft.ContainerService/fleet/*"
    ]
}

This time, I am trying to release aks related changes via branch official/aks-api-release and I think it should have nothing to do with fleet or cadl (not sure what Tsp is short for, but I guess it's related to cadl).

So once we've enabled cadl, it's effective for the whole namespace? Can the traditional way and cadl way coexist?

@konrad-jamrozik
Copy link
Contributor Author

konrad-jamrozik commented Mar 22, 2023

@FumingZhang apologies, my mistake. I somehow assumed the issue is that both Sync Swagger to GitHub and Sync Tsp to GitHub do not create any diff, but obviously you meant only Sync Swagger to GitHub. Hence, I will need to work a bit more on getting the root cause, but relevant code to which I need to add diagnostic logging is very similar, so expect a reply from me within next 24h (i.e. my upcoming business day).

Can the traditional way and cadl way coexist?

Yes, they can co-exist. There are two separate tasks for that in the ShiftLeft pipeline.

I believe Tsp stands for TypeSpec which is the new name for Cadl.

@konrad-jamrozik konrad-jamrozik changed the title ShiftLeft pipeline support request by Fuming Zhang: Sync Tsp to GitHub and Sync Swagger to GitHub tasks are not creating diff PR ShiftLeft pipeline support request by Fuming Zhang: Sync Swagger to GitHub task is producing empty diff Mar 22, 2023
@konrad-jamrozik konrad-jamrozik changed the title ShiftLeft pipeline support request by Fuming Zhang: Sync Swagger to GitHub task is producing empty diff ShiftLeft pipeline support request by Fuming Zhang: Sync Swagger to GitHub task is producing an empty diff Mar 22, 2023
@konrad-jamrozik
Copy link
Contributor Author

@FumingZhang I submitted a PR with experimental bugfix, waiting for approval:
Pull Request 460255: Path matching bugfixes in SyncTspToGitHub.ps1 & SyncSwaggerToGitHub.ps1 for backslashes, and for case of non-existent excludedPaths.

@FumingZhang
Copy link
Member

Thanks for the update

@konrad-jamrozik
Copy link
Contributor Author

@FumingZhang I fixed the immediate bug with this PR, but I uncovered the next bug; currently waiting for approval for a PR with a fix.

@konrad-jamrozik
Copy link
Contributor Author

@FumingZhang OK looks like the bug is finally fixed!

PR with the last bugfix

Successful build

Resulting PR, confirming the fix works

Now I am going to look into #5788

I am closing this issue as resolved, but let me know if something is still not right.

@FumingZhang
Copy link
Member

Cool, thanks @konrad-jamrozik.

@konrad-jamrozik konrad-jamrozik added the Spec PR Tools Tooling that runs in azure-rest-api-specs repo. label Mar 31, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Central-EngSys This issue is owned by the Engineering System team. Spec PR Tools Tooling that runs in azure-rest-api-specs repo. Support
Projects
None yet
Development

No branches or pull requests

2 participants