[FWB] Azure Marketplace version update #79
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: '[FWB] Azure Marketplace version update' | |
on: | |
workflow_dispatch: | |
schedule: | |
- cron: '00 22 * * 0' | |
env: | |
PRODUCT: FortiWeb | |
PRODUCTSHORT: FWB | |
jobs: | |
ARM-FWB-Version-Update: | |
name: Update FWB version list | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Azure Login via Az module | |
uses: azure/login@v2 | |
with: | |
creds: ${{secrets.AZURE_CREDENTIALS}} | |
enable-AzPSSession: true | |
- name: Verify FWB published version, update templates when new version found | |
uses: azure/powershell@v2 | |
with: | |
inlineScript: | | |
$buildingBlocks = @("A-Single-VM", "Active-Active","Active-Passive") | |
$versions = @() | |
$versionsui = @() | |
$fortiwebVersions = Get-AzVMImage -PublisherName "fortinet" -Location eastus -Offer "fortinet_fortiweb-vm_v5" -sku "fortinet_fw-vm" | |
$versions += $($fortiwebVersions).Version | |
$versions += "latest" | |
$versions | ConvertTo-Json | Out-File -Filepath "./fwbversion.json" | |
$versions | ForEach-Object { $versionsui += [pscustomobject]@{label=$_;value=$_} } | |
$versionsui | ConvertTo-Json | Out-File -Filepath "./fwbversionui.json" | |
foreach ($buildingBlock in $buildingBlocks) { | |
Get-Content -Raw -Path "./FortiWeb/${buildingBlock}/mainTemplate.json" | jq --slurpfile content "./fwbversion.json" '.parameters.imageVersion.allowedValues = $content[]' | Set-Content -Path "./FortiWeb/${buildingBlock}/mainTemplate.json" | |
$content = Get-Content "./FortiWeb/${buildingBlock}/mainTemplate.json" -Raw | |
if (-Not $content -match '(?<=\r\n)\z') { | |
"" | Out-File -Append "./FortiWeb/${buildingBlock}/mainTemplate.json" | |
} | |
Get-Content -Raw -Path "./FortiWeb/${buildingBlock}/createUiDefinition.json" | jq --slurpfile content "./fwbversionui.json" '(.parameters.basics[] | select( .name == \"imageVersion\") | .constraints.allowedValues) |= $content[]' | Set-Content -Path "./FortiWeb/${buildingBlock}/createUiDefinition.json" | |
$content = Get-Content "./FortiWeb/${buildingBlock}/createUiDefinition.json" -Raw | |
if (-Not $content -match '(?<=\r\n)\z') { | |
"" | Out-File -Append "./FortiWeb/${buildingBlock}/createUiDefinition.json" | |
} | |
} | |
Remove-Item "./fwbversion.json" | |
Remove-Item "./fwbversionui.json" | |
azPSVersion: "latest" | |
- name: Create Pull Request | |
id: cpr | |
uses: peter-evans/create-pull-request@v4 | |
with: | |
token: ${{ secrets.GITHUB_TOKEN }} | |
commit-message: Update report | |
committer: GitHub <[email protected]> | |
author: ${{ github.actor }} <${{ github.actor }}@users.noreply.github.com> | |
signoff: false | |
branch: fwb-vm-update-version | |
delete-branch: true | |
title: '[FWB] Azure Marketplace FWB Version update' | |
body: | | |
Update report | |
- Updated FWB version in building blocks: "A-Single-VM", "Active-Active-ELB-ILB","Active-Passive-ELB-ILB","Active-Passive-SDN" | |
- Auto-generated by [create-pull-request][1] | |
[1]: https://github.com/peter-evans/create-pull-request | |
labels: | | |
report | |
automated pr | |
assignees: jvhoof | |
reviewers: jvhoof | |
draft: false |