Merge pull request #317 from Azure/asset-build-changes

Azure IPAM v3.5.0 Release
This commit is contained in:
DCMattyG 2024-09-03 00:14:39 -07:00 коммит произвёл GitHub
Родитель 4919aebf53 5b8c412631
Коммит f322187194
Не найден ключ, соответствующий данной подписи
Идентификатор ключа GPG: B5690EEEBB952194
23 изменённых файлов: 1125 добавлений и 777 удалений

62
.github/workflows/azure-ipam-assets.yml поставляемый Normal file
Просмотреть файл

@ -0,0 +1,62 @@
name: Azure IPAM Release Assets
run-name: Azure IPAM Assets Build & Upload
on:
release:
types: [ published ]
permissions:
contents: write
jobs:
assets:
name: Build & Upload Asset Files to Release
runs-on: ubuntu-latest
steps:
- run: echo "Job triggered by a ${{ github.event_name }} event."
- run: echo "Release Tag - ${{ github.event.release.tag_name }}."
- name: "Setup NodeJS v18"
id: setupNode
uses: actions/setup-node@v4
with:
node-version: 18
- name: "Setup Python v3.9"
id: setupPython
uses: actions/setup-python@v5
with:
python-version: '3.9'
- name: Checkout Azure IPAM Code
uses: actions/checkout@v4
- name: Install NPM Packages
id: installNpmPackages
working-directory: ui
run: |
npm ci
- name: Install PIP Packages
id: installPipPackages
working-directory: engine
run: |
pip install -r requirements.lock.txt --progress-bar off
- name: "Create Azure IPAM ZIP Asset"
id: buildZipAsset
working-directory: tools
shell: pwsh
run: |
New-Item -ItemType Directory -Name ../assets/ -Force
./build.ps1 -Path ../assets/
- name: Upload Azure IPAM Release Asset
id: uploadReleaseAsset
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
tagName: ${{ github.event.release.tag_name }}
assetPath: ./assets/ipam.zip
run: |
gh release upload "$tagName" "$assetPath"

164
.github/workflows/azure-ipam-build.yml поставляемый
Просмотреть файл

@ -1,167 +1,40 @@
name: Azure IPAM Build
run-name: Azure IPAM Production Build & Release
run-name: Azure IPAM Container Build
on:
push:
branches:
- main
release:
types: [ published ]
permissions:
id-token: write
contents: write
pull-requests: read
env:
ACR_NAME: ${{ vars.IPAM_PROD_ACR }}
jobs:
version:
name: Update Azure IPAM Version
init:
name: Initialize Azure IPAM Build
runs-on: ubuntu-latest
outputs:
ipamVersion: ${{ steps.updateVersion.outputs.ipamVersion }}
prNumber: ${{ fromJson(steps.getPullRequestData.outputs.result).number }}
commitHash: ${{ steps.commitCode.outputs.commitHash }}
ipamVersion: ${{ steps.extractVersion.outputs.ipamVersion }}
steps:
- run: echo "Job triggered by a ${{ github.event_name }} event to main."
- run: echo "Job triggered by a ${{ github.event_name }} event."
- run: echo "Release Tag - ${{ github.event.release.tag_name }}."
- name: "Setup NodeJS v18"
id: setupNode
uses: actions/setup-node@v4
with:
node-version: 18
- name: "Setup Python v3.9"
id: setupPython
uses: actions/setup-python@v5
with:
python-version: '3.9'
- name: "Extract Pull Request Details"
id: getPullRequestData
uses: actions/github-script@v7
with:
script: |
return (
await github.rest.repos.listPullRequestsAssociatedWithCommit({
commit_sha: context.sha,
owner: context.repo.owner,
repo: context.repo.repo,
})
).data[0];
- name: Checkout Azure IPAM Code
uses: actions/checkout@v4
with:
token: ${{ secrets.PAT_TOKEN }}
- name: Configure Git
id: configureGit
run: |
git config --global user.name "IPAM GitHub Actions"
git config --global user.email "ipam-actions@users.noreply.github.com"
- name: "Increment Azure IPAM Version"
id: updateVersion
working-directory: tools
- name: Extract IPAM Version
id: extractVersion
env:
prBody: ${{ fromJson(steps.getPullRequestData.outputs.result).body }}
releaseTag: ${{ github.event.release.tag_name }}
shell: pwsh
run: |
$version = [regex]::matches($env:prBody, '(?<=\[version:).*(?=])').value
$major = $env:prBody -match '(?<=\[)major(?=])'
$minor = $env:prBody -match '(?<=\[)minor(?=])'
$build = $env:prBody -match '(?<=\[)build(?=])'
try {
$version = [System.Version]$version
$newVersion = "{0}.{1}.{2}" -f $version.Major, $version.Minor, $version.Build
} catch {
$version = $null
}
if ($version) {
./version.ps1 -Version $newVersion
} elseif ($major) {
./version.ps1 -BumpMajor
} elseif ($minor) {
./version.ps1 -BumpMinor
} else {
./version.ps1 -BumpBuild
}
- name: Install NPM Packages
id: installNpmPackages
working-directory: ui
run: |
npm install
- name: Install PIP Packages
id: installPipPackages
working-directory: engine
run: |
pip install -r requirements.txt
- name: Freeze PIP Packages
id: freezePipPackages
working-directory: engine
run: |
echo "# Dependencies for Azure IPAM v${{ steps.updateVersion.outputs.ipamVersion }}" > requirements.lock.txt
pip freeze >> requirements.lock.txt
- name: "Create Azure IPAM ZIP Asset"
id: buildZipAsset
working-directory: tools
shell: pwsh
run: |
./build.ps1 -Path ../assets/
- name: Commit Updated Azure IPAM Code
id: commitCode
env:
prNumber: ${{ fromJson(steps.getPullRequestData.outputs.result).number }}
run: |
git commit -a -m "Updated Azure IPAM Version to v${{ steps.updateVersion.outputs.ipamVersion }} [skip ci]"
git push
echo "commitHash=$(git rev-parse HEAD)" >> $GITHUB_OUTPUT
release:
name: Create Azure IPAM Release
runs-on: ubuntu-latest
needs: [ version ]
steps:
- name: Checkout Azure IPAM Code
uses: actions/checkout@v4
with:
ref: ${{ needs.version.outputs.commitHash }}
sparse-checkout: |
assets
- name: Publish Azure IPAM Release
id: publishRelease
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
tagName: v${{ needs.version.outputs.ipamVersion }}
run: |
gh release create "$tagName" \
--repo="$GITHUB_REPOSITORY" \
--title="$tagName" \
--notes "Azure IPAM Release"
- name: Upload Azure IPAM Release Asset
id: uploadReleaseAsset
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
tagName: v${{ needs.version.outputs.ipamVersion }}
assetPath: ./assets/ipam.zip
run: |
gh release upload "$tagName" "$assetPath"
$version = $env:releaseTag -replace "v", ""
Write-Output "ipamVersion=$version" >> $Env:GITHUB_OUTPUT
build:
name: Build Azure IPAM Containers
runs-on: ubuntu-latest
needs: [ version, release ]
needs: [ init ]
steps:
- name: Azure Login
uses: azure/login@v2
@ -174,15 +47,13 @@ jobs:
- name: Checkout Azure IPAM Code
uses: actions/checkout@v4
with:
ref: ${{ needs.version.outputs.commitHash }}
sparse-checkout: |
engine
ui
lb
- name: Build Azure IPAM Containers
env:
IPAM_VERSION: ${{ needs.version.outputs.ipamVersion }}
IPAM_VERSION: ${{ needs.init.outputs.ipamVersion }}
run: |
az acr build -r $ACR_NAME -t ipam:$IPAM_VERSION -t ipam:latest -f ./Dockerfile.deb .
az acr build -r $ACR_NAME -t ipamfunc:$IPAM_VERSION -t ipamfunc:latest -f ./Dockerfile.func .
@ -190,7 +61,7 @@ jobs:
build-legacy:
name: Build Legacy Azure IPAM Containers
runs-on: ubuntu-latest
needs: [ version, release ]
needs: [ init ]
steps:
- name: Azure Login
uses: azure/login@v2
@ -203,7 +74,6 @@ jobs:
- name: Checkout Azure IPAM Code
uses: actions/checkout@v4
with:
ref: ${{ needs.version.outputs.commitHash }}
sparse-checkout: |
engine
ui
@ -211,7 +81,7 @@ jobs:
- name: Build Legacy Azure IPAM Containers
env:
IPAM_VERSION: ${{ needs.version.outputs.ipamVersion }}
IPAM_VERSION: ${{ needs.init.outputs.ipamVersion }}
run: |
az acr build -r $ACR_NAME -t ipam-engine:$IPAM_VERSION -t ipam-engine:latest -f ./engine/Dockerfile.deb ./engine
az acr build -r $ACR_NAME -t ipam-func:$IPAM_VERSION -t ipam-func:latest -f ./engine/Dockerfile.func ./engine

127
.github/workflows/azure-ipam-version.yml поставляемый Normal file
Просмотреть файл

@ -0,0 +1,127 @@
name: Azure IPAM Version
run-name: Azure IPAM Version & Release
on:
push:
branches:
- main
permissions:
id-token: write
contents: write
pull-requests: read
jobs:
version:
name: Update Azure IPAM Version
runs-on: ubuntu-latest
outputs:
ipamVersion: ${{ steps.updateVersion.outputs.ipamVersion }}
prNumber: ${{ fromJson(steps.getPullRequestData.outputs.result).number }}
commitHash: ${{ steps.commitCode.outputs.commitHash }}
steps:
- run: echo "Job triggered by a ${{ github.event_name }} event to main."
- name: "Setup NodeJS v18"
id: setupNode
uses: actions/setup-node@v4
with:
node-version: 18
- name: "Setup Python v3.9"
id: setupPython
uses: actions/setup-python@v5
with:
python-version: '3.9'
- name: "Extract Pull Request Details"
id: getPullRequestData
uses: actions/github-script@v7
with:
script: |
return (
await github.rest.repos.listPullRequestsAssociatedWithCommit({
commit_sha: context.sha,
owner: context.repo.owner,
repo: context.repo.repo,
})
).data[0];
- name: Checkout Azure IPAM Code
uses: actions/checkout@v4
with:
token: ${{ secrets.PAT_TOKEN }}
- name: Configure Git
id: configureGit
run: |
git config --global user.name "IPAM GitHub Actions"
git config --global user.email "ipam-actions@users.noreply.github.com"
- name: "Increment Azure IPAM Version"
id: updateVersion
working-directory: tools
env:
prBody: ${{ fromJson(steps.getPullRequestData.outputs.result).body }}
shell: pwsh
run: |
$version = [regex]::matches($env:prBody, '(?<=\[version:).*(?=])').value
$major = $env:prBody -match '(?<=\[)major(?=])'
$minor = $env:prBody -match '(?<=\[)minor(?=])'
$build = $env:prBody -match '(?<=\[)build(?=])'
try {
$version = [System.Version]$version
$newVersion = "{0}.{1}.{2}" -f $version.Major, $version.Minor, $version.Build
} catch {
$version = $null
}
if ($version) {
./version.ps1 -Version $newVersion
} elseif ($major) {
./version.ps1 -BumpMajor
} elseif ($minor) {
./version.ps1 -BumpMinor
} else {
./version.ps1 -BumpBuild
}
- name: Install PIP Packages
id: installPipPackages
working-directory: engine
run: |
pip install -r requirements.txt --progress-bar off
- name: Freeze PIP Packages
id: freezePipPackages
working-directory: engine
run: |
echo "# Dependencies for Azure IPAM v${{ steps.updateVersion.outputs.ipamVersion }}" > requirements.lock.txt
pip freeze >> requirements.lock.txt
- name: Commit Updated Azure IPAM Code
id: commitCode
env:
prNumber: ${{ fromJson(steps.getPullRequestData.outputs.result).number }}
run: |
git commit -a -m "Updated Azure IPAM Version to v${{ steps.updateVersion.outputs.ipamVersion }} [skip ci]"
git push
echo "commitHash=$(git rev-parse HEAD)" >> $GITHUB_OUTPUT
release:
name: Create Azure IPAM Release
runs-on: ubuntu-latest
needs: [ version ]
steps:
- name: Publish Azure IPAM Release
id: publishRelease
env:
GITHUB_TOKEN: ${{ secrets.PAT_TOKEN }}
tagName: v${{ needs.version.outputs.ipamVersion }}
run: |
gh release create "$tagName" \
--repo="$GITHUB_REPOSITORY" \
--title="$tagName" \
--notes "Azure IPAM Release"

1
.gitignore поставляемый
Просмотреть файл

@ -7,6 +7,7 @@
NOTES.md
TODO.md
/logs
/assets
# IPAM UI
.eslintcache

Просмотреть файл

@ -58,7 +58,7 @@ COPY ./engine/requirements.lock.txt /code/requirements.lock.txt
RUN pip install --upgrade pip --progress-bar off
# Install Dependencies
RUN pip install --no-cache-dir --upgrade -r /code/requirements.lock.txt --progress-bar off
RUN pip install --no-cache-dir -r /code/requirements.lock.txt --progress-bar off
# Copy Engine Code
COPY ./engine/app ./app

Просмотреть файл

@ -37,7 +37,7 @@ COPY ./engine/requirements.lock.txt .
RUN pip install --upgrade pip --progress-bar off
# Install Dependencies
RUN pip install --no-cache-dir --upgrade -r ./requirements.lock.txt --progress-bar off
RUN pip install --no-cache-dir -r ./requirements.lock.txt --progress-bar off
# Copy Application Code to Function App Root Directory
COPY ./engine/. /home/site/wwwroot

Просмотреть файл

@ -68,7 +68,7 @@ COPY ./engine/requirements.lock.txt /code/requirements.lock.txt
RUN pip install --upgrade pip --progress-bar off
# Install Dependencies
RUN pip install --no-cache-dir --upgrade -r /code/requirements.lock.txt --progress-bar off
RUN pip install --no-cache-dir -r /code/requirements.lock.txt --progress-bar off
# Copy Engine Code
COPY ./engine/app ./app

Двоичные данные
assets/ipam.zip

Двоичный файл не отображается.

Просмотреть файл

@ -6,8 +6,12 @@
# Set minimum version requirements
#Requires -Version 7.2
#Requires -Modules @{ ModuleName="Az"; ModuleVersion="10.3.0"}
#Requires -Modules @{ ModuleName="Microsoft.Graph"; ModuleVersion="2.0.0"}
#Requires -Modules @{ ModuleName="Az.Accounts"; ModuleVersion="2.13.0"}
#Requires -Modules @{ ModuleName="Az.Functions"; ModuleVersion="4.0.6"}
#Requires -Modules @{ ModuleName="Az.Resources"; ModuleVersion="6.10.0"}
#Requires -Modules @{ ModuleName="Az.Websites"; ModuleVersion="3.1.1"}
#Requires -Modules @{ ModuleName="Microsoft.Graph.Authentication"; ModuleVersion="2.0.0"}
#Requires -Modules @{ ModuleName="Microsoft.Graph.Identity.SignIns"; ModuleVersion="2.0.0"}
# Intake and set global parameters
[CmdletBinding(DefaultParameterSetName = 'AppContainer')]
@ -194,19 +198,40 @@ param(
Mandatory = $false,
ParameterSetName = 'FunctionContainer')]
[ValidateScript({
if(-Not ($_ | Test-Path) ){
if(-Not ($_ | Test-Path) ) {
throw [System.ArgumentException]::New("Target file or does not exist.")
}
if(-Not ($_ | Test-Path -PathType Leaf) ){
if(-Not ($_ | Test-Path -PathType Leaf) ) {
throw [System.ArgumentException]::New("The 'ParameterFile' argument must be a file, folder paths are not allowed.")
}
if($_ -notmatch "(\.json)"){
if($_ -notmatch "(\.json)") {
throw [System.ArgumentException]::New("The file specified in the 'ParameterFile' argument must be of type json.")
}
return $true
})]
[System.IO.FileInfo]
$ParameterFile
$ParameterFile,
[Parameter(ValueFromPipelineByPropertyName = $true,
Mandatory = $false,
ParameterSetName = 'App')]
[Parameter(ValueFromPipelineByPropertyName = $true,
Mandatory = $false,
ParameterSetName = 'Function')]
[ValidateScript({
if(-Not ($_ | Test-Path) ) {
throw [System.ArgumentException]::New("Target file or does not exist.")
}
if(-Not ($_ | Test-Path -PathType Leaf) ) {
throw [System.ArgumentException]::New("The 'ZipFilePath' argument must be a file, folder paths are not allowed.")
}
if($_ -notmatch "(\.zip)") {
throw [System.ArgumentException]::New("The file specified in the 'ZipFilePath' argument must be of type zip.")
}
return $true
})]
[System.IO.FileInfo]
$ZipFilePath
)
DynamicParam {
@ -354,6 +379,11 @@ process {
$containerBuildError = $false
$deploymentSuccess = $false
$GitHubUserName = 'Azure'
$GitHubRepoName = 'ipam'
$ZipFileName = 'ipam.zip'
$TempFolderObj = $null
Start-Transcript -Path $transcriptLog | Out-Null
Function Test-Location {
@ -664,8 +694,9 @@ process {
$accesstoken = (Get-AzAccessToken -Resource "https://$($msGraphMap[$AzureCloud].Endpoint)/").Token
# Switch Access Token to SecureString if Graph Version is 2.x
$graphVersion = [System.Version](Get-InstalledModule -Name Microsoft.Graph | Sort-Object -Property Version | Select-Object -Last 1).Version `
?? (Get-Module -Name Microsoft.Graph | Sort-Object -Property Version | Select-Object -Last 1).Version
$graphVersion = [System.Version](Get-InstalledModule -Name Microsoft.Graph -ErrorAction SilentlyContinue | Sort-Object -Property Version | Select-Object -Last 1).Version `
?? (Get-Module -Name Microsoft.Graph -ErrorAction SilentlyContinue | Sort-Object -Property Version | Select-Object -Last 1).Version `
?? (Get-Module -Name Microsoft.Graph -ListAvailable -ErrorAction SilentlyContinue | Sort-Object -Property Version | Select-Object -Last 1).Version
if ($graphVersion.Major -gt 1) {
$accesstoken = ConvertTo-SecureString $accesstoken -AsPlainText -Force
@ -894,12 +925,51 @@ process {
return $deployment
}
Function Get-ZipFile {
Param(
[Parameter(Mandatory=$true)]
[string]$GitHubUserName,
[Parameter(Mandatory=$true)]
[string]$GitHubRepoName,
[Parameter(Mandatory=$true)]
[string]$ZipFileName,
[Parameter(Mandatory=$true)]
[System.IO.DirectoryInfo]$AssetFolder
)
$ZipFilePath = Join-Path -Path $AssetFolder.FullName -ChildPath $ZipFileName
try {
$GitHubURL = "https://api.github.com/repos/$GitHubUserName/$GitHubRepoName/releases/latest"
Write-Host "INFO: Target GitHub Repo is " -ForegroundColor Green -NoNewline
Write-Host "$GitHubUserName/$GitHubRepoName" -ForegroundColor Cyan
Write-Host "INFO: Fetching download URL..." -ForegroundColor Green
$GHResponse = Invoke-WebRequest -Method GET -Uri $GitHubURL
$JSONResponse = $GHResponse.Content | ConvertFrom-Json
$AssetList = $JSONResponse.assets
$Asset = $AssetList | Where-Object { $_.name -eq $ZipFileName }
$DownloadURL = $Asset.browser_download_url
Write-Host "INFO: Downloading ZIP Archive to " -ForegroundColor Green -NoNewline
Write-Host $ZipFilePath -ForegroundColor Cyan
Invoke-WebRequest -Uri $DownloadURL -OutFile $ZipFilePath
} catch {
Write-Host "ERROR: Unable to download ZIP Deploy archive!" -ForegroundColor Red
throw $_
}
}
Function Publish-ZipFile {
Param(
[Parameter(Mandatory=$true)]
[string]$AppName,
[Parameter(Mandatory=$true)]
[string]$ResourceGroupName,
[Parameter(Mandatory=$true)]
[System.IO.FileInfo]$ZipFilePath,
[Parameter(Mandatory=$false)]
[switch]$UseAPI
)
@ -908,14 +978,12 @@ process {
Write-Host "INFO: Using Kudu API for ZIP Deploy" -ForegroundColor Green
}
$zipPath = Join-Path -Path $ROOT_DIR -ChildPath 'assets' -AdditionalChildPath "ipam.zip"
$publishRetries = 3
$publishSuccess = $False
if ($UseAPI) {
$accessToken = (Get-AzAccessToken).Token
$zipContents = Get-Item -Path $zipPath
$zipContents = Get-Item -Path $ZipFilePath
$publishProfile = Get-AzWebAppPublishingProfile -Name $AppName -ResourceGroupName $ResourceGroupName
$zipUrl = ([System.uri]($publishProfile | Select-Xml -XPath "//publishProfile[@publishMethod='ZipDeploy']" | Select-Object -ExpandProperty Node).publishUrl).Scheme
@ -927,7 +995,7 @@ process {
Publish-AzWebApp `
-Name $AppName `
-ResourceGroupName $ResourceGroupName `
-ArchivePath $zipPath `
-ArchivePath $ZipFilePath `
-Restart `
-Force `
| Out-Null
@ -1103,13 +1171,40 @@ process {
}
if ($PSCmdlet.ParameterSetName -in ('App', 'Function')) {
if (-Not $ZipFilePath) {
try {
# Create a temporary folder path
$TempFolder = Join-Path -Path TEMP:\ -ChildPath $(New-Guid)
# Create directory if not exists
$script:TempFolderObj = New-Item -ItemType Directory -Path $TempFolder -Force
} catch {
Write-Host "ERROR: Unable to create temp directory to store ZIP archive!" -ForegroundColor Red
throw $_
}
Write-Host "INFO: Fetching latest ZIP Deploy archive..." -ForegroundColor Green
Get-ZipFile -GitHubUserName $GitHubUserName -GitHubRepoName $GitHubRepoName -ZipFileName $ZipFileName -AssetFolder $TempFolderObj
$script:ZipFilePath = Join-Path -Path $TempFolderObj.FullName -ChildPath $ZipFileName
} else {
$script:ZipFilePath = Get-Item -Path $ZipFilePath
}
Write-Host "INFO: Uploading ZIP Deploy archive..." -ForegroundColor Green
try {
Publish-ZipFile -AppName $deployment.Outputs["appServiceName"].Value -ResourceGroupName $deployment.Outputs["resourceGroupName"].Value
Publish-ZipFile -AppName $deployment.Outputs["appServiceName"].Value -ResourceGroupName $deployment.Outputs["resourceGroupName"].Value -ZipFilePath $ZipFilePath
} catch {
Write-Host "SWITCH: Retrying ZIP Deploy with Kudu API..." -ForegroundColor Blue
Publish-ZipFile -AppName $deployment.Outputs["appServiceName"].Value -ResourceGroupName $deployment.Outputs["resourceGroupName"].Value -UseAPI
Publish-ZipFile -AppName $deployment.Outputs["appServiceName"].Value -ResourceGroupName $deployment.Outputs["resourceGroupName"].Value -ZipFilePath $ZipFilePath -UseAPI
}
if ($TempFolderObj) {
Write-Host "INFO: Cleaning up temporary directory" -ForegroundColor Green
Remove-Item -LiteralPath $TempFolderObj.FullName -Force -Recurse -ErrorAction SilentlyContinue
$script:TempFolderObj = $null
}
}
@ -1171,7 +1266,9 @@ process {
Restart-AzFunctionApp -Name $deployment.Outputs["appServiceName"].Value -ResourceGroupName $deployment.Outputs["resourceGroupName"].Value -Force | Out-Null
} else {
Write-Host "INFO: Building App container ($ContainerType)..." -ForegroundColor Green
Write-Host "INFO: Building App container (" -ForegroundColor Green -NoNewline
Write-Host $ContainerType.ToLower() -ForegroundColor Cyan -NoNewline
Write-Host ")..." -ForegroundColor Green
$appBuildOutput = $(
az acr build -r $deployment.Outputs["acrName"].Value `
@ -1247,17 +1344,27 @@ process {
if($DEBUG_MODE) {
Write-Host "Debug Log: $debugLog" -ForegroundColor Red
}
if ($env:CI) {
Write-Host $_.ToString()
}
exit 1
}
finally {
if ($TempFolderObj) {
Remove-Item -LiteralPath $TempFolderObj.FullName -Force -Recurse -ErrorAction SilentlyContinue
}
Write-Host
Stop-Transcript | Out-Null
if (($PSCmdlet.ParameterSetName -notin 'AppsOnly') -and $script:deploymentSuccess) {
Write-Output "ipamURL=https://$($deployment.Outputs["appServiceHostName"].Value)" >> $Env:GITHUB_OUTPUT
Write-Output "ipamUIAppId=$($appDetails.UIAppId)" >> $Env:GITHUB_OUTPUT
Write-Output "ipamEngineAppId=$($appDetails.EngineAppId)" >> $Env:GITHUB_OUTPUT
Write-Output "ipamSuffix=$($deployment.Outputs["suffix"].Value)" >> $Env:GITHUB_OUTPUT
Write-Output "ipamResourceGroup=$($deployment.Outputs["resourceGroupName"].Value)" >> $Env:GITHUB_OUTPUT
Write-Output "ipamURL=https://$($deployment.Outputs["appServiceHostName"].Value)" >> $env:GITHUB_OUTPUT
Write-Output "ipamUIAppId=$($appDetails.UIAppId)" >> $env:GITHUB_OUTPUT
Write-Output "ipamEngineAppId=$($appDetails.EngineAppId)" >> $env:GITHUB_OUTPUT
Write-Output "ipamSuffix=$($deployment.Outputs["suffix"].Value)" >> $env:GITHUB_OUTPUT
Write-Output "ipamResourceGroup=$($deployment.Outputs["resourceGroupName"].Value)" >> $env:GITHUB_OUTPUT
}
exit

Просмотреть файл

@ -106,7 +106,6 @@ module cosmos './modules/cosmos.bicep' = {
cosmosAccountName: resourceNames.cosmosAccountName
cosmosContainerName: resourceNames.cosmosContainerName
cosmosDatabaseName: resourceNames.cosmosDatabaseName
keyVaultName: keyVault.outputs.keyVaultName
workspaceId: logAnalyticsWorkspace.outputs.workspaceId
principalId: managedIdentity.outputs.principalId
}

Просмотреть файл

@ -7,9 +7,6 @@ param cosmosContainerName string
@description('CosmosDB Database Name')
param cosmosDatabaseName string
@description('KeyVault Name')
param keyVaultName string
@description('Deployment Location')
param location string = resourceGroup().location
@ -23,7 +20,7 @@ var dbContributor = '00000000-0000-0000-0000-000000000002'
var dbContributorId = '${resourceGroup().id}/providers/Microsoft.DocumentDB/databaseAccounts/${cosmosAccount.name}/sqlRoleDefinitions/${dbContributor}'
var dbContributorRoleAssignmentId = guid(dbContributor, principalId, cosmosAccount.id)
resource cosmosAccount 'Microsoft.DocumentDB/databaseAccounts@2021-04-15' = {
resource cosmosAccount 'Microsoft.DocumentDB/databaseAccounts@2021-06-15' = {
name: cosmosAccountName
location: location
kind: 'GlobalDocumentDB'
@ -39,6 +36,7 @@ resource cosmosAccount 'Microsoft.DocumentDB/databaseAccounts@2021-04-15' = {
]
databaseAccountOfferType: 'Standard'
enableAutomaticFailover: true
// disableLocalAuth: true
disableKeyBasedMetadataWriteAccess: true
}
}
@ -90,13 +88,6 @@ resource cosmosContainer 'Microsoft.DocumentDB/databaseAccounts/sqlDatabases/con
}
}
resource cosmosKeySecret 'Microsoft.KeyVault/vaults/secrets@2021-11-01-preview' = {
name: '${keyVaultName}/COSMOS-KEY'
properties: {
value: cosmosAccount.listKeys().primaryMasterKey
}
}
resource diagnosticSettings 'Microsoft.Insights/diagnosticSettings@2021-05-01-preview' = {
name: 'diagSettings'
scope: cosmosAccount

Просмотреть файл

@ -6,7 +6,9 @@
# Set minimum version requirements
#Requires -Version 7.2
#Requires -Modules @{ ModuleName="Az"; ModuleVersion="10.3.0"}
#Requires -Modules @{ ModuleName="Az.Accounts"; ModuleVersion="2.13.0" }
#Requires -Modules @{ ModuleName="Az.Functions"; ModuleVersion="4.0.6" }
#Requires -Modules @{ ModuleName="Az.Websites"; ModuleVersion="3.1.1" }
# Intake and set global parameters
param(
@ -18,7 +20,60 @@ param(
[Parameter(ValueFromPipelineByPropertyName = $true,
Mandatory = $true)]
[string]
$ResourceGroupName
$ResourceGroupName,
[Parameter(ValueFromPipelineByPropertyName = $true,
Mandatory=$false)]
[string]
$GitHubUserName = "Azure",
[Parameter(ValueFromPipelineByPropertyName = $true,
Mandatory=$false)]
[string]
$GitHubRepoName = "ipam",
[Parameter(ValueFromPipelineByPropertyName = $true,
Mandatory=$false)]
[ValidateScript({
$IndexOfInvalidChar = $_.IndexOfAny([System.IO.Path]::GetInvalidFileNameChars())
if (-Not ($IndexOfInvalidChar -eq -1)) {
throw [System.ArgumentException]::New("The 'ZipFileName' argument contains one or more invalid characters.")
}
if(-Not ($_ -match "(\.zip)")) {
throw [System.ArgumentException]::New("The 'ZipFileName' argument must be of type zip.")
}
return $true
})]
[string]
$ZipFileName = "ipam.zip",
[Parameter(ValueFromPipelineByPropertyName = $true,
Mandatory=$false)]
[ValidateScript({
if(-Not ($_ | Get-Item) ) {
throw [System.ArgumentException]::New("AssetFolder does not exist, please provide a pre-existing folder.")
}
return $true
})]
[System.IO.DirectoryInfo]
$AssetFolder,
[Parameter(ValueFromPipelineByPropertyName = $true,
Mandatory = $false)]
[ValidateScript({
if(-Not ($_ | Test-Path) ) {
throw [System.ArgumentException]::New("Target file or does not exist.")
}
if(-Not ($_ | Test-Path -PathType Leaf) ) {
throw [System.ArgumentException]::New("The 'ZipFilePath' argument must be a file, folder paths are not allowed.")
}
if($_ -notmatch "(\.zip)") {
throw [System.ArgumentException]::New("The file specified in the 'ZipFilePath' argument must be of type zip.")
}
return $true
})]
[System.IO.FileInfo]
$ZipFilePath
)
# Root Directory
@ -38,6 +93,48 @@ $logPath = Join-Path -Path $ROOT_DIR -ChildPath "logs"
New-Item -ItemType Directory -Path $logpath -Force | Out-Null
$updateLog = Join-Path -Path $logPath -ChildPath "update_$(get-date -format `"yyyyMMddhhmmsstt`").log"
$errorLog = Join-Path -Path $logPath -ChildPath "error_$(get-date -format `"yyyyMMddhhmmsstt`").log"
$containerBuildError = $false
$TempFolderObj = $null
Function Get-BuildLogs {
Param(
[Parameter(Mandatory=$true)]
[string]$SubscriptionId,
[Parameter(Mandatory=$true)]
[string]$ResourceGroupName,
[Parameter(Mandatory=$true)]
[string]$RegistryName,
[Parameter(Mandatory=$true)]
[string]$BuildId
)
$msArmMap = @{
AZURE_PUBLIC = "management.azure.com"
AZURE_US_GOV = "management.usgovcloudapi.net"
AZURE_US_GOV_SECRET = "management.azure.microsoft.scloud"
AZURE_GERMANY = "management.microsoftazure.de"
AZURE_CHINA = "management.chinacloudapi.cn"
};
$accessToken = (Get-AzAccessToken).Token | ConvertTo-SecureString -AsPlainText
$response = Invoke-RestMethod `
-Method POST `
-Uri "https://$($msArmMap[$AzureCloud])/subscriptions/$SubscriptionId/resourceGroups/$ResourceGroupName/providers/Microsoft.ContainerRegistry/registries/$RegistryName/runs/$BuildId/listLogSasUrl?api-version=2019-04-01" `
-Authentication Bearer `
-Token $accessToken
$logLink = $response.logLink
$logs = Invoke-RestMethod `
-Method GET `
-Uri $logLink
return $logs
}
Function Restart-IpamApp {
Param(
@ -89,12 +186,51 @@ Function Restart-IpamApp {
} while ($restartSuccess -eq $False -and $restartRetries -gt 0)
}
Function Get-ZipFile {
Param(
[Parameter(Mandatory=$true)]
[string]$GitHubUserName,
[Parameter(Mandatory=$true)]
[string]$GitHubRepoName,
[Parameter(Mandatory=$true)]
[string]$ZipFileName,
[Parameter(Mandatory=$true)]
[System.IO.DirectoryInfo]$AssetFolder
)
$ZipFilePath = Join-Path -Path $AssetFolder.FullName -ChildPath $ZipFileName
try {
$GitHubURL = "https://api.github.com/repos/$GitHubUserName/$GitHubRepoName/releases/latest"
Write-Host "INFO: Target GitHub Repo is " -ForegroundColor Green -NoNewline
Write-Host "$GitHubUserName/$GitHubRepoName" -ForegroundColor Cyan
Write-Host "INFO: Fetching download URL..." -ForegroundColor Green
$GHResponse = Invoke-WebRequest -Method GET -Uri $GitHubURL
$JSONResponse = $GHResponse.Content | ConvertFrom-Json
$AssetList = $JSONResponse.assets
$Asset = $AssetList | Where-Object { $_.name -eq $ZipFileName }
$DownloadURL = $Asset.browser_download_url
Write-Host "INFO: Downloading ZIP Archive to " -ForegroundColor Green -NoNewline
Write-Host $ZipFilePath -ForegroundColor Cyan
Invoke-WebRequest -Uri $DownloadURL -OutFile $ZipFilePath
} catch {
Write-Host "ERROR: Unable to download ZIP Deploy archive!" -ForegroundColor Red
throw $_
}
}
Function Publish-ZipFile {
Param(
[Parameter(Mandatory=$true)]
[string]$AppName,
[Parameter(Mandatory=$true)]
[string]$ResourceGroupName,
[Parameter(Mandatory=$true)]
[System.IO.FileInfo]$ZipFilePath,
[Parameter(Mandatory=$false)]
[switch]$UseAPI
)
@ -103,14 +239,12 @@ Function Publish-ZipFile {
Write-Host "INFO: Using Kudu API for ZIP Deploy" -ForegroundColor Green
}
$zipPath = Join-Path -Path $ROOT_DIR -ChildPath 'assets' -AdditionalChildPath "ipam.zip"
$publishRetries = 3
$publishSuccess = $False
if ($UseAPI) {
$accessToken = (Get-AzAccessToken).Token
$zipContents = Get-Item -Path $zipPath
$zipContents = Get-Item -Path $ZipFilePath
$publishProfile = Get-AzWebAppPublishingProfile -Name $AppName -ResourceGroupName $ResourceGroupName
$zipUrl = ([System.uri]($publishProfile | Select-Xml -XPath "//publishProfile[@publishMethod='ZipDeploy']" | Select-Object -ExpandProperty Node).publishUrl).Scheme
@ -122,7 +256,7 @@ Function Publish-ZipFile {
Publish-AzWebApp `
-Name $AppName `
-ResourceGroupName $ResourceGroupName `
-ArchivePath $zipPath `
-ArchivePath $ZipFilePath `
-Restart `
-Force `
| Out-Null
@ -306,8 +440,11 @@ try {
}
}
$dockerFile = 'Dockerfile.' + $containerMap[$containerType].Extension
$dockerFilePath = Join-Path -Path $ROOT_DIR -ChildPath $dockerFile
if($containerType) {
$dockerFile = 'Dockerfile.' + $containerMap[$containerType].Extension
$dockerFilePath = Join-Path -Path $ROOT_DIR -ChildPath $dockerFile
}
$dockerFileFunc = Join-Path -Path $ROOT_DIR -ChildPath 'Dockerfile.func'
if($isFunction) {
@ -316,11 +453,24 @@ try {
$funcBuildOutput = $(
az acr build -r $acrName `
-t ipamfunc:latest `
-f $dockerFileFunc $ROOT_DIR
-f $dockerFileFunc $ROOT_DIR `
--no-logs
) *>&1
if ($LASTEXITCODE -ne 0) {
throw $funcBuildOutput
Write-Host "ERROR: Container build process failed, fetching error logs..." -ForegroundColor Red
$buildId = [regex]::Matches($funcBuildOutput, "(?<=Queued a build with ID: )[\w]*").Value.Trim()
$buildLogs = Get-BuildLogs `
-SubscriptionId (Get-AzContext).Subscription.Id `
-ResourceGroupName $ResourceGroupName `
-RegistryName $acrName `
-BuildId $buildId
$buildLogs | Out-File -FilePath $errorLog -Append
$script:containerBuildError = $true
} else {
Write-Host "INFO: Function container image build and push completed successfully" -ForegroundColor Green
}
@ -339,11 +489,24 @@ try {
-f $dockerFilePath $ROOT_DIR `
--build-arg PORT=$($containerMap[$ContainerType].Port) `
--build-arg BUILD_IMAGE=$($containerMap[$containerType].Images.Build) `
--build-arg SERVE_IMAGE=$($containerMap[$containerType].Images.Serve)
--build-arg SERVE_IMAGE=$($containerMap[$containerType].Images.Serve) `
--no-logs
) *>&1
if ($LASTEXITCODE -ne 0) {
throw $appBuildOutput
Write-Host "ERROR: Container build process failed, fetching error logs..." -ForegroundColor Red
$buildId = [regex]::Matches($appBuildOutput, "(?<=Queued a build with ID: )[\w]*").Value.Trim()
$buildLogs = Get-BuildLogs `
-SubscriptionId (Get-AzContext).Subscription.Id `
-ResourceGroupName $ResourceGroupName `
-RegistryName $acrName `
-BuildId $buildId
$buildLogs | Out-File -FilePath $errorLog -Append
$script:containerBuildError = $true
} else {
Write-Host "INFO: App container image build and push completed successfully" -ForegroundColor Green
}
@ -352,14 +515,55 @@ try {
Restart-IpamApp -AppName $AppName -ResourceGroupName $ResourceGroupName
}
if(-not $containerBuildError) {
Write-Host "INFO: Azure IPAM Solution updated successfully" -ForegroundColor Green
} else {
Write-Host "WARNING: Azure IPAM Solution deployed with errors, see logs for details!" -ForegroundColor Yellow
Write-Host "Run Log: $transcriptLog" -ForegroundColor Yellow
Write-Host "Error Log: $errorLog" -ForegroundColor Yellow
}
} else {
if (-Not $ZipFilePath) {
if (-Not $AssetFolder) {
try {
# Create a temporary folder path
$TempFolder = Join-Path -Path TEMP:\ -ChildPath $(New-Guid)
# Create directory if not exists
$script:TempFolderObj = New-Item -ItemType Directory -Path $TempFolder -Force
$script:AssetFolder = $TempFolderObj
} catch {
Write-Host "ERROR: Unable to create temp directory to store ZIP archive!" -ForegroundColor Red
throw $_
}
} else {
$script:AssetFolder = Get-Item -Path $AssetFolder
}
Write-Host "INFO: Fetching latest ZIP Deploy archive..." -ForegroundColor Green
Get-ZipFile -GitHubUserName $GitHubUserName -GitHubRepoName $GitHubRepoName -ZipFileName $ZipFileName -AssetFolder $AssetFolder
$script:ZipFilePath = Join-Path -Path $AssetFolder.FullName -ChildPath $ZipFileName
} else {
$script:ZipFilePath = Get-Item -Path $ZipFilePath
}
Write-Host "INFO: Uploading ZIP Deploy archive..." -ForegroundColor Green
try {
Publish-ZipFile -AppName $AppName -ResourceGroupName $ResourceGroupName
Publish-ZipFile -AppName $AppName -ResourceGroupName $ResourceGroupName -ZipFilePath $ZipFilePath
} catch {
Write-Host "SWITCH: Retrying ZIP Deploy with Kudu API..." -ForegroundColor Blue
Publish-ZipFile -AppName $AppName -ResourceGroupName $ResourceGroupName -UseAPI
Publish-ZipFile -AppName $AppName -ResourceGroupName $ResourceGroupName -ZipFilePath $ZipFilePath -UseAPI
}
if ($TempFolderObj) {
Write-Host "INFO: Cleaning up temporary directory" -ForegroundColor Green
Remove-Item -LiteralPath $TempFolderObj.FullName -Force -Recurse -ErrorAction SilentlyContinue
$script:TempFolderObj = $null
}
Write-Host
@ -367,11 +571,21 @@ try {
}
}
catch {
$_ | Out-File -FilePath $updateLog -Append
$_ | Out-File -FilePath $errorLog -Append
Write-Host "ERROR: Unable to update Azure IPAM application, see log for detailed information!" -ForegroundColor red
Write-Host "Update Log: $updateLog" -ForegroundColor Red
Write-Host "Update Log: $errorLog" -ForegroundColor Red
if ($env:CI) {
Write-Host $_.ToString()
}
exit 1
}
finally {
if ($TempFolderObj) {
Remove-Item -LiteralPath $TempFolderObj.FullName -Force -Recurse -ErrorAction SilentlyContinue
}
Write-Host
Stop-Transcript | Out-Null
}

Просмотреть файл

@ -19,7 +19,7 @@ ADD ./requirements.lock.txt .
RUN pip install --upgrade pip --progress-bar off
# Install Dependencies
RUN pip install --no-cache-dir --upgrade -r ./requirements.lock.txt --progress-bar off
RUN pip install --no-cache-dir -r ./requirements.lock.txt --progress-bar off
# Copy Application Scripts & Sources
ADD ./app ./app

Просмотреть файл

@ -12,7 +12,7 @@ ADD ./requirements.lock.txt .
RUN pip install --upgrade pip --progress-bar off
# Install Dependencies
RUN pip install --no-cache-dir --upgrade -r ./requirements.lock.txt --progress-bar off
RUN pip install --no-cache-dir -r ./requirements.lock.txt --progress-bar off
# Copy Application Code to Function App Root Directory
COPY . /home/site/wwwroot

Просмотреть файл

@ -22,7 +22,7 @@ ADD ./requirements.lock.txt /ipam
RUN pip install --upgrade pip --progress-bar off
# Install Dependencies
RUN pip install --no-cache-dir --upgrade -r ./requirements.lock.txt --progress-bar off
RUN pip install --no-cache-dir -r ./requirements.lock.txt --progress-bar off
# Copy Application Scripts & Sources
ADD ./app ./appDockerfile

Просмотреть файл

@ -78,7 +78,7 @@ async def ipam_init():
os.environ['VITE_CONTAINER_IMAGE_ID'] = release_data['ID']
os.environ['VITE_CONTAINER_IMAGE_VERSION'] = release_data['VERSION_ID']
os.environ['VITE_CONTAINER_IMAGE_CODENAME'] = release_data['VERSION'].split(" ")[1][1:-1].lower()
os.environ['VITE_CONTAINER_IMAGE_CODENAME'] = release_data['VERSION'].split(" ")[1][1:-1].lower() if "VERSION" in release_data else "N/A"
os.environ['VITE_CONTAINER_IMAGE_PRETTY_NAME'] = release_data['PRETTY_NAME']
if os.path.exists(BUILD_DIR):

Просмотреть файл

@ -96,7 +96,8 @@ resources
| join kind = leftouter(
resources
| where type =~ 'Microsoft.Network/virtualNetworks'
| mv-expand subnet = todynamic(properties.subnets)
| extend subnet = todynamic(properties.subnets)
| mv-expand subnet limit 1024
| extend nameMap = dynamic({{'AzureFirewallSubnet': 'AFW', 'GatewaySubnet': 'VGW', 'AzureBastionSubnet': 'BAS'}})
| extend nameResult = nameMap[tostring(subnet.name)]
| extend appGwConfig = subnet.properties.applicationGatewayIPConfigurations
@ -272,39 +273,44 @@ resources
# | where type =~ "microsoft.compute/virtualmachinescalesets/virtualmachines"
# | where subscriptionId !in~ {}
# | project name, tostring(id), resource_group = resourceGroup, subscription_id = subscriptionId, tenant_id = tenantId
# | extend lower_id = tolower(id)
# | extend id_lower = tolower(id)
# | join kind = leftouter (
# ComputeResources
# | where type =~ "microsoft.compute/virtualmachinescalesets/virtualmachines/networkinterfaces"
# | mv-expand ipConfig = properties.ipConfigurations
# | project id = tostring(properties.virtualMachine.id), private_ip = ipConfig.properties.privateIPAddress, subnet_id = ipConfig.properties.subnet.id
# | extend lower_id = tolower(id)
# | extend lower_subnet_id = tolower(tostring(subnet_id))
# ) on lower_id
# | project id = tostring(properties.virtualMachine.id), private_ip = ipConfig.properties.privateIPAddress, subnet_id = tostring(ipConfig.properties.subnet.id)
# | extend id_lower = tolower(id)
# | extend subnet_id_lower = tolower(tostring(subnet_id))
# ) on id_lower
# | join kind = leftouter (
# resources
# | where type =~ 'microsoft.network/virtualnetworks'
# | mv-expand subnet = properties.subnets
# | project subnet_id = subnet.id, subnet_name = subnet.name, vnet_id = id, vnet_name = name
# | extend lower_subnet_id = tolower(tostring(subnet_id))
# ) on lower_subnet_id
# | extend vmss_name = replace(@'_[^_]+$', '', name)
# | project subnet_id = tostring(subnet.id), subnet_name = subnet.name, vnet_id = id, vnet_name = name
# | extend subnet_id_lower = tolower(tostring(subnet_id))
# ) on subnet_id_lower
# | extend vmss_name = extract(@'virtualMachineScaleSets\/(.*)\/virtualMachines', 1, id)
# | extend vmss_vm_num = todynamic(replace(@'.*\/virtualMachines/', '', id))
# | extend vmss_id = replace(@'/virtualMachines.*', '', id)
# | project name, id, private_ip, resource_group, subscription_id, tenant_id, vnet_name, vnet_id, subnet_name, subnet_id, metadata = pack('vmss_name', vmss_name, 'vmss_vm_num', vmss_vm_num, 'vmss_id', vmss_id)
# | extend metadata = pack('kind', 'VM Scale Set', 'vmss_name', vmss_name, 'vmss_vm_num', vmss_vm_num, 'vmss_id', vmss_id)
# | project name = strcat(vmss_name, '_', vmss_vm_num), id, private_ip, resource_group, subscription_id, tenant_id, vnet_name, vnet_id, subnet_name, subnet_id, metadata
# """
VM_SCALE_SET = """
ComputeResources
| where type =~ "microsoft.compute/virtualmachinescalesets/virtualmachines"
| where subscriptionId !in~ {}
| where properties.provisioningState == "Succeeded"
| project name, tostring(id), resource_group = resourceGroup, subscription_id = subscriptionId, tenant_id = tenantId
| extend id_lower = tolower(id)
| join kind = leftouter (
ComputeResources
| where type =~ "microsoft.compute/virtualmachinescalesets/virtualmachines/networkinterfaces"
| mv-expand ipConfig = properties.ipConfigurations
| project id = tostring(properties.virtualMachine.id), private_ip = ipConfig.properties.privateIPAddress, subnet_id = tostring(ipConfig.properties.subnet.id)
| extend id = tostring(properties.virtualMachine.id)
| extend subnet_id = tostring(ipConfig.properties.subnet.id)
| extend id_lower = tolower(id)
| summarize private_ips = make_list(ipConfig.properties.privateIPAddress) by id, subnet_id
| extend id_lower = tolower(id)
| extend subnet_id_lower = tolower(tostring(subnet_id))
) on id_lower
@ -319,7 +325,7 @@ ComputeResources
| extend vmss_vm_num = todynamic(replace(@'.*\/virtualMachines/', '', id))
| extend vmss_id = replace(@'/virtualMachines.*', '', id)
| extend metadata = pack('kind', 'VM Scale Set', 'vmss_name', vmss_name, 'vmss_vm_num', vmss_vm_num, 'vmss_id', vmss_id)
| project name = strcat(vmss_name, '_', vmss_vm_num), id, private_ip, resource_group, subscription_id, tenant_id, vnet_name, vnet_id, subnet_name, subnet_id, metadata
| project name = strcat(vmss_name, '_', vmss_vm_num), id, private_ips, resource_group, subscription_id, tenant_id, vnet_name, vnet_id, subnet_name, subnet_id, metadata
"""
FIREWALL_VNET = """

Просмотреть файл

@ -674,9 +674,18 @@ async def vmss(
"""
if globals.AZURE_ENV == "AZURE_PUBLIC":
results = await arg_query(authorization, admin, argquery.VM_SCALE_SET)
vm_scale_sets = await arg_query(authorization, admin, argquery.VM_SCALE_SET)
else:
results = await get_vmss(authorization, admin)
vm_scale_sets = await get_vmss(authorization, admin)
results = []
for vmss in vm_scale_sets:
for private_ip in vmss["private_ips"] or []:
new_vmss = copy.deepcopy(vmss)
del new_vmss["private_ips"]
new_vmss["private_ip"] = private_ip
results.append(new_vmss)
return results

Просмотреть файл

@ -156,7 +156,7 @@ try {
# Build Azure IPAM UI
$npmInstallErr = $(
$npmInstall = npm install --no-progress --no-update-notifier
$npmInstall = npm ci --no-progress --no-update-notifier --no-fund
) 2>&1
# Switch back to original dir
@ -206,7 +206,7 @@ try {
# Fetch Azure IPAM Engine modules
$pipInstallErr = $(
$pipInstall = pip install --upgrade -r requirements.txt --target $packageDir.FullName --progress-bar off
$pipInstall = pip install --upgrade -r requirements.lock.txt --target $packageDir.FullName --no-warn-script-location --progress-bar off
) 2>&1
# Switch back to original dir
@ -257,6 +257,12 @@ catch {
$_ | Out-File -FilePath $buildLog -Append
Write-Host "ERROR: Unable to build Azure IPAM Zip assets due to an exception, see log for detailed information!" -ForegroundColor red
Write-Host "Build Log: $buildLog" -ForegroundColor Red
if ($env:CI) {
Write-Host $_.ToString()
}
exit 1
}
finally {
Set-Location (Get-Item $($MyInvocation.MyCommand.Path)).Directory

Просмотреть файл

@ -156,6 +156,12 @@ catch {
$_ | Out-File -FilePath $versionLog -Append
Write-Host "ERROR: Unable to update Azure IPAM component versions due to an exception, see log for detailed information!" -ForegroundColor red
Write-Host "Version Log: $versionLog" -ForegroundColor Red
if ($env:CI) {
Write-Host $_.ToString()
}
exit 1
}
finally {
Write-Host

1034
ui/package-lock.json сгенерированный

Разница между файлами не показана из-за своего большого размера Загрузить разницу

Просмотреть файл

@ -4,19 +4,19 @@
"type": "module",
"private": true,
"dependencies": {
"@azure/msal-browser": "^3.18.0",
"@azure/msal-react": "^2.0.20",
"@emotion/react": "^11.11.4",
"@emotion/styled": "^11.11.5",
"@azure/msal-browser": "^3.22.0",
"@azure/msal-react": "^2.0.22",
"@emotion/react": "^11.13.3",
"@emotion/styled": "^11.13.0",
"@inovua/reactdatagrid-community": "^5.10.2",
"@mui/icons-material": "^5.16.0",
"@mui/lab": "^5.0.0-alpha.171",
"@mui/material": "^5.16.0",
"@reduxjs/toolkit": "^2.2.6",
"@testing-library/jest-dom": "^6.4.6",
"@testing-library/react": "^16.0.0",
"@mui/icons-material": "^5.16.7",
"@mui/lab": "^5.0.0-alpha.173",
"@mui/material": "^5.16.7",
"@reduxjs/toolkit": "^2.2.7",
"@testing-library/jest-dom": "^6.5.0",
"@testing-library/react": "^16.0.1",
"@testing-library/user-event": "^14.5.2",
"axios": "^1.7.2",
"axios": "^1.7.7",
"echarts": "^5.5.1",
"echarts-for-react": "^3.0.2",
"lodash": "^4.17.21",
@ -28,9 +28,9 @@
"react-dom": "^18.3.1",
"react-draggable": "^4.4.6",
"react-redux": "^9.1.2",
"react-router-dom": "^6.24.1",
"react-router-dom": "^6.26.1",
"spinners-react": "^1.0.7",
"web-vitals": "^4.2.1"
"web-vitals": "^4.2.3"
},
"scripts": {
"start": "vite",
@ -51,10 +51,10 @@
"devDependencies": {
"@vitejs/plugin-react": "^4.3.1",
"eslint": "^8.57.0",
"eslint-plugin-react": "^7.34.3",
"eslint-plugin-react": "^7.35.1",
"eslint-plugin-react-hooks": "^4.6.2",
"serve": "^14.2.3",
"vite": "^5.3.3",
"vite": "^5.4.2",
"vite-plugin-eslint2": "^4.4.0"
}
}

Просмотреть файл

@ -508,7 +508,7 @@ const Subnets = (props) => {
return (
<React.Fragment>
{ !isAdmin &&
{ isAdmin &&
<React.Fragment>
<AddExtSubnet
open={addExtSubOpen}