Skip to content

Commit

Permalink
E2E test for vwan network connection (#201)
Browse files Browse the repository at this point in the history
* Add check for vWan NW connection

* test commit

* bogus commit

* remove bogus

* add vwan nwc step

* add missing ne to condition

* update condition to ensure that vwan gets deployed

* correct bicep file

* trigger vwan nwc

* Update conditions to include gitVwanNwcOUTPUT

* fix commandline

* remove trigger

* pin to v1.0.13 due to upstream bug

gaurav-nelson/github-action-markdown-link-check#127

* remove v for version

Co-authored-by: Jack Tracey <41163455+jtracey93@users.noreply.github.com>
  • Loading branch information
jfaurskov and jtracey93 committed Apr 20, 2022
1 parent 93a21b9 commit c6a76a0
Show file tree
Hide file tree
Showing 2 changed files with 26 additions and 8 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/code-review.yml
Expand Up @@ -53,7 +53,7 @@ jobs:
fetch-depth: 0

- name: Check links in markdown files
uses: gaurav-nelson/github-action-markdown-link-check@v1
uses: gaurav-nelson/github-action-markdown-link-check@1.0.13
with:
config-file: '.github/actions-config/mlc_config.json'
use-verbose-mode: 'yes'
Expand Down
32 changes: 25 additions & 7 deletions tests/pipelines/bicep-build-to-validate.yml
Expand Up @@ -64,6 +64,15 @@ jobs:
git_vwan=$(git diff --name-only HEAD^ HEAD infra-as-code/bicep/modules/vwanConnectivity/vwanConnectivity.bicep )
echo "##vso[task.setvariable variable=gitVwanOUTPUT]$git_vwan"
- task: Bash@3
displayName: Check for vwanNetwork Connection Changes
name: git_vwannetworkconnection_diff
inputs:
targetType: 'inline'
script: |
git_vwannwc=$(git diff --name-only HEAD^ HEAD infra-as-code/bicep/modules/vnetPeeringVwan ':(exclude)*.md' ':(exclude)*.png')
echo "##vso[task.setvariable variable=gitVwanNwcOUTPUT]$git_vwannwc"
- task: Bash@3
displayName: Check for spokeNetworking Changes
name: git_spokenetworking_diff
Expand All @@ -85,7 +94,7 @@ jobs:
- task: Bash@3
displayName: Az CLI Create Subscription for PR
name: create_subscription
condition: or(ne(variables['gitManagementOUTPUT'], ''), ne(variables['gitLoggingOUTPUT'], ''), ne(variables['gitSpokeOUTPUT'], ''), ne(variables['gitHubOUTPUT'], ''), ne(variables['gitVwanOUTPUT'], ''))
condition: or(ne(variables['gitManagementOUTPUT'], ''), ne(variables['gitLoggingOUTPUT'], ''), ne(variables['gitSpokeOUTPUT'], ''), ne(variables['gitHubOUTPUT'], ''), ne(variables['gitVwanOUTPUT'], ''), ne(variables['gitVwanNwcOUTPUT'], ''))
inputs:
targetType: 'inline'
script: |
Expand All @@ -97,7 +106,7 @@ jobs:
- task: Bash@3
displayName: Az CLI Refresh subscription list
name: refresh_subscription
condition: and(or(ne(variables['gitManagementOUTPUT'], ''), ne(variables['gitLoggingOUTPUT'], ''), ne(variables['gitSpokeOUTPUT'], ''), ne(variables['gitHubOUTPUT'], ''), ne(variables['gitVwanOUTPUT'], '')), ne(variables['subscriptionId'], ''))
condition: and(or(ne(variables['gitManagementOUTPUT'], ''), ne(variables['gitLoggingOUTPUT'], ''), ne(variables['gitSpokeOUTPUT'], ''), ne(variables['gitHubOUTPUT'], ''), ne(variables['gitVwanOUTPUT'], ''), ne(variables['gitVwanNwcOUTPUT'], '')), ne(variables['subscriptionId'], ''))
inputs:
targetType: 'inline'
script: |
Expand All @@ -106,7 +115,7 @@ jobs:
- task: Bash@3
displayName: Az CLI Create Resource Group for PR
name: create_rsg
condition: and(or(ne(variables['gitManagementOUTPUT'], ''), ne(variables['gitLoggingOUTPUT'], ''), ne(variables['gitSpokeOUTPUT'], ''), ne(variables['gitHubOUTPUT'], ''), ne(variables['gitVwanOUTPUT'], '')), ne(variables['subscriptionId'], ''))
condition: and(or(ne(variables['gitManagementOUTPUT'], ''), ne(variables['gitLoggingOUTPUT'], ''), ne(variables['gitSpokeOUTPUT'], ''), ne(variables['gitHubOUTPUT'], ''), ne(variables['gitVwanOUTPUT'], ''), ne(variables['gitVwanNwcOUTPUT'], '')), ne(variables['subscriptionId'], ''))
inputs:
targetType: 'inline'
script: |
Expand All @@ -119,7 +128,7 @@ jobs:
- task: Bash@3
displayName: Az CLI Deploy Management Groups for PR
name: create_mgs
condition: and(or(ne(variables['gitManagementOUTPUT'], ''), ne(variables['gitLoggingOUTPUT'], ''), ne(variables['gitSpokeOUTPUT'], ''), ne(variables['gitHubOUTPUT'], ''), ne(variables['gitVwanOUTPUT'], '')), ne(variables['subscriptionId'], ''))
condition: and(or(ne(variables['gitManagementOUTPUT'], ''), ne(variables['gitLoggingOUTPUT'], ''), ne(variables['gitSpokeOUTPUT'], ''), ne(variables['gitHubOUTPUT'], ''), ne(variables['gitVwanOUTPUT'], ''), ne(variables['gitVwanNwcOUTPUT'], '')), ne(variables['subscriptionId'], ''))
inputs:
targetType: 'inline'
script: |
Expand Down Expand Up @@ -155,7 +164,7 @@ jobs:
- task: Bash@3
displayName: Az CLI Subscription Placement for PR
name: move_sub
condition: and(or(ne(variables['gitManagementOUTPUT'], ''), ne(variables['gitLoggingOUTPUT'], ''), ne(variables['gitSpokeOUTPUT'], ''), ne(variables['gitHubOUTPUT'], ''), ne(variables['gitVwanOUTPUT'], '')), ne(variables['subscriptionId'], ''))
condition: and(or(ne(variables['gitManagementOUTPUT'], ''), ne(variables['gitLoggingOUTPUT'], ''), ne(variables['gitSpokeOUTPUT'], ''), ne(variables['gitHubOUTPUT'], ''), ne(variables['gitVwanOUTPUT'], ''), ne(variables['gitVwanNwcOUTPUT'], '')), ne(variables['subscriptionId'], ''))
inputs:
targetType: 'inline'
script: |
Expand Down Expand Up @@ -185,7 +194,7 @@ jobs:
- task: Bash@3
displayName: Az CLI Deploy vWan Networking for PR
name: create_vwan_network
condition: and(ne(variables['gitVwanOUTPUT'], ''), ne(variables['subscriptionId'], ''))
condition: and(or(ne(variables['gitVwanOUTPUT'], ''), ne(variables['gitVwanNwcOUTPUT'], '')), ne(variables['subscriptionId'], ''))
inputs:
targetType: 'inline'
script: |
Expand All @@ -194,12 +203,21 @@ jobs:
- task: Bash@3
displayName: Az CLI Deploy Spoke Networking for PR
name: create_spoke_network
condition: and(ne(variables['gitSpokeOUTPUT'], ''), ne(variables['subscriptionId'], ''))
condition: and(or(ne(variables['gitSpokeOUTPUT'], ''), ne(variables['gitVwanNwcOUTPUT'], '')), ne(variables['subscriptionId'], ''))
inputs:
targetType: 'inline'
script: |
az deployment group create --resource-group $(ResourceGroupName) --template-file infra-as-code/bicep/modules/spokeNetworking/spokeNetworking.bicep
- task: Bash@3
displayName: Az CLI Deploy vWan Network connection for PR
name: create_vwan_network_connection
condition: and(ne(variables['gitVwanNwcOUTPUT'], ''), ne(variables['subscriptionId'], ''))
inputs:
targetType: 'inline'
script: |
az deployment sub create --location $(Location) --template-file infra-as-code/bicep/modules/vnetPeeringVwan/vnetPeeringVwan.bicep --parameters @infra-as-code/bicep/modules/vnetPeeringVwan/vnetPeeringVwan.parameters.example.json parVirtualHubResourceId="/subscriptions/$(subscriptionId)/resourceGroups/$(ResourceGroupName)/providers/Microsoft.Network/virtualHubs/alz-vhub-$(Location)" parRemoteVirtualNetworkResourceId="/subscriptions/$(subscriptionId)/resourceGroups/$(ResourceGroupName)/providers/Microsoft.Network/virtualNetworks/vnet-spoke"
- job: bicep_cleanup
dependsOn: bicep_deploy
variables:
Expand Down

0 comments on commit c6a76a0

Please sign in to comment.