From 06521756e802c0a16c713567618e8645d7be5a89 Mon Sep 17 00:00:00 2001 From: catelleempei Date: Tue, 6 Aug 2024 08:09:39 -0400 Subject: [PATCH] testing for envivariables existence in the repo --- .github/workflows/coverity-client.yaml | 23 ++++++++-- gen.ps1 | 3 -- helpers/GenerateResourcesAndImage.ps1 | 58 +++++++++++++------------- 3 files changed, 49 insertions(+), 35 deletions(-) delete mode 100644 gen.ps1 diff --git a/.github/workflows/coverity-client.yaml b/.github/workflows/coverity-client.yaml index 235e5a0b8ad1..ee61215d8067 100644 --- a/.github/workflows/coverity-client.yaml +++ b/.github/workflows/coverity-client.yaml @@ -58,10 +58,27 @@ jobs: # DEVOPS_ST_URL: ${{ vars.DEVOPS_ST_URL }} DEVOPS_ST_SAS_TOKEN: ${{ secrets.DEVOPS_ST_SAS_TOKEN }} #COV_LICENSE=${{ secrets.COVERITY_LICENSE }} + AZURE_SAS_TOKEN: ${{ secrets.AZURE_SAS_TOKEN }} + + AZURE_SUBSCRIPTION_ID: ${{ secrets.AZURE_SUBSCRIPTION_ID }} + AZURE_RESOURCE_GROUP: ${{ secrets.AZURE_RESOURCE_GROUP }} + AZURE_LOCATION: ${{ secrets.AZURE_LOCATION }} + AZURE_CLIENT_ID: ${{ secrets.AZURE_CLIENT_ID }} + AZURE_CLIENT_SECRET: ${{ secrets.AZURE_CLIENT_SECRET }} + AZURE_TENANT_ID: ${{ secrets.AZURE_TENANT_ID }} + VIRTUALNETWORK_RESOURCE_GROUP: ${{ secrets.VIRTUALNETWORK_RESOURCE_GROUP }} + VIRTUAL_NETWORK_NAME: ${{ secrets.VIRTUAL_NETWORK_NAME }} + VIRTUAL_SUBNET_NAME: ${{ secrets.VIRTUAL_SUBNET_NAME }} + AZURE_GALLERY_NAME: ${{ secrets.AZURE_GALLERY_NAME }} + run: | - # Start-Process -FilePath "C:\temp/cov-analysis-win64-2024.3.1.exe" -ArgumentList "/S" - - ./gen.ps1 - # ./images\windows\scripts\build\Install-CoverityClient.ps1 + Import-Module .\helpers\GenerateResourcesAndImage.ps1 -Force + $Env:PACKER_LOG = 1 + Write-Output $env:AZURE_SAS_TOKEN + Write-Output $env:VIRTUALNETWORK_RESOURCE_GROUP + + + # GenerateResourcesAndImage -SubscriptionId 9013acaf-d6cc-4416-a9ed-7075ba759979 -ResourceGroupName ETN-ES-EAS-DEVSECOPS-PACKER -ImageType Windows2022Base -AzureLocation "East US" -AzureClientId 52563be7-6764-4964-b3dc-beb18e7623d2 -AzureClientSecret "~H48Q~tiI1SZXH~GNq8SdqSI_9yXS124.GjHNb8Q" -AzureTenantId d6525c95-b906-431a-b926-e9b51ba43cc4 -VirtualNetworkName vnet-yukon-sbx-eus -VirtualNetworkResourceGroupName "ETN-ES-Yukon-Infra-Primary" -VirtualNetworkSubnetName AppSubnet -GalleryName "etn_packer_gallery" -ReuseResourceGroup #------------------------------------------------ # - name: Checkout License Agreement Repository diff --git a/gen.ps1 b/gen.ps1 deleted file mode 100644 index 96ba836fa0e5..000000000000 --- a/gen.ps1 +++ /dev/null @@ -1,3 +0,0 @@ -Import-Module .\helpers\GenerateResourcesAndImage.ps1 -Force -$Env:PACKER_LOG = 1 -GenerateResourcesAndImage -SubscriptionId 9013acaf-d6cc-4416-a9ed-7075ba759979 -ResourceGroupName ETN-ES-EAS-DEVSECOPS-PACKER -ImageType Windows2022Base -AzureLocation "East US" -AzureClientId 52563be7-6764-4964-b3dc-beb18e7623d2 -AzureClientSecret "~H48Q~tiI1SZXH~GNq8SdqSI_9yXS124.GjHNb8Q" -AzureTenantId d6525c95-b906-431a-b926-e9b51ba43cc4 -VirtualNetworkName vnet-yukon-sbx-eus -VirtualNetworkResourceGroupName "ETN-ES-Yukon-Infra-Primary" -VirtualNetworkSubnetName AppSubnet -GalleryName "etn_packer_gallery" -ReuseResourceGroup diff --git a/helpers/GenerateResourcesAndImage.ps1 b/helpers/GenerateResourcesAndImage.ps1 index f66c3f752ae0..e4ef14f067c1 100644 --- a/helpers/GenerateResourcesAndImage.ps1 +++ b/helpers/GenerateResourcesAndImage.ps1 @@ -318,35 +318,35 @@ Function GenerateResourcesAndImage { throw "Non-interactive mode, resource group '$ResourceGroupName' already exists, either specify -Force to delete it, or -ReuseResourceGroup to reuse." } else { - # Resource group already exists, ask the user what to do - $title = "Resource group '$ResourceGroupName' already exists" - $message = "Do you want to delete the resource group and all resources in it?" - - $options = @( - #[System.Management.Automation.Host.ChoiceDescription]::new("&Yes", "Delete the resource group and all resources in it."), - [System.Management.Automation.Host.ChoiceDescription]::new("&No", "Keep the resource group and continue."), - # [System.Management.Automation.Host.ChoiceDescription]::new("&Abort", "Abort execution.") - ) - $result = $Host.UI.PromptForChoice($title, $message, $options, 0) - } - - switch ($result) { - 0 { - # Delete and recreate the resource group - Write-Host "Deleting resource group '$ResourceGroupName'..." - #az group delete --name $ResourceGroupName --yes - if ($LastExitCode -ne 0) { - throw "Failed to delete resource group '$ResourceGroupName'." - } - Write-Host "Resource group '$ResourceGroupName' was deleted." - $ResourceGroupExists = $false - } - 1 { - # Keep the resource group and continue - } - 2 { - # Stop the current action - Write-Error "User stopped the action." + # # Resource group already exists, ask the user what to do + # $title = "Resource group '$ResourceGroupName' already exists" + # $message = "Do you want to delete the resource group and all resources in it?" + + # $options = @( + # #[System.Management.Automation.Host.ChoiceDescription]::new("&Yes", "Delete the resource group and all resources in it."), + # [System.Management.Automation.Host.ChoiceDescription]::new("&No", "Keep the resource group and continue."), + # # [System.Management.Automation.Host.ChoiceDescription]::new("&Abort", "Abort execution.") + # ) + # $result = $Host.UI.PromptForChoice($title, $message, $options, 0) + # } + + # switch ($result) { + # 0 { + # # Delete and recreate the resource group + # Write-Host "Deleting resource group '$ResourceGroupName'..." + # #az group delete --name $ResourceGroupName --yes + # if ($LastExitCode -ne 0) { + # throw "Failed to delete resource group '$ResourceGroupName'." + # } + # Write-Host "Resource group '$ResourceGroupName' was deleted." + # $ResourceGroupExists = $false + # } + # 1 { + # # Keep the resource group and continue + # } + # 2 { + # # Stop the current action + # Write-Error "User stopped the action." exit 1 } }