-
Notifications
You must be signed in to change notification settings - Fork 9
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix: missing environment variables fails deployment (#84)
* Deployment fails Deployment fails when an environment variable is not found #80 * test: update unit test * test: refactor powershell deployment to pac cli Co-authored-by: DebaMaji <61949539+DebaMaji@users.noreply.github.com> Co-authored-by: Tom Ashworth <tom.ashworth@capgemini.com> Co-authored-by: Max Ewing <max.ewing@capgemini.com>
- Loading branch information
1 parent
e89ac6e
commit 92f498a
Showing
5 changed files
with
32 additions
and
13 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
31 changes: 25 additions & 6 deletions
31
.../Capgemini.PowerApps.PackageDeployerTemplate.IntegrationTests/Resources/DeployPackage.ps1
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,10 +1,29 @@ | ||
$ErrorActionPreference = "Stop" | ||
Write-Host "Installing PAC CLI..." | ||
|
||
Install-Module -Name Microsoft.Xrm.Tooling.PackageDeployment.Powershell -Force -Scope CurrentUser | ||
nuget install Microsoft.PowerApps.CLI -OutputDirectory pac | ||
|
||
$pacNugetFolder = Get-ChildItem "pac" | Where-Object {$_.Name -match "Microsoft.PowerApps.CLI."} | ||
$pacPath = $pacNugetFolder.FullName + "\tools" | ||
$env:PATH = $env:PATH + ";" + $pacPath | ||
|
||
$connectionString = "Url=$env:CAPGEMINI_PACKAGE_DEPLOYER_TESTS_URL; Username=$env:CAPGEMINI_PACKAGE_DEPLOYER_TESTS_USERNAME; Password=$env:CAPGEMINI_PACKAGE_DEPLOYER_TESTS_PASSWORD; AuthType=OAuth; AppId=51f81489-12ee-4a9e-aaae-a2591f45987d; RedirectUri=app://58145B91-0C36-4500-8554-080854F2AC97" | ||
$packageName = "Capgemini.PowerApps.PackageDeployerTemplate.MockPackage.dll" | ||
$packageDirectory = Get-Location | ||
$pacAuthName = "$(New-Guid)".Replace("-", "").SubString(0, 20) | ||
|
||
Write-Host "Create Auth profile with name $pacAuthName..." | ||
pac auth create --name $pacAuthName --url $env:CAPGEMINI_PACKAGE_DEPLOYER_TESTS_URL --username $env:CAPGEMINI_PACKAGE_DEPLOYER_TESTS_USERNAME --password $env:CAPGEMINI_PACKAGE_DEPLOYER_TESTS_PASSWORD | ||
|
||
try { | ||
Write-Host "Running Deploy command..." | ||
pac package deploy --package $packageName --logConsole | ||
} | ||
catch { | ||
Write-Host "An error occurred:" | ||
Write-Host $_.ScriptStackTrace | ||
} | ||
finally { | ||
Write-Host "Deleting Auth profile with name $pacAuthName..." | ||
pac auth delete --name $pacAuthName | ||
} | ||
|
||
|
||
Get-CrmPackages -PackageDirectory $packageDirectory -PackageName $packageName | ||
Import-CrmPackage -CrmConnection $connectionString -PackageDirectory $packageDirectory -PackageName $packageName -LogWriteDirectory $packageDirectory -Verbose | ||
exit 0 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters