Skip to content

Commit 7c5937c

Browse files
chunyu3jsquire
andauthored
set ci yaml according to the service type (Azure#33335)
* set ci yaml according to the service type * Update eng/scripts/automation/GenerateAndBuildLib.ps1 Co-authored-by: Jesse Squire <jesse.squire@gmail.com> * Update eng/scripts/Invoke-GenerateAndBuildV2.ps1 Co-authored-by: Jesse Squire <jesse.squire@gmail.com> * Update eng/scripts/automation/Invoke-GenerateAndBuild.ps1 Co-authored-by: Jesse Squire <jesse.squire@gmail.com> Co-authored-by: Jesse Squire <jesse.squire@gmail.com>
1 parent 9d07515 commit 7c5937c

File tree

3 files changed

+17
-7
lines changed

3 files changed

+17
-7
lines changed

eng/scripts/Invoke-GenerateAndBuildV2.ps1

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -143,6 +143,7 @@ if ($relatedCadlProjectFolder) {
143143
-sdkRootPath $sdkPath `
144144
-path $relativeSdkPath `
145145
-downloadUrlPrefix $downloadUrlPrefix `
146+
-serviceType "data-plane" `
146147
-generatedSDKPackages $generatedSDKPackages
147148
}
148149
}

eng/scripts/automation/GenerateAndBuildLib.ps1

Lines changed: 15 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -663,7 +663,7 @@ function Invoke-GenerateAndBuildSDK () {
663663
# $packageName = $package.packageName
664664
Write-Host "projectFolder:$projectFolder"
665665

666-
GeneratePackage -projectFolder $projectFolder -sdkRootPath $sdkRootPath -path $path -downloadUrlPrefix $downloadUrlPrefix -generatedSDKPackages $generatedSDKPackages
666+
GeneratePackage -projectFolder $projectFolder -sdkRootPath $sdkRootPath -path $path -downloadUrlPrefix $downloadUrlPrefix -serviceType $serviceType -generatedSDKPackages $generatedSDKPackages
667667
}
668668
}
669669

@@ -674,6 +674,7 @@ function GeneratePackage()
674674
[string]$sdkRootPath,
675675
[string]$path,
676676
[string]$downloadUrlPrefix="",
677+
[string]$serviceType="data-plane",
677678
[switch]$skipGenerate,
678679
[object]$generatedSDKPackages
679680
)
@@ -768,9 +769,13 @@ function GeneratePackage()
768769
full = $full
769770
lite = $full
770771
}
772+
$ciFilePath = "sdk/$service/ci.yml"
773+
if ( $serviceType -eq "resource-manager" ) {
774+
$ciFilePath = "sdk/$service/ci.mgmt.yml"
775+
}
771776
$generatedSDKPackages.Add(@{packageName="$packageName";
772777
result=$result;
773-
path=@("$path", "sdk/$service/ci.yml");
778+
path=@("$path", "$ciFilePath");
774779
packageFolder="$projectFolder";
775780
artifacts=$artifacts;
776781
apiViewArtifact=$apiViewArtifact;
@@ -792,7 +797,7 @@ function UpdateExistingSDKByInputFiles()
792797
$autorestFilesPath = Get-ChildItem -Path "$sdkRootPath/sdk" -Filter autorest.md -Recurse | Resolve-Path -Relative
793798
Write-Host "Updating autorest.md files for all the changed swaggers."
794799

795-
$sdksInfo = @()
800+
$sdksInfo = @{}
796801
$regexToFindSha = "https:\/\/[^`"]*[\/][0-9a-f]{4,40}[\/]"
797802
foreach ($path in $autorestFilesPath) {
798803
$fileContent = Get-Content $path
@@ -805,8 +810,8 @@ function UpdateExistingSDKByInputFiles()
805810
$fileContent -replace $regexToFindSha, "$repoHttpsUrl/blob/$headSha/" | Set-Content -Path $path
806811

807812
$sdkpath = (get-item $path).Directory.Parent.FullName | Resolve-Path -Relative
808-
if (!$sdksInfo.Contains($sdkpath)) {
809-
$sdksInfo += @($sdkpath)
813+
if (!$sdksInfo.ContainsKey($sdkpath)) {
814+
$sdksInfo.Add($sdkpath, $inputFilePath)
810815
}
811816
break
812817
}
@@ -815,11 +820,14 @@ function UpdateExistingSDKByInputFiles()
815820
}
816821

817822
# generate SDK
818-
foreach ($sdkpath in $sdksInfo) {
823+
foreach ($sdkPath in $sdksInfo.Keys) {
819824
$path = , $sdkPath
825+
$inputFile = $sdksInfo["$sdkPath"]
826+
$inputFile -match "specification/(?<service>.*)/(?<serviceType>.*)"
827+
$serviceType = $matches["serviceType"]
820828
$projectFolder = Join-Path $sdkRootPath $sdkPath
821829
$projectFolder = Resolve-Path -Path $projectFolder
822-
GeneratePackage -projectFolder $projectFolder -sdkRootPath $sdkRootPath -path $path -downloadUrlPrefix "$downloadUrlPrefix" -generatedSDKPackages $generatedSDKPackages
830+
GeneratePackage -projectFolder $projectFolder -sdkRootPath $sdkRootPath -path $path -downloadUrlPrefix "$downloadUrlPrefix" -serviceType $serviceType -generatedSDKPackages $generatedSDKPackages
823831
}
824832

825833
}

eng/scripts/automation/Invoke-GenerateAndBuild.ps1

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -97,6 +97,7 @@ if ($relatedCadlProjectFolder) {
9797
-sdkRootPath $sdkPath `
9898
-path $relativeSdkPath `
9999
-downloadUrlPrefix $downloadUrlPrefix `
100+
-serviceType "data-plane" `
100101
-generatedSDKPackages $generatedSDKPackages
101102
}
102103
$outputJson = [PSCustomObject]@{

0 commit comments

Comments
 (0)