init commit 2

This commit is contained in:
iFlip721
2025-04-16 10:06:55 -04:00
parent a03209dc9e
commit a7f9f1799f
6 changed files with 76 additions and 150 deletions

View File

@@ -13,17 +13,6 @@ Already a pro? Just edit this README.md and make it your own. Want to make it ea
- [ ] [Create](https://docs.gitlab.com/ee/user/project/repository/web_editor.html#create-a-file) or [upload](https://docs.gitlab.com/ee/user/project/repository/web_editor.html#upload-a-file) files
- [ ] [Add files using the command line](https://docs.gitlab.com/ee/gitlab-basics/add-file.html#add-a-file-using-the-command-line) or push an existing Git repository with the following command:
```
cd existing_repo
git remote add origin https://gitlab.dcma.mil/sdg/powershell/posh-PowerPlatformToolkit.git
git branch -M main
git push -uf origin main
```
## Integrate with your tools
- [ ] [Set up project integrations](https://gitlab.dcma.mil/sdg/powershell/posh-PowerPlatformToolkit/-/settings/integrations)
## Collaborate with your team
- [ ] [Invite team members and collaborators](https://docs.gitlab.com/ee/user/project/members/)

View File

@@ -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

View File

@@ -2,8 +2,8 @@
[CmdLetBinding()]
Param (
[Alias('env')]
[ValidateSet('DCMA_DEV', 'DCMA_Sustainment', 'DCMA_TEST', 'DCMA_PROD', 'ACP-DCMA-CDE-DEV', 'ACP-DCMA-CDE-PROD')]
[string]$Environment = 'DCMA_DEV',
[ValidateSet('DEV', 'STAGING', 'TESTING')]
[string]$Environment = 'DEV',
$Path = (Get-Location).Path,
[Alias('m')]
[switch]$Managed,
@@ -12,7 +12,7 @@
[Alias('sn')]
[switch]$SolutionName
)
begin {
$Path = @{
@@ -26,10 +26,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})
function ConfiguredEnvironments () {
if (!$env) {
do {
@@ -44,7 +44,7 @@
return ($config.env | ?{$_.id -eq $environmentId})
}
}
function NameThatSolution () {
#Write-Host "┌───────────────────────────────────────────────────────────────┐" -ForegroundColor Green
#Write-Host "│" -ForegroundColor Green -NoNewLine; Write-Host "`t`t`tNAME THAT SOLUTION`t`t`t" -ForegroundColor Cyan -NoNewline; Write-Host "│" -ForegroundColor Green
@@ -64,7 +64,7 @@
#$Path.leaf = $solutionNewName
return $solutionNewName
}
function GetAvailablePatches () {
#Write-Host "┌───────────────────────────────────────────────────────────────┐" -ForegroundColor Green
#Write-Host "│" -ForegroundColor Green -NoNewLine; Write-Host "`t`t`tAVAILABLE PATCHES`t`t`t" -ForegroundColor Cyan -NoNewline; Write-Host "│" -ForegroundColor Green
@@ -100,11 +100,11 @@
}
}
process {
$pacAuthResponse = & $Global:pptConfig.pacPath auth list
switch ($pacAuthResponse) {
{$_ -match 'No profiles were found on this computer'} {
@@ -126,15 +126,15 @@
$IsAuth = $false
}#>
}
{$_ -match '\*'} {
Write-Host "[ Info ] " -ForegroundColor Green -nonewline
write-host "Authentication profile found" -ForegroundColor Cyan
& $Global:pptConfig.pacPath org select -env $env.env_id
$IsAuth = $true}
#Default {Write-Warning -Message "Unhandled exception"; return}
}
Switch($Patch) {
@@ -162,18 +162,18 @@
Write-Host "[ Info ] " -ForegroundColor Green -nonewline; write-host "Building $(If($Managed){'managed'}else{'unmanaged'}) solution" -ForegroundColor Cyan
& $Global:pptConfig.pacPath solution export --name $Path.leaf -ow --path $Path.path $(if($Managed){'--managed'})
& $Global:pptConfig.pacPath solution unpack --zipfile "$($Path.leaf)$(If($Managed){'_managed'}).zip" --folder $Path.path -pca --packagetype $(If($Managed){'Managed'}else{'Unmanaged'}) --errorLevel Verbose
} else {
Write-Host '[ Error ] ' -ForegroundColor Yellow -nonewline; write-host 'Fatal exception' -ForegroundColor Red
return
}
}
}
}
end {
If($SolutionName) {

View File

@@ -1,53 +1,21 @@
$global:pptConfig = @{
#############################################
#
# Relative path access to pac-cli binary
# Modifications to relative path are considered advanced features
#
pacPath = (Join-Path -Path $PSScriptRoot -ChildPath 'bin\pac\tools\pac.exe')
#pacPath = "C:\ProgramData\.vscode\settings\User\globalStorage\microsoft-isvexptools.powerplatform-vscode\pac\tools\pac.exe"
#############################################
#
# Config variable property containing a list of all GitLab parent
# groups required for development team(s)
#
# Example Hierarchy:
# MAI (parent group)
# |
# |_ Steampunk (child group)
# | |_ CCAS (repo)
# | |_ Fraud (repo)
# | |_ GCMM (repo)
# |
# |_ development (child group)
# | |_ dcma-mai-cams (repo)
# | |_ dcma-mai-cmt (repo)
# |
# |_ common (child group)
#
# SDG (parent group)
# |
# |_ PowerApp (child group)
# | |_ BuildScripts (repo)
# | |_ OnBoardingOffboarding (repo)
# | |_ RemoteworkAgreement (repo)
# | |_ SDG-Connection-Segment (repo)
# |
# |_ Support (child group)
# |_ pac-cli (repo)
# |_ VSCode Extensions (repo)
#
gitParentGroup = @(
'PowerPlatform'
)
#############################################
#
# Config variable property containing a list of all GitLab child
# Config variable property containing a list of all GitLab child
# groups required for development team(s)
#
@@ -56,4 +24,4 @@ $global:pptConfig = @{
'Support'
'PowerApp'
)
}
}

View File

@@ -1,38 +1,22 @@
{
"project": {
"solutionName": "<SOLUTION NAME HERE>"
"project": {
"solutionName": "<SOLUTION NAME HERE>"
},
"env": [
{
"id": 1,
"name": "DEV",
"env_id": ""
},
"env": [
{
"id": 1,
"name": "DCMA_DEV",
"env_id": "29e06d80-49ea-4b5a-8369-3be0329da8fc"
},
{
"id": 2,
"name": "DCMA_TEST",
"env_id": "3ddc5ce7-74d2-43d2-8324-17ba7baf8640"
},
{
"id": 3,
"name": "DCMA_PROD",
"env_id": "f9ad359e-3010-42a2-8e91-aa27b4428e44"
},
{
"name": "ACP-DCMA-CDE-DEV",
"env_id": "7d53a00d-09cc-eb21-8348-99a10042d965",
"id": 4
},
{
"name": "ACP-DCMA-CDE-PROD",
"env_id": "28738b65-f434-ed94-9a84-b82e6b1db501",
"id": 5
},
{
"name": "DCMA-Sustainment",
"env_id": "23cbffbd-8f76-46cd-b1cf-1ac3cf478778",
"id": 6
}
]
{
"id": 2,
"name": "STAGING",
"env_id": ""
},
{
"id": 3,
"name": "TESTING",
"env_id": ""
}
]
}

View File

@@ -1,5 +1,5 @@
$source = @{
project = @{
solutionName = "$($Path.leaf)"
}
@@ -7,33 +7,18 @@ $source = @{
env = @(
@{
id = 1
name = "DCMA_DEV"
env_id = "29e06d80-49ea-4b5a-8369-3be0329da8fc"
name = "DEV"
env_id = ""
},
@{
id = 2
name = "DCMA_TEST"
env_id = "3ddc5ce7-74d2-43d2-8324-17ba7baf8640"
name = "STAGING"
env_id = ""
},
@{
id = 3
name = "DCMA_PROD"
env_id = "f9ad359e-3010-42a2-8e91-aa27b4428e44"
},
@{
name = "ACP-DCMA-CDE-DEV"
env_id = "7d53a00d-09cc-eb21-8348-99a10042d965"
id = 4
},
@{
name = "ACP-DCMA-CDE-PROD"
env_id = "28738b65-f434-ed94-9a84-b82e6b1db501"
id = 5
},
@{
name = "DCMA_Sustainment"
env_id = "23cbffbd-8f76-46cd-b1cf-1ac3cf478778"
id = 6
name = "TESTING"
env_id = ""
}
)