diff --git a/eng/pipelines/templates/jobs/archetype-sdk-client.yml b/eng/pipelines/templates/jobs/archetype-sdk-client.yml index b9a91d7fa453..3958e94c60c5 100644 --- a/eng/pipelines/templates/jobs/archetype-sdk-client.yml +++ b/eng/pipelines/templates/jobs/archetype-sdk-client.yml @@ -49,6 +49,8 @@ jobs: displayName: "Tag scheduled builds" condition: and(eq(variables['Build.SourceBranchName'],'master'),eq(variables['Build.Reason'],'Schedule')) - template: /eng/common/pipelines/templates/steps/daily-dev-build-variable.yml + parameters: + ServiceDirectory: ${{ parameters.ServiceDirectory }} - pwsh: | $skipDevBuildNumber = "false" # For .NET builds the only case we want to not have dev build numbers on our packages is when it is manually queued and @@ -89,7 +91,7 @@ jobs: artifactName: packages path: $(Build.ArtifactStagingDirectory) - - template: /eng/pipelines/templates/steps/create-apireview.yml + - template: /eng/common/pipelines/templates/steps/create-apireview.yml parameters: Artifacts: ${{parameters.Artifacts}} diff --git a/eng/pipelines/templates/steps/create-apireview.yml b/eng/pipelines/templates/steps/create-apireview.yml deleted file mode 100644 index 6cda731916b3..000000000000 --- a/eng/pipelines/templates/steps/create-apireview.yml +++ /dev/null @@ -1,19 +0,0 @@ -parameters: - ArtifactPath: $(Build.ArtifactStagingDirectory) - Artifacts: [] - -steps: - - ${{ each artifact in parameters.Artifacts }}: - - task: Powershell@2 - inputs: - filePath: $(Build.SourcesDirectory)/eng/scripts/Create-APIReview.ps1 - arguments: > - -ArtifactPath ${{parameters.ArtifactPath}}/${{artifact.name}} - -APIViewUri $(azuresdk-apiview-uri) - -APIKey $(azuresdk-apiview-apikey) - -APILabel "Auto Review - $(Build.SourceVersion)" - pwsh: true - workingDirectory: $(Pipeline.Workspace) - displayName: Create API Review ${{ artifact.name}} - condition: and(succeededOrFailed(), ne(variables['Skip.CreateApiReview'], 'true') , ne(variables['Build.Reason'],'PullRequest'), eq(variables['System.TeamProject'], 'internal')) - continueOnError: true \ No newline at end of file diff --git a/eng/scripts/Create-APIReview.ps1 b/eng/scripts/Create-APIReview.ps1 deleted file mode 100644 index 453e2272fa09..000000000000 --- a/eng/scripts/Create-APIReview.ps1 +++ /dev/null @@ -1,104 +0,0 @@ -[CmdletBinding()] -Param ( - [Parameter(Mandatory=$True)] - [string] $ArtifactPath, - [Parameter(Mandatory=$True)] - [string] $APIViewUri, - [Parameter(Mandatory=$True)] - [string] $APIKey, - [Parameter(Mandatory=$True)] - [string] $APILabel, - [string] $PackageName = "" -) - - -# Submit API review request and return status whether current revision is approved or pending or failed to create review -function Submit-APIReview($packagename, $filePath, $uri, $apiKey, $apiLabel) -{ - $multipartContent = [System.Net.Http.MultipartFormDataContent]::new() - $FileStream = [System.IO.FileStream]::new($filePath, [System.IO.FileMode]::Open) - $fileHeader = [System.Net.Http.Headers.ContentDispositionHeaderValue]::new("form-data") - $fileHeader.Name = "file" - $fileHeader.FileName = $packagename - $fileContent = [System.Net.Http.StreamContent]::new($FileStream) - $fileContent.Headers.ContentDisposition = $fileHeader - $fileContent.Headers.ContentType = [System.Net.Http.Headers.MediaTypeHeaderValue]::Parse("application/octet-stream") - $multipartContent.Add($fileContent) - - - $stringHeader = [System.Net.Http.Headers.ContentDispositionHeaderValue]::new("form-data") - $stringHeader.Name = "label" - $StringContent = [System.Net.Http.StringContent]::new($apiLabel) - $StringContent.Headers.ContentDisposition = $stringHeader - $multipartContent.Add($stringContent) - - $headers = @{ - "ApiKey" = $apiKey; - "content-type" = "multipart/form-data" - } - - try - { - $Response = Invoke-WebRequest -Method 'POST' -Uri $uri -Body $multipartContent -Headers $headers - $StatusCode = $Response.StatusCode - } - catch - { - $StatusCode = $_.Exception.Response.StatusCode - } - - return $StatusCode -} - - -. (Join-Path $PSScriptRoot Language-Settings.ps1) -$packages = @{} -if (Test-Path "Function:Find-dotnet-Artifacts-For-Apireview") -{ - $packages = Find-dotnet-Artifacts-For-Apireview $ArtifactPath $PackageName -} -else -{ - Write-Host "Function Find-dotnet-Artifacts-For-Apireview is not found" - exit(1) -} - -$responses = @{} -if ($packages) -{ - foreach($pkg in $packages.Keys) - { - Write-Host "Submitting API Review for package $($pkg)" - Write-Host $packages[$pkg] - $responses[$pkg] = Submit-APIReview -packagename $pkg -filePath $packages[$pkg] -uri $APIViewUri -apiKey $APIKey -apiLabel $APILabel - } -} -else -{ - Write-Host "No package is found in artifact path to submit review request" - exit(1) -} - -$FoundFailure = $False -foreach ($pkgName in $responses.Keys) -{ - $respCode = $responses[$pkgName] - if ($respCode -ne '200') - { - $FoundFailure = $True - if ($respCode -eq '201') - { - Write-Host "API Review is pending for package $pkgName" - } - else - { - Write-Host "Failed to create API Review for package $pkgName" - } - } -} -if ($FoundFailure) -{ - Write-Host "Atleast one API review is not yet approved" -} - - diff --git a/eng/scripts/Language-Settings.ps1 b/eng/scripts/Language-Settings.ps1 index 7559f37289f0..c3a0f7ed0d58 100644 --- a/eng/scripts/Language-Settings.ps1 +++ b/eng/scripts/Language-Settings.ps1 @@ -14,7 +14,15 @@ function Get-dotnet-PackageInfoFromRepo ($pkgPath, $serviceDirectory, $pkgName) $projectData = New-Object -TypeName XML $projectData.load($projectPath) $pkgVersion = Select-XML -Xml $projectData -XPath '/Project/PropertyGroup/Version' - return [PackageProps]::new($pkgName, $pkgVersion, $pkgPath, $serviceDirectory) + $sdkType = "client" + if ($pkgName -match "\.ResourceManager\." -or $pkgName -match "\.Management\.") + { + $sdkType = "mgmt" + } + $pkgProp = [PackageProps]::new($pkgName, $pkgVersion, $pkgPath, $serviceDirectory) + $pkgProp.SdkType = $sdkType + $pkgProp.IsNewSdk = $pkgName.StartsWith("Azure") + return $pkgProp } else { @@ -202,13 +210,14 @@ function Update-dotnet-CIConfig($pkgs, $ciRepo, $locationInDocRepo, $monikerId=$ } # function is used to auto generate API View -function Find-dotnet-Artifacts-For-Apireview($artifactDir, $packageName = "") +function Find-dotnet-Artifacts-For-Apireview($artifactDir, $packageName) { # Find all nupkg files in given artifact directory - $pkg = Get-dotnet-Package-Artifacts $artifactDir + $PackageArtifactPath = Join-Path $artifactDir $packageName + $pkg = Get-dotnet-Package-Artifacts $PackageArtifactPath if (!$pkg) { - Write-Host "Package is not available in artifact path $($artifactDir)" + Write-Host "Package is not available in artifact path $($PackageArtifactPath)" return $null } $packages = @{ $pkg.Name = $pkg.FullName }