Skip to content

Commit

Permalink
Add Script for adding Include paths to mgmt yml (#9567)
Browse files Browse the repository at this point in the history
* Add Script for adding include paths to mgmt yml

* Set trigger to none, and adjust update-mgmt-yml script

* Update Contributing Docs
  • Loading branch information
chidozieononiwu authored Feb 6, 2020
1 parent 8902f9f commit 6616b68
Show file tree
Hide file tree
Showing 3 changed files with 206 additions and 22 deletions.
21 changes: 10 additions & 11 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -165,17 +165,16 @@ In `sdk\< Service Name >`, you will find projects for services that have already

### Standard Process

1. Create fork of [Azure REST API Specs](https://github.com/azure/azure-rest-api-specs)
2. Create fork of [Azure SDK for .NET](https://github.com/azure/azure-sdk-for-net)
3. Create your Swagger specification for your HTTP API. For more information see
[Introduction to Swagger - The World's Most Popular Framework for APIs](http://swagger.io)
4. Install the latest version of AutoRest and use it to generate your C# client. For more info on getting started with AutoRest,
see the [AutoRest repository](https://github.com/Azure/autorest)
5. Create a branch in your fork of Azure SDK for .NET and add your newly generated code to your project. If you don't have a project in the SDK yet, look at some of the existing projects and build one like the others.
6. **MANDATORY**: Add or update tests for the newly generated code.
7. Once added to the Azure SDK for .NET, build your local package using [client](#client-libraries) or [management](#management-libraries) library instructions shown in the above sections.
8. A Pull request of your Azure SDK for .NET changes against **master** branch of the [Azure SDK for .NET](https://github.com/azure/azure-sdk-for-net)
9. The pull requests will be reviewed and merged by the Azure SDK team
1. Create fork of [Azure REST API Specs](https://github.com/azure/azure-rest-api-specs)
2. Create fork of [Azure SDK for .NET](https://github.com/azure/azure-sdk-for-net)
3. Create your Swagger specification for your HTTP API. For more information see [Introduction to Swagger - The World's Most Popular Framework for APIs](http://swagger.io)
4. Install the latest version of AutoRest and use it to generate your C# client. For more info on getting started with AutoRest, see the [AutoRest repository](https://github.com/Azure/autorest)
5. Create a branch in your fork of Azure SDK for .NET and add your newly generated code to your project. If you don't have a project in the SDK yet, look at some of the existing projects and build one like the others.
6. **MANDATORY**: Add or update tests for the newly generated code.
7. Once added to the Azure SDK for .NET, build your local package using [client](#client-libraries) or [management](#management-libraries) library instructions shown in the above sections.
8. For management libraries run `eng\Update-Mgmt-Yml.ps1` to update PR include paths in `eng\pipelines\mgmt.yml`
9. A Pull request of your Azure SDK for .NET changes against **master** branch of the [Azure SDK for .NET](https://github.com/azure/azure-sdk-for-net)
10. The pull requests will be reviewed and merged by the Azure SDK team

### New Resource Provider

Expand Down
60 changes: 60 additions & 0 deletions eng/Update-Mgmt-Yml.ps1
Original file line number Diff line number Diff line change
@@ -0,0 +1,60 @@
<#
.SYNOPSIS
Updates the Management pipeline definition
.DESCRIPTION
Adds exclusion paths for all client packages in the management pipeline to prevent it from runing during client builds.
Script assumes that the yml is currently valid and has trigger and pr sections
.PARAMETER PackagesPath
Path to the directory containing all the services
.PARAMETER MgmtYmlPath
Path to the management yml definition
.EXAMPLE
Run script with default parameters.
Update-Mgmt-Yml.ps1
#>
Param (
[string] $PackagesPath = "${PSScriptRoot}/../sdk",
[string] $MgmtYmlPath = "${PSScriptRoot}/pipelines/mgmt.yml"
)

Install-Module -Name powershell-yaml -RequiredVersion 0.4.1 -Force -Scope CurrentUser

$MgmtYml = Get-Content $MgmtYmlPath -Raw
$MgmtYmlObj = ConvertFrom-Yaml $MgmtYml -Ordered

$Pr = [ordered]@{ }
$CiBranches = [ordered]@{ }
$CiPaths = [ordered]@{ }
$PrBranches = [ordered]@{ }
$PrPaths = [ordered]@{ }
$Includes = New-Object "System.Collections.Generic.List[String]"
$PrIncludes = New-Object "System.Collections.Generic.List[String]"

$MgmtDirs = Get-ChildItem -Path "$PackagesPath" -Directory -Recurse -Depth 1 | Where-Object { $_.FullName -match ".Management.|\\mgmt" }

# Add Each client path to the exclude list
foreach ($Item in $MgmtDirs) {
$IncludePath = $Item.FullName.Substring($Item.FullName.IndexOf("sdk\"))
if ($IncludePath.Split('\').Length -eq 3) {
$IncludePath = $IncludePath -replace "\\", "/"
$Includes.Add($IncludePath)
}
}

# Ci and Pr section
$PrIncludes.Add('master')
$PrIncludes.Add('*-preview')
$PrBranches.Add("include", $PrIncludes)
$PrPaths.Add("include", $Includes)
$Pr.Add("branches", $PrBranches)
$Pr.Add("paths", $PrPaths)

$MgmtYmlObj.pr = $Pr

$NewMgmtYml = ConvertTo-Yaml $MgmtYmlObj -OutFile $MgmtYmlPath -Force
147 changes: 136 additions & 11 deletions eng/pipelines/mgmt.yml
Original file line number Diff line number Diff line change
@@ -1,24 +1,149 @@
# DO NOT EDIT THIS FILE
# This file is generated automatically and any changes will be lost.

trigger: none
pr: none

pr:
branches:
include:
- master
- '*-preview'
paths:
include:
- sdk/advisor/Microsoft.Azure.Management.Advisor
- sdk/alertsmanagement/Microsoft.Azure.Management.AlertsManagement
- sdk/analysisservices/Microsoft.Azure.Management.AnalysisServices
- sdk/apimanagement/Microsoft.Azure.Management.ApiManagement
- sdk/applicationinsights/Microsoft.Azure.Management.ApplicationInsights
- sdk/appplatform/Microsoft.Azure.Management.AppPlatform
- sdk/attestation/Microsoft.Azure.Management.Attestation
- sdk/authorization/Microsoft.Azure.Management.Authorization
- sdk/automation/Microsoft.Azure.Management.Automation
- sdk/azurestack/Microsoft.AzureStack.Management.AzureBridge.Admin
- sdk/azurestack/Microsoft.AzureStack.Management.Backup.Admin
- sdk/azurestack/Microsoft.AzureStack.Management.Commerce.Admin
- sdk/azurestack/Microsoft.AzureStack.Management.Compute.Admin
- sdk/azurestack/Microsoft.AzureStack.Management.Fabric.Admin
- sdk/azurestack/Microsoft.AzureStack.Management.Gallery.Admin
- sdk/azurestack/Microsoft.AzureStack.Management.InfrastructureInsights.Admin
- sdk/azurestack/Microsoft.AzureStack.Management.KeyVault.Admin
- sdk/azurestack/Microsoft.AzureStack.Management.Network.Admin
- sdk/azurestack/Microsoft.AzureStack.Management.Storage.Admin
- sdk/azurestack/Microsoft.AzureStack.Management.Subscription
- sdk/azurestack/Microsoft.AzureStack.Management.Subscriptions.Admin
- sdk/azurestack/Microsoft.AzureStack.Management.Update.Admin
- sdk/batch/Microsoft.Azure.Management.Batch
- sdk/batchai/Microsoft.Azure.Management.BatchAI
- sdk/billing/Microsoft.Azure.Management.Billing
- sdk/blueprint/Microsoft.Azure.Management.Blueprint
- sdk/botservice/Microsoft.Azure.Management.BotService
- sdk/cdn/Microsoft.Azure.Management.Cdn
- sdk/cognitiveservices/Microsoft.Azure.Management.CognitiveServices
- sdk/compute/Microsoft.Azure.Management.Compute
- sdk/consumption/Microsoft.Azure.Management.Consumption
- sdk/containerinstance/Microsoft.Azure.Management.ContainerInstance
- sdk/containerregistry/Microsoft.Azure.Management.ContainerRegistry
- sdk/containerservice/Microsoft.Azure.Management.ContainerService
- sdk/cosmos-db/Microsoft.Azure.Management.CosmosDB
- sdk/cost-management/Microsoft.Azure.Management.CostManagement
- sdk/customer-insights/Microsoft.Azure.Management.CustomerInsights
- sdk/customproviders/Microsoft.Azure.Management.CustomProviders
- sdk/databox/Microsoft.Azure.Management.DataBox
- sdk/databoxedge/Microsoft.Azure.Management.DataBoxEdge
- sdk/datafactory/Microsoft.Azure.Management.DataFactory
- sdk/datalake-analytics/Microsoft.Azure.Management.DataLake.Analytics
- sdk/datalake-store/Microsoft.Azure.Management.DataLake.Store
- sdk/datamigration/Microsoft.Azure.Management.DataMigration
- sdk/datashare/Microsoft.Azure.Management.DataShare
- sdk/deploymentmanager/Microsoft.Azure.Management.DeploymentManager
- sdk/deviceprovisioningservices/Microsoft.Azure.Management.DeviceProvisioningServices
- sdk/devspaces/Microsoft.Azure.Management.DevSpaces
- sdk/devtestlabs/Microsoft.Azure.Management.DevTestLabs
- sdk/dns/Microsoft.Azure.Management.Dns
- sdk/edgegateway/Microsoft.Azure.Management.EdgeGateway
- sdk/eng/mgmt
- sdk/eventgrid/Microsoft.Azure.Management.EventGrid
- sdk/eventhub/Microsoft.Azure.Management.EventHub
- sdk/frontdoor/Microsoft.Azure.Management.FrontDoor
- sdk/guestconfiguration/Microsoft.Azure.Management.GuestConfiguration
- sdk/hdinsight/Microsoft.Azure.Management.HDInsight
- sdk/healthcareapis/Microsoft.Azure.Management.HealthcareApis
- sdk/hybridcompute/Microsoft.Azure.Management.HybridCompute
- sdk/hybriddatamanager/Microsoft.Azure.Management.HybridDataManager
- sdk/insights/Microsoft.Azure.Management.Insights
- sdk/iotcentral/Microsoft.Azure.Management.IotCentral
- sdk/iothub/Microsoft.Azure.Management.IotHub
- sdk/keyvault/Microsoft.Azure.Management.KeyVault
- sdk/kusto/Microsoft.Azure.Management.Kusto
- sdk/labservices/Microsoft.Azure.Management.LabServices
- sdk/locationbasedservices/Microsoft.Azure.Management.LocationBasedServices
- sdk/logic/Microsoft.Azure.Management.Logic
- sdk/machinelearning/Microsoft.Azure.Management.MachineLearning
- sdk/machinelearningcompute/Microsoft.Azure.Management.MachineLearningCompute
- sdk/maintenance/Microsoft.Azure.Management.Maintenance
- sdk/managednetwork/Microsoft.Azure.Management.ManagedNetwork
- sdk/managedserviceidentity/Microsoft.Azure.Management.ManagedServiceIdentity
- sdk/managedservices/Microsoft.Azure.Management.ManagedServices
- sdk/managementgroups/Microsoft.Azure.Management.ManagementGroups
- sdk/managementpartner/Microsoft.Azure.Management.ManagementPartner
- sdk/maps/Microsoft.Azure.Management.Maps
- sdk/marketplaceordering/Microsoft.Azure.Management.MarketplaceOrdering
- sdk/mediaservices/Microsoft.Azure.Management.Media
- sdk/mgmtcommon/AppAuthentication
- sdk/mgmtcommon/Auth
- sdk/mgmtcommon/ClientRuntime
- sdk/mgmtcommon/ClientRuntime.Azure
- sdk/mgmtcommon/ClientRuntime.Etw
- sdk/mgmtcommon/ClientRuntime.Log4Net
- sdk/mgmtcommon/Test
- sdk/mgmtcommon/TestFramework
- sdk/mixedreality/Microsoft.Azure.Management.MixedReality
- sdk/monitor/Microsoft.Azure.Management.Monitor
- sdk/netapp/Microsoft.Azure.Management.NetApp
- sdk/network/Microsoft.Azure.Management.Network
- sdk/notificationhubs/Microsoft.Azure.Management.NotificationHubs
- sdk/operationalinsights/Microsoft.Azure.Management.OperationalInsights
- sdk/peering/Microsoft.Azure.Management.Peering
- sdk/policyinsights/Microsoft.Azure.Management.PolicyInsights
- sdk/postgresql/Microsoft.Azure.Management.PostgreSQL
- sdk/powerbidedicated/Microsoft.Azure.Management.PowerBIDedicated
- sdk/privatedns/Microsoft.Azure.Management.PrivateDns
- sdk/recoveryservices/Microsoft.Azure.Management.RecoveryServices
- sdk/recoveryservices-backup/Microsoft.Azure.Management.RecoveryServices.Backup
- sdk/recoveryservices-siterecovery/Microsoft.Azure.Management.RecoveryServices.SiteRecovery
- sdk/redis/Microsoft.Azure.Management.RedisCache
- sdk/relay/Microsoft.Azure.Management.Relay
- sdk/reservations/Microsoft.Azure.Management.Reservations
- sdk/resourcegraph/Microsoft.Azure.Management.ResourceGraph
- sdk/resources/Microsoft.Azure.Management.Resource
- sdk/scheduler/Microsoft.Azure.Management.Scheduler
- sdk/search/Microsoft.Azure.Management.Search
- sdk/securitycenter/Microsoft.Azure.Management.SecurityCenter
- sdk/servermanagement/Microsoft.Azure.Management.ServerManagement
- sdk/servicebus/Microsoft.Azure.Management.ServiceBus
- sdk/servicefabric/Microsoft.Azure.Management.ServiceFabric
- sdk/signalr/Microsoft.Azure.Management.SignalR
- sdk/sqlmanagement/Microsoft.Azure.Management.SqlManagement
- sdk/sqlvirtualmachine/Microsoft.Azure.Management.SqlVirtualMachine
- sdk/storage/Microsoft.Azure.Management.Storage
- sdk/storagecache/Microsoft.Azure.Management.StorageCache
- sdk/storagesync/Microsoft.Azure.Management.StorageSync
- sdk/storsimple/Microsoft.Azure.Management.StorSimple
- sdk/storsimple8000series/Microsoft.Azure.Management.StorSimple8000Series
- sdk/streamanalytics/Microsoft.Azure.Management.StreamAnalytics
- sdk/subscription/Microsoft.Azure.Management.Subscription
- sdk/support/Microsoft.Azure.Management.Support
- sdk/trafficmanager/Microsoft.Azure.Management.TrafficManager
- sdk/websites/Microsoft.Azure.Management.WebSites
resources:
repositories:
- repository: azure-sdk-tools
type: github
name: Azure/azure-sdk-tools
endpoint: azure

- repository: azure-sdk-tools
type: github
name: Azure/azure-sdk-tools
endpoint: azure
variables:
DotNetCoreSDKVersion: '2.2.202'
skipComponentGovernanceDetection: true
msBuildLogDir: msbuildlogs
loggingArgs: '/clp:ShowtimeStamp /flp:LogFile=$(msBuildLogDir)/msbuild.normal.log;Verbosity=normal /flp1:Summary;Verbosity=minimal;LogFile=$(msBuildLogDir)/msbuild.sum.log /flp2:warningsonly;logfile=$(msBuildLogDir)/msbuild.wrn.log /flp3:errorsonly;logfile=$(msBuildLogDir)/msbuild.err.log'
RPScopeArgs: '/p:PullRequestNumber=$(system.pullrequest.pullrequestnumber) /p:RepoHtmlUrl=https://github.com/$(build.repository.id) /p:CIBuildId=$(OfficialBuildId)'
timeoutInMinutes: 120

jobs:
- template: templates/jobs/archetype-sdk-mgmt.yml
parameters:
Expand Down

0 comments on commit 6616b68

Please sign in to comment.