init commit 2
This commit is contained in:
@@ -1,13 +1,13 @@
|
||||
function Start-PPTSolutionDeploy {
|
||||
[CmdLetBinding()]
|
||||
Param (
|
||||
[ValidateSet('DCMA_DEV', 'DCMA_Sustainment', 'DCMA_TEST', 'DCMA_PROD', 'ACP-DCMA-CDE-DEV', 'ACP-DCMA-CDE-PROD')]
|
||||
[ValidateSet('DEV', 'STAGING', 'TESTING')]
|
||||
[string]$Environment,
|
||||
$Path = (Get-Location).Path
|
||||
)
|
||||
|
||||
|
||||
begin {
|
||||
|
||||
|
||||
$Path = @{
|
||||
qualifier = (Split-Path -Path $Path -Qualifier)
|
||||
parent = (Split-Path -Path $Path)
|
||||
@@ -19,10 +19,10 @@
|
||||
sourceConfig = (Join-Path -Path $PSScriptRoot -ChildPath 'source\config.ps1')
|
||||
sourceIgnore = (Join-Path -Path $PSScriptRoot -ChildPath 'source\.gitignore')
|
||||
}
|
||||
|
||||
|
||||
$config = (Get-Content $Path.pathConfig | ConvertFrom-Json)
|
||||
$env = ($config.env | ?{$_.name -eq $Environment})
|
||||
|
||||
|
||||
if (!$env) {
|
||||
do {
|
||||
#Write-Host "┌───────────────────────────────────────────────────────────────┐" -ForegroundColor Green
|
||||
@@ -33,19 +33,19 @@
|
||||
} while ($environmentId -notin (1..$config.env.Count))
|
||||
$env = ($config.env | ?{$_.id -eq $environmentId})
|
||||
}
|
||||
|
||||
|
||||
If((Get-ChildItem -Path $Path.path -Name *.zip).Count -ge 1) {
|
||||
$index = 1
|
||||
$solutions = Get-ChildItem -Path $Path.path -Name *.zip | Get-Item | ForEach-Object {
|
||||
@{
|
||||
@{
|
||||
$index++ = @{
|
||||
id = $index - 1
|
||||
name = "$($_.Name)"
|
||||
fullname = $_.FullName
|
||||
directory = $_.Directory
|
||||
basename = $_.BaseName
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
do {
|
||||
#Write-Host "┌───────────────────────────────────────────────────────────────┐" -ForegroundColor Green
|
||||
@@ -60,9 +60,9 @@
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
process {
|
||||
|
||||
|
||||
if(!(Test-Path "$($Path.path)\$($env.name).$($env.env_id).$($Path.leaf).json")) {
|
||||
|
||||
Write-Warning -Message "Missing settings file for $($env)"
|
||||
@@ -72,17 +72,17 @@
|
||||
|
||||
Write-Host "[ Info ] " -ForegroundColor Green -nonewline
|
||||
Write-Host "Using settings for environment: $($env)" -ForegroundColor Cyan
|
||||
|
||||
|
||||
}
|
||||
|
||||
<#if (!(Test-Path "$($Path.path)\DCMA_DEV*.json") -or !(Test-Path "$($Path.path)\DCMA_TEST*.json") -or !(Test-Path "$($Path.path)\DCMA_PROD*.json") -or !(Test-Path "$($Path.path)\ACP-DCMA-CDE-DEV*.json") -or !(Test-Path "$($Path.path)\ACP-DCMA-CDE_PROD*.json")) {
|
||||
|
||||
<#if (!(Test-Path "$($Path.path)\DEV*.json") -or !(Test-Path "$($Path.path)\STAGING*.json") -or !(Test-Path "$($Path.path)\TESTING*.json")) {
|
||||
|
||||
Write-Warning -Message "Missing settings file for environment(s)"
|
||||
return
|
||||
}#>
|
||||
|
||||
|
||||
$pacAuthResponse = & $Global:pptConfig.pacPath auth list
|
||||
|
||||
|
||||
switch ($pacAuthResponse) {
|
||||
|
||||
{$_ -match 'No profiles were found on this computer'} {
|
||||
@@ -95,7 +95,7 @@
|
||||
} else {
|
||||
$IsAuth = $false
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
{$_ -match '\*'} {
|
||||
@@ -103,29 +103,29 @@
|
||||
write-host "Authentication profile found" -ForegroundColor Cyan
|
||||
$IsAuth = $true
|
||||
& $Global:pptConfig.pacPath org select -env $env.env_id}
|
||||
|
||||
|
||||
#Default {Write-Warning -Message "Unhandled exception"; return}
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
if ((& $Global:pptConfig.pacPath org list | ?{$_ -match '\*'}) -match $env.env_id -and $IsAuth) {
|
||||
|
||||
|
||||
Write-Host "[ Info ] " -ForegroundColor Green -nonewline; write-host "Building solution package" -ForegroundColor Cyan
|
||||
& $Global:pptConfig.pacPath solution import --path "$($Path.path)\$($Path.leaf).zip" --settings-file "$($env.name).$($env.env_id).$($Path.leaf).json" --activate-plugins --publish-changes
|
||||
|
||||
|
||||
} else {
|
||||
|
||||
|
||||
Write-Host '[ Error ] ' -ForegroundColor Yellow -nonewline; write-host 'Fatal exception' -ForegroundColor Red
|
||||
return
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
end {
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
# EXPORT ALIAS
|
||||
|
||||
Reference in New Issue
Block a user