Skip to content

Commit

Permalink
Merge branch 'main' into bug/GOCSERV-119/add-input-for-product-keys
Browse files Browse the repository at this point in the history
  • Loading branch information
ebronson68 committed Sep 4, 2024
2 parents d09104a + c408c71 commit 1b07e78
Showing 1 changed file with 50 additions and 55 deletions.
105 changes: 50 additions & 55 deletions .github/workflows/update-addns.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -31,70 +31,65 @@ on:

jobs:
update-dns:
runs-on: [self-hosted, Windows, boley]
continue-on-error: false
timeout-minutes: 10
name: Update Boley DNS
runs-on: [self-hosted, Windows, boley]
steps:
- name: Retrieve Application information
id: getappinfo
uses: azure/powershell@v2
with:
azPSVersion: "latest"
inlineScript: |
Install-Module -Name AzTable -Force
Import-Module AzTable
shell: pwsh
run: |
Install-Module -Name AzTable -Force
Import-Module AzTable
$storageAccountName = "${{ inputs.storageAccountName }}"
$storageAccountKey = ${{ secrets.storageAccountKey }}
$appInfoTableName = "${{ inputs.appInfoTableName }}"
$storageAccountName = "${{ inputs.storageAccountName }}"
$storageAccountKey = ${{ secrets.storageAccountKey }}
$appInfoTableName = "${{ inputs.appInfoTableName }}"
$storageContext = New-AzStorageContext -StorageAccountName $storageAccountName -StorageAccountKey $storageAccountKey
$storageContext = New-AzStorageContext -StorageAccountName $storageAccountName -StorageAccountKey $storageAccountKey
#Get Storage table
try {
$appInfoTable = (Get-AzStorageTable -Name $appInfoTableName -Context $storageContext -ErrorAction Stop).CloudTable
}
catch {
Write-Error -Message "Error accessing cloud $appInfoTableName table. Error message was: $_.Exception.Message"
return
}
#Get Storage table
try {
$appInfoTable = (Get-AzStorageTable -Name $appInfoTableName -Context $storageContext -ErrorAction Stop).CloudTable
}
catch {
Write-Error -Message "Error accessing cloud $appInfoTableName table. Error message was: $_.Exception.Message"
return
}
$appInfo = Get-AzTableRow -Table $appInfoTable -PartitionKey "${{ inputs.repositoryName }}" -RowKey "${{ inputs.environment }}"
$appInfo = Get-AzTableRow -Table $appInfoTable -PartitionKey "${{ inputs.repositoryName }}" -RowKey "${{ inputs.environment }}"
$applicationName = $appInfo.ApplicationName
$version = $appInfo.Version
$keyVault = $appInfo.KeyVault
$hostName = $appInfo.HostName
$domainName = $appInfo.DomainName
$ingressFqdn = $appInfo.IngressFqdn
$healthCheckPath = $appInfo.HealthCheckPath
$aksIngress = $appInfo.AksIngress
$applicationName = $appInfo.ApplicationName
$version = $appInfo.Version
$keyVault = $appInfo.KeyVault
$hostName = $appInfo.HostName
$domainName = $appInfo.DomainName
$ingressFqdn = $appInfo.IngressFqdn
$healthCheckPath = $appInfo.HealthCheckPath
$aksIngress = $appInfo.AksIngress
echo "applicationName=$applicationName" >> $env:GITHUB_ENV
echo "version=$version" >> $env:GITHUB_ENV
echo "keyVault=$keyVault" >> $env:GITHUB_ENV
echo "hostName=$hostName" >> $env:GITHUB_ENV
echo "domainName=$domainName" >> $env:GITHUB_ENV
echo "applicationIngressFqdn=$ingressFqdn" >> $env:GITHUB_ENV
echo "healthCheckPath=$healthCheckPath" >> $env:GITHUB_ENV
echo "aksIngress=$aksIngress" >> $env:GITHUB_ENV
echo "applicationName=$applicationName" >> $env:GITHUB_ENV
echo "version=$version" >> $env:GITHUB_ENV
echo "keyVault=$keyVault" >> $env:GITHUB_ENV
echo "hostName=$hostName" >> $env:GITHUB_ENV
echo "domainName=$domainName" >> $env:GITHUB_ENV
echo "applicationIngressFqdn=$ingressFqdn" >> $env:GITHUB_ENV
echo "healthCheckPath=$healthCheckPath" >> $env:GITHUB_ENV
echo "aksIngress=$aksIngress" >> $env:GITHUB_ENV
- name: Update Internal Boley DNS
uses: azure/powershell@v2
with:
azPSVersion: "latest"
inlineScript: |
try {
Add-DnsServerResourceRecordCName -Name "${{ env.hostName }}" -HostNameAlias "${{ env.aksIngress}}" -ZoneName "${{ env.domainName }}" -ComputerName ${{ secrets.domainController }}
}
catch {
Write-Host "Record Already Exists"
}
Get-DnsServerResourceRecord -ZoneName "${{ env.domainName }}" -ComputerName ${{ secrets.domainController }} | Where-Object HostName -eq "${{ env.aksIngress }}" | Format-List
try {
Sync-DnsServerZone -Name "${{ env.domainName }}" -ComputerName ${{ secrets.domainController }}
}
catch {
Write-Host "Skipping zone sync. Zone is currently being synced."
}
timeout-minutes: 15
shell: pwsh
run: |
try {
Add-DnsServerResourceRecordCName -Name "${{ env.hostName }}" -HostNameAlias "${{ env.aksIngress}}" -ZoneName "${{ env.domainName }}" -ComputerName ${{ secrets.domainController }}
}
catch {
Write-Host "Record Already Exists"
}
Get-DnsServerResourceRecord -ZoneName "${{ env.domainName }}" -ComputerName ${{ secrets.domainController }} | Where-Object HostName -eq "${{ env.aksIngress }}" | Format-List
try {
Sync-DnsServerZone -Name "${{ env.domainName }}" -ComputerName ${{ secrets.domainController }}
}
catch {
Write-Host "Skipping zone sync. Zone is currently being synced."
}

0 comments on commit 1b07e78

Please sign in to comment.