Skip to content

Latest python staging #23

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

Merged
merged 12 commits into from
Jul 1, 2025
Merged
Show file tree
Hide file tree
Changes from all 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
4 changes: 2 additions & 2 deletions .github/workflows/healthcheck-app-existingVnet-Lin-Thurs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,10 +15,10 @@ jobs:

steps:
- uses: actions/checkout@v3
- name: Set up Python 3.8
- name: Set up Python 3.13
uses: actions/setup-python@v4
with:
python-version: 3.8
python-version: '3.13'
- name: Install dependencies
run: |
python -m pip install --upgrade pip
Expand Down
5 changes: 3 additions & 2 deletions .github/workflows/healthcheck-app-existingVnet-Win-Tue.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
name: MATLAB Web App Server Ref Arch Azure Existing Virtual Network Health Check Test on Windows in West Eu

on:
workflow_dispatch:
schedule:
- cron: '0 16 * * 2'
jobs:
Expand All @@ -14,10 +15,10 @@ jobs:

steps:
- uses: actions/checkout@v3
- name: Set up Python 3.8
- name: Set up Python 3.13
uses: actions/setup-python@v4
with:
python-version: 3.8
python-version: '3.13'
- name: Install dependencies
run: |
python -m pip install --upgrade pip
Expand Down
5 changes: 3 additions & 2 deletions .github/workflows/healthcheck-app-newVnet-Lin-Wed.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
name: MATLAB Web App Server Ref Arch Azure Health Check Test on Linux in West US

on:
workflow_dispatch:
schedule:
- cron: '0 16 * * 3'
jobs:
Expand All @@ -13,10 +14,10 @@ jobs:

steps:
- uses: actions/checkout@v3
- name: Set up Python 3.8
- name: Set up Python 3.13
uses: actions/setup-python@v4
with:
python-version: 3.8
python-version: '3.13'
- name: Install dependencies
run: |
python -m pip install --upgrade pip
Expand Down
5 changes: 3 additions & 2 deletions .github/workflows/healthcheck-app-newVnet-Win-Mon.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
name: MATLAB Web App Server Ref Arch Azure Health Check Test on Windows in East US region

on:
workflow_dispatch:
push:
schedule:
- cron: '0 16 * * 1'
Expand All @@ -15,10 +16,10 @@ jobs:

steps:
- uses: actions/checkout@v3
- name: Set up Python 3.8
- name: Set up Python 3.13
uses: actions/setup-python@v4
with:
python-version: 3.8
python-version: '3.13'
- name: Install dependencies
run: |
python -m pip install --upgrade pip
Expand Down
22 changes: 14 additions & 8 deletions healthcheck/healthcheck_webapps_refarch.py
Original file line number Diff line number Diff line change
Expand Up @@ -35,12 +35,13 @@ def main(tenant_id_arg, client_id_arg, client_secret_arg, subscription_id_arg, u
resource_name_vnet = 'vnet_resource_group'
# Deploy a resource group with a virtual network and specified number of subnets
try:
subnet_name, vnet_name = DeployOp.create_vnet(credentials,
subnet_name_list, vnet_name = DeployOp.create_vnet(credentials,
subscription_id,
location,
subnets_cidr,
resource_name_vnet,
vnet_cidr)
subnet_name = subnet_name_list[0]
network_client = NetworkManagementClient(credentials, subscription_id)
# Add service endpoint to subnets
subnet = network_client.subnets.get(resource_name_vnet, vnet_name, subnet_name)
Expand All @@ -49,7 +50,7 @@ def main(tenant_id_arg, client_id_arg, client_secret_arg, subscription_id_arg, u
subnet.service_endpoints.append(
ServiceEndpointPropertiesFormat(service='Microsoft.Storage')
)
updated_subnet = network_client.subnets.create_or_update(
updated_subnet = network_client.subnets.begin_create_or_update(
resource_name_vnet,
vnet_name,
subnet_name,
Expand All @@ -73,7 +74,7 @@ def main(tenant_id_arg, client_id_arg, client_secret_arg, subscription_id_arg, u
"Deploy to New or Existing Virtual Network": "existing",
"Name of Virtual Network Where MATLAB Web App Server Will Be Deployed": vnet_name,
"Virtual Network CIDR Range": vnet_cidr,
"Name of Subnet for MATLAB Web App Server": subnet_name[0],
"Name of Subnet for MATLAB Web App Server": subnet_name,
"Server Subnet CIDR Range": subnets_cidr[0],
"Specify Private IP Address to VM Hosting MATLAB Web App Server": '10.1.0.4',
"Resource Group Name Of Virtual Network": resource_name_vnet,
Expand All @@ -84,7 +85,10 @@ def main(tenant_id_arg, client_id_arg, client_secret_arg, subscription_id_arg, u
res = requests.get(
f"https://github.com/mathworks-ref-arch/{ref_arch_name}/tree/main/releases/"
)
latest_releases = [re.findall("releases/(R\d{4}[ab]\\b)", res.text)[-1], re.findall("releases/(R\d{4}[ab]\\b)", res.text)[-2]]
latest_releases = [
re.findall(r"releases/(R\d{4}[ab]\b)", res.text)[-1],
re.findall(r"releases/(R\d{4}[ab]\b)", res.text)[-2]
]
for i in range(2):
matlab_release = latest_releases[i]
print("Testing Health Check Release: " + matlab_release + "\n")
Expand Down Expand Up @@ -114,15 +118,17 @@ def main(tenant_id_arg, client_id_arg, client_secret_arg, subscription_id_arg, u
print("Deleted the deployment which is deployed using existing virtual network:-",ct)
# Wait for above deployment deletion
time.sleep(900)
# Delete deployment with virtual network
DeployOp.delete_resourcegroup(credentials, subscription_id, resource_name_vnet)
ct = datetime.datetime.now()
print("Deleted the deployment which contains the virtual network:-",ct)
else:
# Delete the deployment
deployment_deletion = DeployOp.delete_resourcegroup(credentials, subscription_id, resource_group_name)
ct = datetime.datetime.now()
print("Date time after deployment and deletion of stack:-", ct)

if existingVPC=='true':
# Delete deployment with virtual network
DeployOp.delete_resourcegroup(credentials, subscription_id, resource_name_vnet)
ct = datetime.datetime.now()
print("Deleted the deployment which contains the virtual network:-", ct)

if __name__ == '__main__':
main(sys.argv[1], sys.argv[2], sys.argv[3], sys.argv[4], sys.argv[5], sys.argv[6], sys.argv[7], sys.argv[8], sys.argv[9], sys.argv[10], sys.argv[11], sys.argv[12])
17 changes: 9 additions & 8 deletions healthcheck/requirements.txt
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
azure-functions
azure-mgmt-resource==8.0.1
azure-mgmt-marketplaceordering==0.1.0
azure-mgmt-compute==4.6.2
azure-mgmt-network==10.2.0
azure-common==1.1.24
adal==1.2.2
msrestazure==0.6.2
azure-functions==1.23.0
azure-identity==1.23.0
azure-mgmt-resource==24.0.0
azure-mgmt-marketplaceordering==1.1.0
azure-mgmt-compute==34.1.0
azure-mgmt-network==29.0.0
azure-common==1.1.28
adal==1.2.7
msrestazure==0.6.4
4 changes: 2 additions & 2 deletions healthcheck/testtools/AzureAuthentication.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
from azure.common import credentials
from azure.common.credentials import ServicePrincipalCredentials
from msrestazure.azure_active_directory import AADTokenCredentials
from azure.identity import ClientSecretCredential
import adal

def authenticate_client_key(tenant_id, client_id, client_secret):
Expand All @@ -14,6 +14,6 @@ def authenticate_client_key(tenant_id, client_id, client_secret):

context = adal.AuthenticationContext(authority_uri, api_version=None)
mgmt_token = context.acquire_token_with_client_credentials(resource_uri, client_id, client_secret)
credentials = AADTokenCredentials(mgmt_token, client_id)
credentials = ClientSecretCredential(tenant_id, client_id, client_secret)

return credentials
41 changes: 22 additions & 19 deletions healthcheck/testtools/deploy.py
Original file line number Diff line number Diff line change
Expand Up @@ -43,10 +43,12 @@ def deploy_webapp_template(credentials,
print("Beginning the deployment... \n\n")
# Deploy template.

deployment = resource_client.deployments.create_or_update(
deployment = resource_client.deployments.begin_create_or_update(
resource_group_name,
f'{ref_arch_name}-deployment',
deployment_properties
{
"properties": deployment_properties
}
)

# Block because of VM quotas.
Expand All @@ -67,7 +69,7 @@ def create_vnet(credentials,
vnet_cidr):

resource_client = getResourceClient.get_resource_client(credentials, subscription_id)
vnet_name = 'my_vnet'
vnet_name = "my_vnet-" + str(uuid.uuid4())

# Create resource group
print("Creating a resource group with a virtual network... \n")
Expand All @@ -80,20 +82,19 @@ def create_vnet(credentials,
print("Resource group created...\n")

# Create virtual network
async_vnet_creation = network_client.virtual_networks.create_or_update(
resource_name_vnet,
vnet_name,
{
async_vnet_creation = network_client.virtual_networks.begin_create_or_update(
resource_group_name=resource_name_vnet,
virtual_network_name=vnet_name,
parameters={
'location': location,
'address_space': {
'address_prefixes': [vnet_cidr]
},
'location': location

}
}
)

# Wait for the virtual network creation
async_vnet_creation.wait()
# Wait for the virtual network creation to complete
async_vnet_creation.result()

print("Added a virtual network... \n")

Expand All @@ -104,12 +105,14 @@ def create_vnet(credentials,

# Create Subnet
subnet_name = "subnet_" + str(i) + "-" + str(uuid.uuid4())
async_subnet_creation = network_client.subnets.create_or_update(
resource_name_vnet,
vnet_name,
subnet_name,
{'address_prefix': subnets_cidr[i-1]}
)
async_subnet_creation = network_client.subnets.begin_create_or_update(
resource_group_name=resource_name_vnet,
virtual_network_name=vnet_name,
subnet_name=subnet_name,
subnet_parameters={
'address_prefix': subnets_cidr[i - 1]
}
)
subnet_info = async_subnet_creation.result()
# Add created subnet name to subnet_names array
subnet_names.append(subnet_info.name)
Expand All @@ -121,6 +124,6 @@ def create_vnet(credentials,
def delete_resourcegroup(credentials, subscription_id, resource_group_name) :
resource_client = getResourceClient.get_resource_client(credentials, subscription_id)
print("Deleting the deployment... \n\n")
deployment_deletion = resource_client.resource_groups.delete(resource_group_name)
deployment_deletion = resource_client.resource_groups.begin_delete(resource_group_name)
print(deployment_deletion)
#return deployment_deletion