-
Notifications
You must be signed in to change notification settings - Fork 76
ci: fix broken OpenAPI generation #1392
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
Merged
Merged
Changes from 3 commits
Commits
Show all changes
16 commits
Select commit
Hold shift + click to select a range
a4fdada
ci: fix broken OpenAPI generation
MIchaelMainer 11a16eb
ci: add PR for OpenAPI files
MIchaelMainer 1766791
docs: clarify comments
MIchaelMainer 9b0f791
Update scripts/git-push-cleanmetadata.ps1
MIchaelMainer fb841ba
ci: clarify use of version when creating PR
MIchaelMainer 3dfb02c
Merge branch 'mmainer/fix-broken-generation' of https://github.com/mi…
MIchaelMainer 4c2f858
ci: remove display name from template use
MIchaelMainer 24a0a8e
ci update logging
MIchaelMainer a941ba6
ci: correct the copyfile overwrite parameter
MIchaelMainer 4ddd9be
ci: add approval step for OpenAPI before running Kiota generation
MIchaelMainer fb938e5
ci: update env var name
MIchaelMainer 4666254
ci: typings gen does not use open_api
MIchaelMainer efe36c0
ci: name branch using endpointversion, add clarity for host output
MIchaelMainer eee6fef
ci: update for supporting builds
MIchaelMainer 1ee63da
ci: add PR title for OpenAPI PRs
MIchaelMainer 53d8d25
ci: add beta openapi approval step
MIchaelMainer File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,31 +1,81 @@ | ||
| # git-push-cleanmetadata.ps1 | ||
| # Copyright (c) Microsoft Corporation. All Rights Reserved. Licensed under the MIT License. See License in the | ||
| # project root for license information. | ||
|
|
||
| # Referenced by: | ||
| # capture-metadata.yml | ||
| # capture-openapi.yml | ||
|
|
||
| # This script stashes any changes, checks out the latest master branch, applies the stashed changes, commits, and | ||
| # pushes the changes back to the remote repository. | ||
|
|
||
| if ($env:PublishChanges -eq $False) | ||
| { | ||
| Write-Host "Not publishing changes per the run parameter!" -ForegroundColor Green | ||
| Write-Host "Not publishing changes per the run parameter!" -ForegroundColor Red | ||
|
MIchaelMainer marked this conversation as resolved.
Outdated
|
||
| return; | ||
| } | ||
|
|
||
| Write-Host "About to add clean $env:EndpointVersion metadata file....." | ||
| Write-Host "`nGet status:" -ForegroundColor Green | ||
| git status | Write-Host -ForegroundColor Yellow | ||
|
|
||
| git fetch origin master | ||
| Write-Host "`nStash the update metadata files.....`nRunning: git stash" -ForegroundColor Green | ||
| git stash | Write-Host -ForegroundColor Yellow | ||
|
|
||
| Write-Host "`nFetching latest master branch to ensure we are up to date..." -ForegroundColor Green | ||
| git fetch origin master | Write-Host -ForegroundColor Yellow | ||
| # checkout master to move from detached HEAD mode | ||
| git switch master | ||
| git switch master | Write-Host -ForegroundColor Yellow | ||
|
|
||
| Write-Host "`nGet status:" -ForegroundColor Green | ||
| git status | Write-Host -ForegroundColor Yellow | ||
|
|
||
| Write-Host "`nApply stashed metadata files...`nRunning: git stash pop" -ForegroundColor Green | ||
| git stash pop | Write-Host -ForegroundColor Yellow | ||
|
|
||
| Write-Host "`nGet status:" -ForegroundColor Green | ||
| git status | Write-Host -ForegroundColor Yellow | ||
|
|
||
| if ($env:CreatePR -eq $True) | ||
| { | ||
| Write-Host "`nCreate branch: $env:BUILD_BUILDID/updateOpenAPI" -ForegroundColor Green | ||
| git checkout -B $env:BUILD_BUILDID/updateOpenAPI | Write-Host -ForegroundColor Yellow | ||
| } | ||
|
|
||
| Write-Host "`nStaging clean $env:EndpointVersion metadata files....." -ForegroundColor Green | ||
| git add . | Write-Host -ForegroundColor Yellow | ||
|
|
||
| Write-Host "`nGet status:" -ForegroundColor Green | ||
| git status | Write-Host -ForegroundColor Yellow | ||
|
|
||
| Write-Host "`nAttempting to commit clean $env:EndpointVersion metadata files....." -ForegroundColor Green | ||
|
|
||
| git add . | Write-Host | ||
| if ($env:BUILD_REASON -eq 'Manual') # Skip CI if manually running this pipeline. | ||
| { | ||
| git commit -m "Update clean metadata file with $env:BUILD_BUILDID [skip ci]" | Write-Host | ||
| git commit -m "Update clean metadata file with $env:BUILD_BUILDID [skip ci]" | Write-Host -ForegroundColor Yellow | ||
| } | ||
| else | ||
| { | ||
| git commit -m "Update clean metadata file with $env:BUILD_BUILDID" | Write-Host | ||
| git commit -m "Update clean metadata file with $env:BUILD_BUILDID" | Write-Host -ForegroundColor Yellow | ||
| } | ||
|
|
||
| Write-Host "Added and commited cleaned $env:EndpointVersion metadata." -ForegroundColor Green | ||
| Write-Host "`nGet status:" -ForegroundColor Green | ||
| git status | Write-Host -ForegroundColor Yellow | ||
|
|
||
| # sync branch before pushing | ||
| # this is especially important while running v1 and beta in parallel | ||
| # and one process goes out of sync because of the other's check-in | ||
| git pull origin master --rebase | ||
| if ($env:CreatePR -eq $True) | ||
| { | ||
| Write-Host "`nPushing branch for PR creation" -ForegroundColor Green | ||
|
|
||
| Write-Host "`ngit push --set-upstream origin $env:BUILD_BUILDID/updateOpenAPI:" -ForegroundColor Green | ||
| git push --set-upstream origin $env:BUILD_BUILDID/updateOpenAPI | Write-Host -ForegroundColor Yellow | ||
| } | ||
| else # original behavior: push to master | ||
| { | ||
| Write-Host "`nRunning: git pull origin master --rebase..." -ForegroundColor Green | ||
| # sync branch before pushing | ||
| # this is especially important while running v1 and beta in parallel | ||
| # and one process goes out of sync because of the other's check-in | ||
| git pull origin master --rebase | Write-Host -ForegroundColor Yellow | ||
|
|
||
| git push --set-upstream origin master | Write-Host | ||
| Write-Host "Pushed the results of the build $env:BUILD_BUILDID to the master branch." -ForegroundColor Green | ||
| Write-Host "`nRunning: git push --set-upstream origin master ..." -ForegroundColor Green | ||
| git push --set-upstream origin master | Write-Host -ForegroundColor Yellow | ||
| } | ||
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.