Skip to content

Commit

Permalink
testing for envivariables existence in the repo
Browse files Browse the repository at this point in the history
  • Loading branch information
catelleempei-eaton committed Aug 6, 2024
1 parent 78c0a01 commit 0652175
Show file tree
Hide file tree
Showing 3 changed files with 49 additions and 35 deletions.
23 changes: 20 additions & 3 deletions .github/workflows/coverity-client.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
3 changes: 0 additions & 3 deletions gen.ps1

This file was deleted.

58 changes: 29 additions & 29 deletions helpers/GenerateResourcesAndImage.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -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
}
}
Expand Down

0 comments on commit 0652175

Please sign in to comment.