Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Bump minor version to 24, improve local setup (undo-local) reliability, update module version format logic, and enhance module removal checks, complete round of work to optimize build for local testing (run Local.ps1 for quick testing, Local.ps1 -Package -Analyze for pre PR test of packaging, etc) #41

Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 7 additions & 7 deletions Build.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ param (

[Parameter()]
[Int16]
$minorVersion = 23,
$minorVersion = 24,

[Parameter()]
[Int16]
Expand Down Expand Up @@ -54,14 +54,14 @@ Process {
Push-Location src/AzKube

# Increment the module version to the format yymmdd.hhmm.ss
if ($Package) {
# if ($Package) {
$moduleVersion = $("$majorVersion.$minorVersion.$patchVersion")
}
else {
$moduleVersion = $(Get-Date).ToString('yyMMdd.HHmm.ss')
}
# }
# else {
# $moduleVersion = $(Get-Date).ToString('yyMMdd.HHmm.ss')
# }
# $moduleVersion = $("$majorVersion.$minorVersion.$patchVersion+$((Get-Date).ToString('yyMMdd.HHmm.ss'))")
Write-Host "Incrementing module version to $moduleVersion"
Write-Host "Setting module version to $moduleVersion"


# Create the module manifest
Expand Down
25 changes: 21 additions & 4 deletions Undo-Local.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -3,12 +3,19 @@
# .\Undo-Local.ps1
#

$nugetRepoPath = "$PSScriptRoot\src\AzKube\NuGetRepo"

# Remove the module from the local repository
if (Get-Module -Name AzKube) {
Remove-Module -Name AzKube -Force

# Verify the module is removed
Get-Module -Name AzKube
if (!(Get-Module -Name AzKube -ErrorAction SilentlyContinue)) {
Write-Host "The AzKube module has been removed"
}
else {
Write-Host "The AzKube module has not been removed"
}
}

# Uninstall the module
Expand All @@ -22,11 +29,21 @@ Unregister-PSRepository -Name AzKubeRepo -ErrorAction SilentlyContinue
Push-Location $PSScriptRoot

# Remove the NuGet repository
Remove-Item -Path ./src/AzKube/NuGetRepo -Force -Recurse
if (Test-Path $nugetRepoPath) {
Remove-Item -Path $nugetRepoPath -Force -Recurse
}

# Remove the module from the PSModulePath
$path = (Resolve-Path '.').Path
$path = (Resolve-Path './src/AzKube').Path
$path
if ($env:PSModulePath -like "*$path*") {
$env:PSModulePath = $env:PSModulePath -replace ";$path", ""
$escapedAzKubePath = $path -replace "\\", "\\\\\\\\"
$escapedAzKubePath
$escapedPSModulePath = $env:PSModulePath -replace "\\", "\\\\"
$removedPath = $escapedPSModulePath -replace ";$escapedAzKubePath", ""
$removedPath
if ($removedPath -ne '') {
$env:PSModulePath = $removedPath -replace "\\\\\\\\", "\"
}
}
Pop-Location
8 changes: 4 additions & 4 deletions src/AzKube/AzKube.psd1
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
RootModule = './AzKube.psm1'

# Version number of this module.
ModuleVersion = '0.22.0'
ModuleVersion = '0.24.0'

# Supported PSEditions
# CompatiblePSEditions = @()
Expand Down Expand Up @@ -101,7 +101,7 @@ PrivateData = @{
# LicenseUri = ''

# A URL to the main website for this project.
# ProjectUri = ''
ProjectUri = 'https://github.com/dmealo/AzKube'

# A URL to an icon representing this module.
# IconUri = ''
Expand All @@ -120,10 +120,10 @@ PrivateData = @{

} # End of PSData hashtable

} # End of PrivateData hashtable
} # End of PrivateData hashtable

# HelpInfo URI of this module
# HelpInfoURI = ''
HelpInfoURI = 'https://github.com/dmealo/AzKube/README.md'

# Default prefix for commands exported from this module. Override the default prefix using Import-Module -Prefix.
# DefaultCommandPrefix = ''
Expand Down
4 changes: 2 additions & 2 deletions src/AzKube/private/Aks-Utilities.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -111,16 +111,16 @@ function Install-AzModule {

# Install PSMenu if not already installed
function Install-PSMenu {
Write-Host "Installing PSMenu module..."
if (-not (Get-Command Show-Menu -ErrorAction SilentlyContinue)) {
Write-Host "Installing PSMenu module..."
Install-Module -Name PSMenu -Force
}
}

# Function to install kubectl using WinGet if not already installed
function Install-Kubectl {
Write-Host "Installing kubectl using WinGet..."
if (-not (Get-Command kubectl -ErrorAction SilentlyContinue)) {
Write-Host "Installing kubectl using WinGet..."
winget install --id Kubernetes.kubectl -e
}
}
Expand Down
13 changes: 10 additions & 3 deletions src/AzKube/public/Set-AksClusters.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -35,11 +35,20 @@ function Set-AksClusters {
$SkipTestActions
)

Clear-Host

$appTitle = "AzKube"
$Title = " | Starting..."

. "$PSScriptRoot\..\private\Aks-Utilities.ps1"
. "$PSScriptRoot\..\private\Aks-Ui-Utilities.ps1"

$ProxyUrl = Get-DefaultProxyUrl -ProxyUrl $ProxyUrl

Write-Host
Write-Host $appTitle -ForegroundColor Blue -NoNewline
Write-Host $Title -ForegroundColor Cyan

Install-AzureCli
Install-PsMenu

Expand All @@ -48,9 +57,6 @@ function Set-AksClusters {
do {
# Create and use a new TenantList object to get all tenants
Clear-Host
Write-Host
Write-Host "Loading interface..." -ForegroundColor Cyan
Clear-Host
if ($global:SelectedTenant) {
# Use the saved tenant to initialize your tenant list
$tenant.SelectedTenant = $global:SelectedTenant
Expand All @@ -62,6 +68,7 @@ function Set-AksClusters {
$global:SelectedTenant = $tenant.SelectedTenant
}
}

# Display or select tenant if not already set
$tenant.DisplaySelectedTenant()

Expand Down