Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Virtual Hub : Create module #921

Merged
merged 14 commits into from
Feb 1, 2022
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
63 changes: 63 additions & 0 deletions .azuredevops/modulePipelines/ms.network.virtualHubs.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,63 @@
name: 'Network: Virtual Hubs'
AlexanderSehr marked this conversation as resolved.
Show resolved Hide resolved

parameters:
- name: removeDeployment
displayName: Remove deployed module
type: boolean
default: true
- name: versioningOption
displayName: The mode to handle the version increments [major|minor|patch]
type: string
default: patch
values:
- patch
- minor
- major
- name: customVersion
displayName: Custom version to apply. Used only if higher than latest
type: string
default: '0.0.1'

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/module.jobs.validate.yml

- stage: Deployment
displayName: Deployment tests
jobs:
- template: /.azuredevops/pipelineTemplates/module.jobs.deploy.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(), eq(variables['Build.SourceBranch'], 'refs/heads/main'))
jobs:
- template: /.azuredevops/pipelineTemplates/module.jobs.publish.yml
parameters:
versioningOption: '${{ parameters.versioningOption }}'
customVersion: '${{ parameters.customVersion }}'
3 changes: 3 additions & 0 deletions .azuredevops/platformPipelines/platform.dependencies.yml
Original file line number Diff line number Diff line change
Expand Up @@ -635,6 +635,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
144 changes: 144 additions & 0 deletions .github/workflows/ms.network.virtualHubs.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,144 @@
name: 'Network: Virtual Hubs'

on:
workflow_dispatch:
inputs:
removeDeployment:
type: boolean
description: 'Remove deployed module'
required: false
default: 'true'
versioningOption:
type: choice
description: 'The mode to handle the version increments [major|minor|patch]'
required: false
default: 'patch'
options:
- major
- minor
- patch
customVersion:
description: 'Custom version to apply. Used only if higher than latest'
required: false
default: '0.0.1'
push:
branches:
- main
paths:
- '.github/actions/templates/**'
- '.github/workflows/ms.network.virtualHubs.yml'
- 'arm/Microsoft.Network/virtualHubs/**'
- '!*/**/readme.md'

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 }}
versioningOption: ${{ steps.get-workflow-param.outputs.versioningOption }}
customVersion: ${{ steps.get-workflow-param.outputs.customVersion }}

####################
# 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: contains(fromJson('["refs/heads/main", "refs/heads/master"]'), github.ref)
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'
versioningOption: '${{ needs.job_set_workflow_param.outputs.versioningOption }}'
customVersion: '${{ needs.job_set_workflow_param.outputs.customVersion }}'
templateSpecsRGName: '${{ env.templateSpecsRGName }}'
templateSpecsRGLocation: '${{ env.templateSpecsRGLocation }}'
templateSpecsDescription: '${{ env.templateSpecsDescription }}'
templateSpecsDoPublish: '${{ env.templateSpecsDoPublish }}'
bicepRegistryName: '${{ env.bicepRegistryName }}'
bicepRegistryRGName: '${{ env.bicepRegistryRGName }}'
bicepRegistryDoPublish: '${{ env.bicepRegistryDoPublish }}'
8 changes: 7 additions & 1 deletion .github/workflows/platform.dependencies.yml
Original file line number Diff line number Diff line change
Expand Up @@ -472,7 +472,12 @@ jobs:
fail-fast: false
matrix:
parameterFilePaths:
['apgw.parameters.json', 'bas.parameters.json', 'lb.parameters.json', 'fw.parameters.json']
[
'apgw.parameters.json',
'bas.parameters.json',
'lb.parameters.json',
'fw.parameters.json',
]
steps:
- name: 'Checkout'
uses: actions/checkout@v2
Expand Down Expand Up @@ -890,6 +895,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 @@

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": "sxx-az-vHub-min-001"
AlexanderSehr marked this conversation as resolved.
Show resolved Hide resolved
},
"addressPrefix": {
"value": "10.0.0.0/16"
},
"virtualWanId": {
"value": "/subscriptions/<<subscriptionId>>/resourceGroups/validation-rg/providers/Microsoft.Network/virtualWans/sxx-az-vw-x-001"
MariusStorhaug marked this conversation as resolved.
Show resolved Hide resolved
}
}
}
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": "sxx-az-vHub-x-001"
AlexanderSehr marked this conversation as resolved.
Show resolved Hide resolved
},
"addressPrefix": {
"value": "10.1.0.0/16"
},
"virtualWanId": {
"value": "/subscriptions/<<subscriptionId>>/resourceGroups/validation-rg/providers/Microsoft.Network/virtualWans/sxx-az-vw-x-001"
MariusStorhaug marked this conversation as resolved.
Show resolved Hide resolved
},
"hubRouteTables": {
"value": [
{
"name": "routeTable1"
}
]
},
"hubVirtualNetworkConnections": {
"value": [
{
"name": "connection1",
"remoteVirtualNetworkId": "/subscriptions/<<subscriptionId>>/resourceGroups/validation-rg/providers/Microsoft.Network/virtualNetworks/adp-sxx-az-vnet-x-vHub",
AlexanderSehr marked this conversation as resolved.
Show resolved Hide resolved
"routingConfiguration": {
"associatedRouteTable": {
"id": "/subscriptions/<<subscriptionId>>/resourceGroups/validation-rg/providers/Microsoft.Network/virtualHubs/sxx-az-vHub-x-001/hubRouteTables/routeTable1"
MariusStorhaug marked this conversation as resolved.
Show resolved Hide resolved
},
"propagatedRouteTables": {
"ids": [
{
"id": "/subscriptions/<<subscriptionId>>/resourceGroups/validation-rg/providers/Microsoft.Network/virtualHubs/sxx-az-vHub-x-001/hubRouteTables/routeTable1"
MariusStorhaug marked this conversation as resolved.
Show resolved Hide resolved
}
],
"labels": [
"none"
]
}
}
}
]
}
}
}
Loading