Skip to content

Commit

Permalink
Virtual Hub : Create module (#921)
Browse files Browse the repository at this point in the history
* Virtual Hub : Create module (#910)

* Recovered original state + moved token replacement

* Update to latest

* Fixed ref

* Updated join path

* Minor fix

* Updated pipe

* Replaced task to use connection

* Update to latest

* Update to latest

* Minor update

* Update to latest

* Update to latest

* Update to latest

* Merged upstream

* Accounted for empty var

* Updated path handling

* Minor update

* Removed min parameter file from VM to avoid conflict

* Push updated Readme file(s)

* Updated ref

* Push updated Readme file(s)

* Updated removal ref

* Generated remaning pipelines

* Added also the Azure DevOps pipeline generation script & template

* Update to latest

* Update to latest

* Updating condition

* Update to latest

* Update to latest

* Update to latest

* Update to latest

* Cleanup

* Force failed deployment

* Update to latest

* Update to latest

* Regenerated pipelines

* Minor linter update

* Update to latest

* Removed deliberate error

* Update to latest

* Update to latest

* Update to latest

* Update to latest

* Update to latest

* Update to latest

* Update to latest

* Update to latest

* Update to latest

* Update to latest

* Update to latest

* Update to latest

* Update to latest

* Update to latest

* Update to latest

* Update to latest

* Update to latest

* Update to latest

* Update to latest

* Update to latest

* Update to latest

* initial version

* Update to latest

* Update to latest

* Update to latest

* Update to latest

* Update to latest

* Update to latest

* Update to latest

* Update to latest

* Update to latest

* Update to latest

* platform + wiki sync ADO pipelines

* updated naming

* Update to latest

* Update to latest

* Update to latest

* Update to latest

* Update to latest

* Update to latest

* Update to latest

* Update to latest

* Update to latest

* Update to latest

* Update to latest

* Update to latest

* Update to latest

* Update to latest

* Update to latest

* Update to latest

* Update to latest

* Update to latest

* Update to latest

* Update to latest

* Update to latest

* Update to latest

* Update to latest

* Minor docs fix

* Minor docs fix

* Update to latest

* Update to latest

* Update to latest

* Update to latest

* Update to latest

* Renamed gh variables

* Added space

* Updated parameters

* Cleanup

* Update to latest

* Removed owner

* Added readme descr

* Update to latest

* Update to latest

* Back latest draft

* Added route table & extended tests

* Added pipelines

* Updated docs

* Updated param

Co-authored-by: CARMLPipelinePrincipal <[email protected]>
Co-authored-by: Msanzdelrio <[email protected]>

* Added dedicated vnet deployment to vHub

* Update arm/Microsoft.Network/virtualHubs/.parameters/parameters.json

Co-authored-by: Erika Gressi <[email protected]>

* Update utilities/pipelines/dependencies/Microsoft.Network/virtualNetworks/parameters/7.virtualHubConnection.parameters.json

Co-authored-by: Erika Gressi <[email protected]>

* Update arm/Microsoft.Network/virtualHubs/.parameters/min.parameters.json

Co-authored-by: Erika Gressi <[email protected]>

* Update arm/Microsoft.Network/virtualHubs/.parameters/parameters.json

Co-authored-by: Erika Gressi <[email protected]>

* Added missing version files

* Updated pipelines to latest

* Update arm/Microsoft.Network/virtualHubs/deploy.bicep

Co-authored-by: Marius Storhaug <[email protected]>

* Update arm/Microsoft.Network/virtualHubs/readme.md

Co-authored-by: Marius Storhaug <[email protected]>

* Updated to token handling

Co-authored-by: CARMLPipelinePrincipal <[email protected]>
Co-authored-by: Msanzdelrio <[email protected]>
Co-authored-by: Erika Gressi <[email protected]>
Co-authored-by: Marius Storhaug <[email protected]>
  • Loading branch information
5 people authored Feb 1, 2022
1 parent c13d03b commit 57002fd
Show file tree
Hide file tree
Showing 19 changed files with 660 additions and 0 deletions.
52 changes: 52 additions & 0 deletions .azuredevops/modulePipelines/ms.network.virtualHubs.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
name: 'Network: Virtual Hubs'

parameters:
- name: removeDeployment
displayName: Remove deployed module
type: boolean
default: true
- name: prerelease
displayName: Publish prerelease module
type: boolean
default: false

trigger:
batch: true
branches:
include:
- main
paths:
include:
- '/.azuredevops/modulePipelines/ms.network.virtualHubs.yml'
- '/.azuredevops/pipelineTemplates/module.*.yml'
- '/arm/Microsoft.Network/virtualHubs/*'
exclude:
- '/**/*.md'

variables:
- template: '/.azuredevops/pipelineVariables/global.variables.yml'
- group: 'PLATFORM_VARIABLES'
- name: modulePath
value: '/arm/Microsoft.Network/virtualHubs'

stages:
- stage: Validation
displayName: Pester tests
jobs:
- template: /.azuredevops/pipelineTemplates/jobs.validateModulePester.yml

- stage: Deployment
displayName: Deployment tests
jobs:
- template: /.azuredevops/pipelineTemplates/jobs.validateModuleDeployment.yml
parameters:
removeDeployment: '${{ parameters.removeDeployment }}'
deploymentBlocks:
- path: $(modulePath)/.parameters/min.parameters.json
- path: $(modulePath)/.parameters/parameters.json

- stage: Publishing
displayName: Publish module
condition: and(succeeded(), or(eq(variables['Build.SourceBranch'], 'refs/heads/main'), eq(variables['Build.SourceBranch'], 'refs/heads/master'), eq('${{ parameters.prerelease }}', 'true')))
jobs:
- template: /.azuredevops/pipelineTemplates/jobs.publishModule.yml
3 changes: 3 additions & 0 deletions .azuredevops/platformPipelines/platform.dependencies.yml
Original file line number Diff line number Diff line change
Expand Up @@ -810,6 +810,9 @@ stages:
- path: $(dependencyPath)/$(resourceType)/parameters/5.aks.parameters.json
templateFilePath: $(templateFilePath)
displayName: AKS Virtual Network
- path: $(dependencyPath)/$(resourceType)/parameters/7.virtualHubConnection.parameters.json
templateFilePath: $(templateFilePath)
displayName: Virtual Hub Connection Virtual Network
- ${{ if eq( parameters.deploySqlMiDependencies, true) }}:
- path: $(dependencyPath)/$(resourceType)/parameters/6.sqlmi.parameters.json
templateFilePath: $(templateFilePath)
Expand Down
135 changes: 135 additions & 0 deletions .github/workflows/ms.network.virtualHubs.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,135 @@
name: 'Network: Virtual Hubs'

on:
workflow_dispatch:
inputs:
removeDeployment:
type: boolean
description: 'Remove deployed module'
required: false
default: 'true'
prerelease:
type: boolean
description: 'Publish prerelease module'
required: false
default: 'false'
push:
branches:
- main
paths:
- '.github/actions/templates/**'
- '.github/workflows/ms.network.virtualHubs.yml'
- 'arm/Microsoft.Network/virtualHubs/**'
- '!*/**/readme.md'
- 'utilities/pipelines/**'
- '!utilities/pipelines/dependencies/**'

env:
modulePath: 'arm/Microsoft.Network/virtualHubs'
workflowPath: '.github/workflows/ms.network.virtualHubs.yml'
AZURE_CREDENTIALS: ${{ secrets.AZURE_CREDENTIALS }}
ARM_SUBSCRIPTION_ID: '${{ secrets.ARM_SUBSCRIPTION_ID }}'
ARM_MGMTGROUP_ID: '${{ secrets.ARM_MGMTGROUP_ID }}'
ARM_TENANT_ID: '${{ secrets.ARM_TENANT_ID }}'
DEPLOYMENT_SP_ID: '${{ secrets.DEPLOYMENT_SP_ID }}'

jobs:
############################
# SET INPUT PARAMETERS #
############################
job_set_workflow_param:
runs-on: ubuntu-20.04
name: 'Set input parameters to output variables'
steps:
- name: 'Checkout'
uses: actions/checkout@v2
with:
fetch-depth: 0
- name: 'Set input parameters'
id: get-workflow-param
uses: ./.github/actions/templates/getWorkflowInput
with:
workflowPath: '${{ env.workflowPath}}'
outputs:
removeDeployment: ${{ steps.get-workflow-param.outputs.removeDeployment }}

####################
# Pester Tests #
####################
job_module_pester_validation:
runs-on: ubuntu-20.04
name: 'Pester tests'
steps:
- name: 'Checkout'
uses: actions/checkout@v2
with:
fetch-depth: 0
- name: 'Run tests'
uses: ./.github/actions/templates/validateModulePester
with:
modulePath: '${{ env.modulePath }}'

####################
# Deployment tests #
####################
job_module_deploy_validation:
runs-on: ubuntu-20.04
name: 'Deployment tests'
needs:
- job_set_workflow_param
- job_module_pester_validation
strategy:
fail-fast: false
matrix:
parameterFilePaths: ['min.parameters.json', 'parameters.json']
steps:
- name: 'Checkout'
uses: actions/checkout@v2
with:
fetch-depth: 0
- name: Set environment variables
uses: deep-mm/[email protected]
with:
variableFileName: 'global.variables'
- name: 'Using parameter file [${{ matrix.parameterFilePaths }}]'
uses: ./.github/actions/templates/validateModuleDeployment
with:
templateFilePath: '${{ env.modulePath }}/deploy.bicep'
parameterFilePath: '${{ env.modulePath }}/.parameters/${{ matrix.parameterFilePaths }}'
location: '${{ env.defaultLocation }}'
resourceGroupName: '${{ env.resourceGroupName }}'
subscriptionId: '${{ secrets.ARM_SUBSCRIPTION_ID }}'
managementGroupId: '${{ secrets.ARM_MGMTGROUP_ID }}'
removeDeployment: '${{ needs.job_set_workflow_param.outputs.removeDeployment }}'

###############
# PUBLISH #
###############
job_publish_module:
name: 'Publish module'
if: github.ref == 'refs/heads/main' || github.ref == 'refs/heads/master' || github.event.inputs.prerelease == 'true'
runs-on: ubuntu-20.04
needs:
- job_set_workflow_param
- job_module_deploy_validation
steps:
- name: 'Checkout'
uses: actions/checkout@v2
with:
fetch-depth: 0
- name: Set environment variables
uses: deep-mm/[email protected]
with:
variableFileName: 'global.variables'
- name: 'Publish module'
uses: ./.github/actions/templates/publishModule
with:
templateFilePath: '${{ env.modulePath }}/deploy.bicep'
templateSpecsRGName: '${{ env.templateSpecsRGName }}'
templateSpecsRGLocation: '${{ env.templateSpecsRGLocation }}'
templateSpecsDescription: '${{ env.templateSpecsDescription }}'
templateSpecsDoPublish: '${{ env.templateSpecsDoPublish }}'
bicepRegistryName: '${{ env.bicepRegistryName }}'
bicepRegistryRGName: '${{ env.bicepRegistryRGName }}'
bicepRegistryRgLocation: '${{ env.bicepRegistryRgLocation }}'
bicepRegistryDoPublish: '${{ env.bicepRegistryDoPublish }}'
1 change: 1 addition & 0 deletions .github/workflows/platform.dependencies.yml
Original file line number Diff line number Diff line change
Expand Up @@ -1096,6 +1096,7 @@ jobs:
'3.vnetpeer02.parameters.json',
'4.azfw.parameters.json',
'5.aks.parameters.json',
'7.virtualHubConnection.parameters.json',
'parameters.json',
]
steps:
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@

15 changes: 15 additions & 0 deletions arm/Microsoft.Network/virtualHubs/.parameters/min.parameters.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
{
"$schema": "https://schema.management.azure.com/schemas/2019-04-01/deploymentParameters.json#",
"contentVersion": "1.0.0.0",
"parameters": {
"name": {
"value": "<<namePrefix>>-az-vhub-min-001"
},
"addressPrefix": {
"value": "10.0.0.0/16"
},
"virtualWanId": {
"value": "/subscriptions/<<subscriptionId>>/resourceGroups/validation-rg/providers/Microsoft.Network/virtualWans/<<namePrefix>>-az-vw-x-001"
}
}
}
45 changes: 45 additions & 0 deletions arm/Microsoft.Network/virtualHubs/.parameters/parameters.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
{
"$schema": "https://schema.management.azure.com/schemas/2019-04-01/deploymentParameters.json#",
"contentVersion": "1.0.0.0",
"parameters": {
"name": {
"value": "<<namePrefix>>-az-vhub-x-001"
},
"addressPrefix": {
"value": "10.1.0.0/16"
},
"virtualWanId": {
"value": "/subscriptions/<<subscriptionId>>/resourceGroups/validation-rg/providers/Microsoft.Network/virtualWans/<<namePrefix>>-az-vw-x-001"
},
"hubRouteTables": {
"value": [
{
"name": "routeTable1"
}
]
},
"hubVirtualNetworkConnections": {
"value": [
{
"name": "connection1",
"remoteVirtualNetworkId": "/subscriptions/<<subscriptionId>>/resourceGroups/validation-rg/providers/Microsoft.Network/virtualNetworks/adp-<<namePrefix>>-az-vnet-x-vhub",
"routingConfiguration": {
"associatedRouteTable": {
"id": "/subscriptions/<<subscriptionId>>/resourceGroups/validation-rg/providers/Microsoft.Network/virtualHubs/<<namePrefix>>-az-vHub-x-001/hubRouteTables/routeTable1"
},
"propagatedRouteTables": {
"ids": [
{
"id": "/subscriptions/<<subscriptionId>>/resourceGroups/validation-rg/providers/Microsoft.Network/virtualHubs/<<namePrefix>>-az-vHub-x-001/hubRouteTables/routeTable1"
}
],
"labels": [
"none"
]
}
}
}
]
}
}
}
Loading

0 comments on commit 57002fd

Please sign in to comment.