Keep k8s in sync with 4ps-k8s (resolved conflicts) - #249
Open
nvleeuwen wants to merge 17 commits into
Open
Conversation
This pull request refactors the way command names are managed and exported in the `NavAppManagement.ps1` script. The main improvement is splitting command names into two distinct groups for better clarity and modularity, and ensuring that commands are associated with their correct modules during export. Grouping and modularity improvements: * Split the original `$commandNames` array into `$commandNamesForAppManagement` and `$commandNamesForManagement`, separating app management commands from general management commands. [[1]](diffhunk://#diff-d9be982fba7fc07c1c187076d0629754734bfb0d83c1fb9c10c76580c7ae4af3L12-R12) [[2]](diffhunk://#diff-d9be982fba7fc07c1c187076d0629754734bfb0d83c1fb9c10c76580c7ae4af3R24-R27) * Updated the PowerShell Core invocation to combine both command groups when calling `Invoke-PwshOverwriting`, ensuring all relevant commands are handled for BC28+ environments. Module association enhancements: * Modified the export logic to associate app management commands with the `Microsoft.BusinessCentral.Apps.Management` module and management commands with the `Microsoft.BusinessCentral.Management` module, improving module clarity and maintainability. fixes [AB#4730](https://dev.azure.com/cc-ppi/83f75d99-795d-45dc-8543-9fe1918ff7f9/_workitems/edit/4730)
…ity (cosmoconsult#226) This pull request makes a small but important change to the logging behavior in the `Get-ArtifactsFromEnvironment` function. The change ensures that any personal access tokens (`pat`) present in artifact JSON data are redacted in the logs to prevent sensitive information from being exposed. * Logging improvement: * Updated the `Write-Host` statement to redact the value of any `"pat"` fields in the artifact JSON output, replacing the actual token with `***REDACTED***` in logs. fixes [AB#4724](https://dev.azure.com/cc-ppi/83f75d99-795d-45dc-8543-9fe1918ff7f9/_workitems/edit/4724)
Move import of demo data from constructW1 with id 11012251 to containerinitializer 50188 for version 28 and up. --------- Co-authored-by: Copilot <copilot@github.com>
…smoconsult#234) [AB#4814](https://dev.azure.com/cc-ppi/83f75d99-795d-45dc-8543-9fe1918ff7f9/_workitems/edit/4814) --------- Co-authored-by: Copilot <copilot@github.com>
…ync) (cosmoconsult#233) This pull request introduces significant improvements to the artifact logging and handling system, focusing on enhanced performance, maintainability, and clarity. The main changes include the introduction of batch logging for artifact logs, refactoring and separation of log writing logic, improvements to the handling of installed app metadata caching, and general code cleanup. **Logging system improvements:** * Introduced batch logging for artifact logs, with new functions `Write-ArtifactsLogBatch` and `Push-ArtifactsLogBatch` to efficiently batch and flush logs, reducing performance overhead and ensuring logs are written in larger, less frequent operations (`artifacts/ArtifactHandling/Log/ArtifactsLogBatch.ps1`, `artifacts/ArtifactHandling/Resolve-DownloadArtifact.ps1`, `artifacts/ArtifactHandling/Invoke-DownloadArtifact.ps1`, `artifacts/ArtifactHandling/Wait-DownloadArtifactAsync.ps1`). [[1]](diffhunk://#diff-f75bd3f39d8752190c1a844ae3cf6fb9d7685d3921218fc8e83cef35f3b01430R1-R24) [[2]](diffhunk://#diff-07ffc85c97482c176d5bc06596e50715288eaef66b622cb95a5741b37c6f3161R23-R39) [[3]](diffhunk://#diff-b847242738c1bb28cd21382bc950794c7bf34cde576e4fb44b6c88caf39d11daR100-R104) [[4]](diffhunk://#diff-92818aaa7fde1d58d21a105399518baf222fe89040bc01c3230506af12580cf0R20-R32) * Replaced the previous `Push-ArtifactsLogEntry` function with the new batch logging mechanism and removed it from the module exports and imports (`artifacts/ArtifactHandling/Log/Push-ArtifactsLogEntry.ps1`, `artifacts/PPIArtifactUtils.psd1`, `artifacts/PPIArtifactUtils.psm1`). [[1]](diffhunk://#diff-589ad4421201506daf9df042b14eeaceaec57ddb1eae845fb66ca0d0391ada4eL1-L20) [[2]](diffhunk://#diff-40730641176b393ccdc4b667f432d8ab43b218b0225042ab9a68bb2f685e2b59L78-R78) [[3]](diffhunk://#diff-dcdc00fc21362a1ec4b17fe88d211e211601e9323ef502089627986b7c92da06R49-R52) **Log writing and suppression logic refactor:** * Separated log writing and suppression logic into a new `Write-ArtifactsLog` function, which handles message formatting, colorization, and suppression of warnings/errors based on environment variables. The `Add-ArtifactsLog` function now delegates output to `Write-ArtifactsLog` unless the new `-Quiet` switch is specified (`artifacts/ArtifactHandling/Log/Write-ArtifactsLog.ps1`, `artifacts/ArtifactHandling/Log/Add-ArtifactsLog.ps1`). [[1]](diffhunk://#diff-dbee066a506ea18f223e20e23424ff1290d661548254509abeacc370c896a063R1-R66) [[2]](diffhunk://#diff-c51e7e808e1e26ef07087726bd8f81a4bd879498f947f5110a033918bc931817L22-R22) [[3]](diffhunk://#diff-c51e7e808e1e26ef07087726bd8f81a4bd879498f947f5110a033918bc931817L47-R47) * Added a `-Quiet` switch to `Add-ArtifactsLog` to allow silent logging when used in batch mode, preventing redundant console output (`artifacts/ArtifactHandling/Log/Add-ArtifactsLog.ps1`). **Artifact handling and performance enhancements:** * Improved installed app metadata handling in `Invoke-NuGetPackageDownload` by introducing a cache file (`.nuget.apps.cache.json`) to avoid redundant parsing of app files and speed up subsequent operations (`artifacts/ArtifactHandling/NuGet/Invoke-NuGetPackageDownload.ps1`). [[1]](diffhunk://#diff-f7566a865796acef3df45bbcc18731caadfd2c79060a9d7506c4e9547d0309a4R26-R27) [[2]](diffhunk://#diff-f7566a865796acef3df45bbcc18731caadfd2c79060a9d7506c4e9547d0309a4L87-R143) **General code cleanup:** * Minor improvements and bug fixes in async wait logic and error handling, including more concise timeout checks and proper variable usage (`base/helper/PPIAsyncUtils/public/Wait-Async.ps1`). [[1]](diffhunk://#diff-44721927c2901704568e14f64b7e753cfaae723c837e15bd04eed879b75ab304L55-R55) [[2]](diffhunk://#diff-44721927c2901704568e14f64b7e753cfaae723c837e15bd04eed879b75ab304L66-R74) * Cleaned up parameters and removed unused or unnecessary variables in logging functions (`artifacts/ArtifactHandling/Log/Add-ArtifactsLog.ps1`). [[1]](diffhunk://#diff-c51e7e808e1e26ef07087726bd8f81a4bd879498f947f5110a033918bc931817L22-R22) [[2]](diffhunk://#diff-c51e7e808e1e26ef07087726bd8f81a4bd879498f947f5110a033918bc931817R33) These changes collectively improve the reliability, performance, and maintainability of the artifact handling and logging system. [AB#4841](https://dev.azure.com/cc-ppi/83f75d99-795d-45dc-8543-9fe1918ff7f9/_workitems/edit/4841) --------- Co-authored-by: Copilot <copilot@github.com>
This pull request makes improvements to the handling of account processing in the `misc/AdditionalSetupAdditionalOwners.ps1` script, specifically for AAD authentication scenarios. The main focus is on ensuring that the current username is included in the accounts list if not already present, and on skipping accounts that are not valid for AAD authentication. **Account handling improvements:** * Ensured that the current username (`$env:username`) is added to the `$accounts` list if it is not already present, preventing accidental omission. * Added logic to skip processing of accounts that do not contain an `@` symbol (i.e., are not valid AAD accounts) when not using `navuserpassword` authentication, with a clear log message for skipped accounts. [AB#4862](https://dev.azure.com/cc-ppi/83f75d99-795d-45dc-8543-9fe1918ff7f9/_workitems/edit/4862) --------- Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
1. When 4PS initialization starts & dev container is requested, try to move all extension to the devscope. 2. use default databaseName,databaseServer and databaseInstance. If they are not defined, pull the values form the service tier. Stop if the values cannot be found. 3. Tested for Onprem containers and container based on SaaS backup (multitenant) 4. Only execute when 4PS initalization is required. do not use when backup, servicerestart etc. 5. For phased rollout: Only do this for 4PS Construct NL for now. When no issues are found, then we can remove this line. In usersettings.json add this setting to make container based on feature branche: "cc-azdevops.additionalFoldersOverride": "https://fps-alpaca.westeurope.cloudapp.azure.com/automation/0.11/startupfile/package/dev?branch=MoveToDevEndpoint" Edit by Maintainer: fixes [AB#4870](https://dev.azure.com/cc-ppi/83f75d99-795d-45dc-8543-9fe1918ff7f9/_workitems/edit/4870)
…n download of NuGet artifacts (cosmoconsult#237) This pull request makes a small update to the `Invoke-NuGetPackageDownload.ps1` script to ensure that certain application metadata fields are always stored as strings. This change improves type consistency and reduces the risk of type-related errors. - Ensured that the `Name`, `Publisher`, `Id`, and `Version` fields in the `$appInfo` object are explicitly cast to strings when extracting application info. Fixes [AB#4874](https://dev.azure.com/cc-ppi/83f75d99-795d-45dc-8543-9fe1918ff7f9/_workitems/edit/4874)
Implements [AB#4882](https://dev.azure.com/cc-ppi/83f75d99-795d-45dc-8543-9fe1918ff7f9/_workitems/edit/4882) - Adds retry to the download of the artifacts - Removes unnecessary filter of NuGet download output - was previously needed to reduce the output for our many NuGet feeds (one per solution) --------- Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
…nsult#240) This pull request improves the robustness and clarity of PowerShell module loading and version checks for Business Central management scripts. The main updates ensure that required modules are properly loaded and provide clearer feedback to users, especially for Business Central 29 and above. **PowerShell Core and Module Loading Enhancements:** * For Business Central 29+, the script now explicitly checks for the presence of PowerShell Core (`pwsh`) and throws a clear error if it's not found. It also imports the `Microsoft.BusinessCentral.Apps.Management.psd1` module globally and invokes the necessary overwriting logic. * The module loading logic for `Microsoft.Dynamics.Nav.Management` in `Invoke-PwshOverwriting` is improved to use `Import-Module` with a descriptive message, ensuring the correct module is loaded and providing user feedback if it is already present. [AB#4900](https://dev.azure.com/cc-ppi/83f75d99-795d-45dc-8543-9fe1918ff7f9/_workitems/edit/4900)
…cosmoconsult#241) Reverts cosmoconsult#240 overseen some issues,
…cosmoconsult#243) This pull request introduces several improvements and fixes to the PowerShell override and artifact handling scripts, with a focus on enhancing compatibility with different Business Central (BC) versions, improving parameter handling, and refactoring the PowerShell Core override mechanism. The changes ensure more robust cross-edition execution, better dynamic parameter support, and clearer error handling. **PowerShell Core Override Refactoring and BC Version Handling:** * Refactored `Export-PwshCoreOverride` to support both remote session and direct execution modes, controlled by a new `UseRemoteSession` parameter. For BC28 and higher, overrides now use direct execution because module import fails in WinRM sessions; for earlier versions, remote sessions are used. This improves compatibility and reliability across BC versions. (`base/helper/PPIOverrides/private/Export-PwshCoreOverride.ps1`, `base/helper/PPIOverrides/public/NavAppManagement.ps1`) [[1]](diffhunk://#diff-af9748083699539e650b9e59d5a2cb67cd17f995014f955c91a061874148ca33L6-R7) [[2]](diffhunk://#diff-af9748083699539e650b9e59d5a2cb67cd17f995014f955c91a061874148ca33L18-R134) [[3]](diffhunk://#diff-d9be982fba7fc07c1c187076d0629754734bfb0d83c1fb9c10c76580c7ae4af3L28-R40) * Updated `Invoke-CommandInPwshCore` to support argument passing and both remote and direct execution, with improved output and error handling for cross-edition compatibility. (`base/helper/PPIPowershellCoreUtils/public/Invoke-CommandInPwshCore.ps1`) **Dynamic Parameter Handling Improvements:** * Improved dynamic parameter generation by updating the logic for identifying and converting deserialized parameter attributes, ensuring better compatibility when parameters are passed between PowerShell editions. (`base/helper/PPIOverrides/public/ConvertTo-DynamicParameter.ps1`, `base/helper/PPIOverrides/public/ConvertTo-DynamicParameters.ps1`) [[1]](diffhunk://#diff-fe876b19c46c22879480371897f1df4127ebe47f4ccb53d1505fe5cab27c918eL22-R25) [[2]](diffhunk://#diff-acaaf056fa92e88609ac764bec4758c97ab3ed3f0ba7add13287448e5a8aeb9cL23-R23) **Artifact Handling and Messaging Fixes:** * Fixed a typo in an informational message in `Get-ArtifactsFromEnvironment` ("not packages / artifacts found" → "no packages / artifacts found"). (`artifacts/ArtifactHandling/Get-ArtifactsFromEnvironment.ps1`) * Ensured that `AppId` is always stored as a string in `Get-AppFilesSortedByDependencies` for consistency. (`artifacts/ArtifactHandling/Get-AppFilesSortedByDependencies.ps1`) **Command Metadata Handling:** * Optimized command metadata retrieval in `Import-AppArtifact` by storing the result of `Get-Command Publish-NAVApp` in a variable, reducing redundant calls and improving performance. (`artifacts/ArtifactHandling/Import-AppArtifact.ps1`) [AB#4900](https://dev.azure.com/cc-ppi/83f75d99-795d-45dc-8543-9fe1918ff7f9/_workitems/edit/4900) --------- Co-authored-by: OleWunschmann <OleWunschmann@users.noreply.github.com> Co-authored-by: Chris Blank <christoph.blank@cosmoconsult.com>
[AB#4918](https://dev.azure.com/cc-ppi/83f75d99-795d-45dc-8543-9fe1918ff7f9/_workitems/edit/4918) Co-authored-by: OleWunschmann <OleWunschmann@users.noreply.github.com>
cosmoconsult#245) **Enhancements for Business Central 29+ compatibility:** * Added a conditional override for `Get-NAVAppInfo` when running on BC29 or higher to convert deserialized `AppId` and `PackageId` properties to their underlying `Value` (GUID) before returning, ensuring compatibility with other cmdlets that expect GUIDs. **Extensibility and output handling improvements:** * Introduced the `ForEachOutputScriptBlock` parameter to `Export-PwshCoreOverride`, allowing custom processing of each output object from the overridden command. * Updated calls to `Export-PwshCoreOverride` for both App Management and Management commands to pass the new `ForEachOutputScriptBlock` parameter. * Modified the invocation of the underlying command in `Export-PwshCoreOverride` to pipe output through the provided `ForEachOutputScriptBlock`, enabling transformation of results as needed. Fixes [AB#4918](https://dev.azure.com/cc-ppi/83f75d99-795d-45dc-8543-9fe1918ff7f9/_workitems/edit/4918) Fixes [AB#4919](https://dev.azure.com/cc-ppi/83f75d99-795d-45dc-8543-9fe1918ff7f9/_workitems/edit/4919) --------- Co-authored-by: OleWunschmann <OleWunschmann@users.noreply.github.com>
This file contains hidden or 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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.