Skip to content

Commit 838dcfe

Browse files
authored
Merge branch 'dev' into feature/ts-exclude-me
2 parents 5a57b86 + b47c7ad commit 838dcfe

File tree

3 files changed

+23
-14
lines changed

3 files changed

+23
-14
lines changed

.azure-pipelines/generation-pipeline.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -158,7 +158,7 @@ variables:
158158
cleanMetadataFolderV1: 'clean_v10_metadata'
159159
cleanOpenAPIFolderBeta: 'clean_beta_openapi'
160160
cleanOpenAPIFolderV1: 'clean_v10_openapi'
161-
rawMetadataFileBeta: 'https://graph.microsoft.com/beta/$metadata'
161+
rawMetadataFileBeta: '$(Build.SourcesDirectory)/msgraph-metadata/schemas/beta-Prod.csdl'
162162
rawMetadataFileV1: 'https://graph.microsoft.com/v1.0/$metadata' # We want to run against the metadata we have captured.
163163
typewriterDirectory: '$(Build.SourcesDirectory)/typewriter'
164164
kiotaDirectory: '$(Build.SourcesDirectory)/kiota'

.azure-pipelines/generation-templates/capture-metadata.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,7 @@ steps:
4747
errorOnNoChange: 1
4848
endpointVersion: ${{ parameters.endpoint }}
4949
targetBranch: 'master'
50+
inputMetadataFile: ${{ parameters.inputMetadata }}
5051
enabled: true
5152

5253
- template: download-typewriter.yml

scripts/download-diff-metadata.ps1

Lines changed: 21 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -49,20 +49,28 @@ if ($branch -ne $env:targetBranch) {
4949
git pull origin $env:targetBranch --ff-only | Write-Host
5050
}
5151

52-
# Download the metadata from livesite.
53-
$url = "https://graph.microsoft.com/{0}/`$metadata" -f $env:endpointVersion
54-
$metadataFileName = "{0}_metadata.xml" -f $env:endpointVersion
55-
$pathToLiveMetadata = Join-Path -Path ($pwd).path -ChildPath $metadataFileName
56-
$client = new-object System.Net.WebClient
57-
$client.Encoding = [System.Text.Encoding]::UTF8
58-
Write-Host "Attempting to downloaded metadata from $url to $pathToLiveMetadata" -ForegroundColor DarkGreen
59-
$client.DownloadFile($url, $pathToLiveMetadata)
60-
Write-Host "Downloaded metadata from $url to $pathToLiveMetadata" -ForegroundColor DarkGreen
52+
if ($env:inputMetadataFile.StartsWith("http", [StringComparison]::OrdinalIgnoreCase)){
53+
# Download metadata from livesite.
54+
$url = "https://graph.microsoft.com/{0}/`$metadata" -f $env:endpointVersion
55+
$metadataFileName = "{0}_metadata.xml" -f $env:endpointVersion
56+
$pathToLiveMetadata = Join-Path -Path ($pwd).path -ChildPath $metadataFileName
57+
$client = new-object System.Net.WebClient
58+
$client.Encoding = [System.Text.Encoding]::UTF8
59+
Write-Host "Attempting to download metadata from $url to $pathToLiveMetadata" -ForegroundColor DarkGreen
60+
$client.DownloadFile($url, $pathToLiveMetadata)
61+
Write-Host "Downloaded metadata from $url to $pathToLiveMetadata" -ForegroundColor DarkGreen
6162

62-
# Format the metadata to make it easy for us hoomans to read and perform non-markup line based diffs.
63-
$content = Format-Xml (Get-Content $pathToLiveMetadata)
64-
[IO.File]::WriteAllLines($pathToLiveMetadata, $content)
65-
Write-Host "Wrote $metadataFileName to disk. Now git will tell us whether there are changes." -ForegroundColor DarkGreen
63+
# Format the metadata to make it easy for us hoomans to read and perform non-markup line based diffs.
64+
$content = Format-Xml (Get-Content $pathToLiveMetadata)
65+
[IO.File]::WriteAllLines($pathToLiveMetadata, $content)
66+
Write-Host "Wrote $metadataFileName to disk. Now git will tell us whether there are changes." -ForegroundColor DarkGreen
67+
}
68+
else{
69+
# Retrieve the metadata from ./schemas folder in the metadata repo.
70+
Write-Host "Retrieving metadata from $env:inputMetadataFile" -ForegroundColor DarkGreen
71+
$content = Format-Xml (Get-Content $env:inputMetadataFile)
72+
Write-Host "Retrieved metadata from $env:inputMetadataFile" -ForegroundColor DarkGreen
73+
}
6674

6775
# Discover if there are changes between the downloaded file and what is in git.
6876
[array]$result = git status --porcelain

0 commit comments

Comments
 (0)