Skip to content

Commit

Permalink
Revert all changes. This isn't working lol
Browse files Browse the repository at this point in the history
  • Loading branch information
ebronson68 committed Sep 3, 2024
1 parent 2ce7846 commit 4b0df73
Showing 1 changed file with 11 additions and 28 deletions.
39 changes: 11 additions & 28 deletions .github/workflows/update-addns.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -80,36 +80,19 @@ jobs:
timeout-minutes: 15
shell: pwsh
run: |
$recordUpdated = $false
try {
Write-Host "Attempting to add CNAME Record..."
Add-DnsServerResourceRecordCName -Name "${{ env.hostName }}" -HostNameAlias "${{ env.aksIngress}}" -ZoneName "${{ env.domainName }}" -ComputerName ${{ secrets.domainController }}
Write-Host "CNAME Record added successfully."
$recordUpdated = $true
Write-Host "Adding CNAME Record"
Add-DnsServerResourceRecordCName -Name "${{ env.hostName }}" -HostNameAlias "${{ env.aksIngress}}" -ZoneName "${{ env.domainName }}" -ComputerName ${{ secrets.domainController }}
}
catch {
Write-Host "Failed to add CNAME Record. It may already exist."
Write-Host "Record Already Exists"
}
Write-Host "Retrieving DNS Record..."
$dnsRecord = Get-DnsServerResourceRecord -ZoneName "${{ env.domainName }}" -ComputerName ${{ secrets.domainController }} | Where-Object { $_.HostName -eq "${{ env.aksIngress }}" }
if ($dnsRecord) {
Write-Host "DNS Record retrieved successfully:"
$dnsRecord | Format-List
} else {
Write-Error "DNS Record not found."
Write-Host "Retrieving DNS Record"
Get-DnsServerResourceRecord -ZoneName "${{ env.domainName }}" -ComputerName ${{ secrets.domainController }} | Where-Object HostName -eq "${{ env.aksIngress }}" | Format-List
try {
Write-Host "Syncing DNS Zone"
Sync-DnsServerZone -Name "${{ env.domainName }}" -ComputerName ${{ secrets.domainController }}
}
catch {
Write-Host "Skipping zone sync. Zone is currently being synced."
}
if ($recordUpdated) {
try {
Write-Host "Attempting to sync DNS Zone..."
Sync-DnsServerZone -Name "${{ env.domainName }}" -ComputerName ${{ secrets.domainController }}
Write-Host "DNS Zone synced successfully."
}
catch {
Write-Error "Failed to sync DNS Zone. Zone may currently be syncing."
}
} else {
Write-Host "No changes made to DNS records. Skipping DNS Zone sync."
}

0 comments on commit 4b0df73

Please sign in to comment.