Skip to content

Commit

Permalink
Break up private functions & search menu bugfix (#152)
Browse files Browse the repository at this point in the history
* copied functions into new directory

* Move Start Migration

* remove functions from start-migration

* move form

* Changes for Form

* move progress form

* process by owner changes

* progress forms changes

* Assets file for forms

* Get-ImageFromB64

* Function Names

* rename Build-Exe

* 2.7.11 version + build module functions

* change patch for new-admuTemplate

* pester tests

* CI changes for functions location

* functions tests

* update several variable names in test /ci

* paths for tests

* update Build tests

* Update VS Settings

* paths for tests

* Get-SID replace

* migration tests paths

* migration tests paths

* remove start-jcadmu.ps1 file

* escape $pid

* write out log content

* skip tests and validate log location in build runner

* not tail log lines

* Write-ToLog shouldn't terminate when writing an error

* order in error messages

* skip functions tests + why are we using silentlyContinue?

* can't skip functions tests

* write-error should be write-warnings until final throw message

* tail and validate local users

* version of artifact action

* add param to build [skip ci]

* write out additional debugging

* CUT-4541 - reinstall search/ start appx for all devices (not just windows 10)

* fixed migration tests by importing the module instead of calling start migration (which no longer contains any private functions)

* variable names and logging changes

* set systemKey in migration tests

* Variable names

* form elements, update to xaml form for MTP selection

* manual tests for uwp + selection form

* mtp selection form background + size

* form changes for selecting another MTP org, manual tests

* Form changes, test-button function updated to test various cases in helper functions

* automate tests for selection form Test-MigrationButton

* test the selection form in ci

* mock names

* Only show option to change ORG is MTP admin is returned

* CUT-4589 Test for selection form on non-valid SID users

* change placeholder text in progress form

* update form to declare form elements before submission

* Add focus controls to prevent checking the name each time a character is pressed (team to discuss)

* CUT-4589 Test-LocalUsername fix

* resolve changes with Get-MtpOrganization tests

* skip migration tests

* manual tests + changes to form, no default password

* updates for local-username tests

* test local username changes

* build date

* update start-migration for Get-MtpOrganization changes

* Update form changes/ test-localUsername

* remove throw in Test-LocalUserName, some devices might not have a user profile to validate like CI

* variable name

* update test-localUsernames after user is created

* temp password should show valid when first viewing the selection form

* incorrectly defined manual test

* show error for username matching hostname

* space in mtp selection
  • Loading branch information
jworkmanjc authored Jan 29, 2025
1 parent 3bb70f4 commit 1a4eabd
Show file tree
Hide file tree
Showing 86 changed files with 5,436 additions and 4,489 deletions.
24 changes: 13 additions & 11 deletions .github/workflows/admu-ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ jobs:
run: |
# validate release type variables
$env:RELEASE_TYPE | Should -BeIn @('major','minor','patch','manual')
Setup-Build-Dependancies:
Setup-Build-Dependencies:
needs: ["Filter-Branch", "Check-PR-Labels", "Validate-Env-Variables"]
runs-on: windows-latest
timeout-minutes: 10
Expand All @@ -68,7 +68,7 @@ jobs:
uses: actions/cache@v4
with:
path: 'C:\Users\runneradmin\Documents\PowerShell\Modules\'
key: PS-Dependancies
key: PS-Dependencies
- name: Install dependencies
if: steps.cacher.outputs.cache-hit != 'true'
shell: pwsh
Expand All @@ -79,7 +79,7 @@ jobs:
Write-Host ('[status]Installing package provider NuGet');
Install-PackageProvider -Name:('NuGet') -Scope:('CurrentUser') -Force
}
# define dependancies for this ci workflow:
# define dependencies for this ci workflow:
$PSDependencies = @{
'PowerShellGet' = @{Repository = 'PSGallery'; RequiredVersion = '3.0.12-beta' }
'ps2exe' = @{Repository = 'PSGallery'; RequiredVersion = '1.0.13' }
Expand All @@ -106,34 +106,36 @@ jobs:
}
}
Build-Module:
needs: ["Setup-Build-Dependancies", "Check-PR-Labels"]
needs: ["Setup-Build-Dependencies", "Check-PR-Labels"]
runs-on: windows-latest
timeout-minutes: 10
steps:
- uses: actions/checkout@v4
- uses: actions/cache@v4
with:
path: 'C:\Users\runneradmin\Documents\PowerShell\Modules\'
key: PS-Dependancies
key: PS-Dependencies
- name: Build ADMU Module
shell: powershell
env:
RELEASE_TYPE: ${{ needs.Check-PR-Labels.outputs.RELEASE_TYPE }}
run: |
. "${{ github.workspace }}/Deploy/build.ps1" -ModuleVersionType $env:RELEASE_TYPE -ModuleName "JumpCloud.ADMU"
- name: Upload Nuspec
uses: actions/upload-artifact@v3
uses: actions/upload-artifact@v4
with:
name: jumpcloud-admu-build
path: |
${{ github.workspace }}/Jumpcloud-ADMU/JumpCloud.ADMU.nuspec
${{ github.workspace }}/Jumpcloud-ADMU/Docs/*.md
${{ github.workspace }}/Jumpcloud-ADMU/Exe/*.exe
${{ github.workspace }}/Jumpcloud-ADMU/Powershell/Form.ps1
${{ github.workspace }}/Jumpcloud-ADMU/en-Us/JumpCloud.ADMU-help.xml
${{ github.workspace }}/Jumpcloud-ADMU/PowerShell/Private/**/*.ps1
${{ github.workspace }}/Jumpcloud-ADMU/PowerShell/Public/**/*.ps1
${{ github.workspace }}/Jumpcloud-ADMU/JumpCloud.ADMU.psd1
${{ github.workspace }}/Jumpcloud-ADMU/JumpCloud.ADMU.psm1
retention-days: 1
Test-Module:
needs: ["Setup-Build-Dependancies", "Check-PR-Labels", "Build-Module"]
needs: ["Setup-Build-Dependencies", "Check-PR-Labels", "Build-Module"]
runs-on: windows-latest
timeout-minutes: 75
strategy:
Expand All @@ -143,13 +145,13 @@ jobs:
steps:
- uses: actions/checkout@v4
- name: Download artifacts
uses: actions/download-artifact@v3
uses: actions/download-artifact@v4
with:
name: jumpcloud-admu-build
- uses: actions/cache@v4
with:
path: 'C:\Users\runneradmin\Documents\PowerShell\Modules\'
key: PS-Dependancies
key: PS-Dependencies
- name: Test PWSH Module
shell: powershell
env:
Expand Down
25 changes: 11 additions & 14 deletions .github/workflows/admu-release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ jobs:
}
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
Setup-Build-Dependancies:
Setup-Build-Dependencies:
needs: ["Filter-Branch", "Check-PR-Labels"]
runs-on: windows-latest
timeout-minutes: 10
Expand All @@ -65,7 +65,7 @@ jobs:
uses: actions/cache@v4
with:
path: 'C:\Users\runneradmin\Documents\PowerShell\Modules\'
key: PS-Dependancies
key: PS-Dependencies
- name: Install dependencies
if: steps.cacher.outputs.cache-hit != 'true'
shell: pwsh
Expand All @@ -76,7 +76,7 @@ jobs:
Write-Host ('[status]Installing package provider NuGet');
Install-PackageProvider -Name:('NuGet') -Scope:('CurrentUser') -Force
}
# define dependancies for this ci workflow:
# define dependencies for this ci workflow:
$PSDependencies = @{
'PowerShellGet' = @{Repository = 'PSGallery'; RequiredVersion = '3.0.12-beta' }
'ps2exe' = @{Repository = 'PSGallery'; RequiredVersion = '1.0.13' }
Expand Down Expand Up @@ -104,14 +104,14 @@ jobs:
}
Build-Sign-ADMU:
runs-on: windows-latest
needs: ["Setup-Build-Dependancies", "Check-PR-Labels"]
needs: ["Setup-Build-Dependencies", "Check-PR-Labels"]
environment: Production
steps:
- uses: actions/checkout@v4
- uses: actions/cache@v4
with:
path: "/home/runner/.local/share/powershell/Modules/"
key: PS-Dependancies
key: PS-Dependencies
- name: Build ADMU Module
shell: powershell
env:
Expand All @@ -121,13 +121,10 @@ jobs:
- name: Pack nuspec
shell: pwsh
run: |
# set psm1 to point to public/start-migartion
$psm1Path = "${{ github.workspace }}/jumpcloud-ADMU/JumpCloud.ADMU.psm1"
$psm1Content = Get-Content -path $psm1Path
$psm1Content = $psm1Content -replace "\\Powershell\\", "\Public\"
Set-Content -Value $psm1Content -Path $psm1Path -Force
# Pack
nuget pack "${{ github.workspace }}/jumpcloud-ADMU/JumpCloud.ADMU.nuspec"
# NU5111 - ignore unrecognized ps1 files not named install/ uninstall or init
# NU5110 - ignore files outside tools folder
nuget pack "${{ github.workspace }}/jumpcloud-ADMU/JumpCloud.ADMU.nuspec" -Properties NoWarn=NU5111,NU5110
- name: Validate NuPkg File
shell: pwsh
run: |
Expand Down Expand Up @@ -169,7 +166,7 @@ jobs:
region: ${{ secrets.AWS_REGION }}
version: ${{ env.RELEASE_VERSION }}
- name: Upload Release Artifacts
uses: actions/upload-artifact@v3
uses: actions/upload-artifact@v4
with:
name: jumpcloud-admu
path: |
Expand All @@ -182,7 +179,7 @@ jobs:
steps:
- uses: actions/checkout@v4
- name: Download ADMU artifact
uses: actions/download-artifact@v3
uses: actions/download-artifact@v4
with:
name: jumpcloud-admu
- name: Build Draft Release
Expand Down Expand Up @@ -211,7 +208,7 @@ jobs:
runs-on: ubuntu-latest
steps:
- name: Download ADMU artifact
uses: actions/download-artifact@v3
uses: actions/download-artifact@v4
with:
name: jumpcloud-admu
- name: Publish
Expand Down
3 changes: 2 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -4,4 +4,5 @@
test_results
JumpCloud.ADMU.nuspec
**/.nupkg
Deploy/ADMU.ps1
Deploy/ADMU.ps1
Deploy/admuTemplate.ps1
20 changes: 19 additions & 1 deletion .vscode/settings.json
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
{

"spellright.language": ["en"],
"spellright.documentTypes": [
"markdown",
Expand All @@ -7,8 +8,25 @@
"yaml",
"powershell"
],
// powershell settings
"powershell.scriptAnalysis.settingsPath": "jumpcloud-ADMU/Powershell/Tests/PSScriptAnalyzerSettings.psd1",
"powershell.codeFormatting.preset": "OTBS",
"powershell.scriptAnalysis.enable": true,
"files.trimTrailingWhitespace": true
// file formatting & saving:
"prettier.enable": true,
"editor.formatOnSave": true,
"files.trimTrailingWhitespace": true,
"search.useIgnoreFiles": false,
// cSpell:
"cSpell.words": [
"ADMU",
],
"cSpell.language": "en",
"cSpell.enabled": true,
"cSpell.enabledFiletypes": [
"latex",
"markdown",
"plaintext",
"powershell"
]
}
119 changes: 0 additions & 119 deletions Deploy/Build-Exe.ps1

This file was deleted.

10 changes: 5 additions & 5 deletions Deploy/Build-Module.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -22,10 +22,10 @@ Write-Host ('[status]Check PowerShell Gallery for module version info')
if ($ManualModuleVersion) {
$ManualModuleVersionRetrieval = Get-Content -Path:($FilePath_psd1) | Where-Object { $_ -like '*ModuleVersion*' }
$SemanticRegex = [Regex]"[0-9]+.[0-9]+.[0-9]+"
$SemeanticVersion = Select-String -InputObject $ManualModuleVersionRetrieval -pattern ($SemanticRegex)
$ModuleVersion = $SemeanticVersion[0].Matches.Value
$semanticVersion = Select-String -InputObject $ManualModuleVersionRetrieval -pattern ($SemanticRegex)
$ModuleVersion = $semanticVersion[0].Matches.Value
} else {
$PSGalleryInfo = Get-PSGalleryModuleVersion -Name:($ModuleName) -ReleaseType:($RELEASETYPE) #('Major', 'Minor', 'Patch')
$PSGalleryInfo = Get-PSGalleryModuleVersion -Name:($ModuleName) -ReleaseType:($ModuleVersionType) #('Major', 'Minor', 'Patch')
$ModuleVersion = $PSGalleryInfo.NextVersion
}
Write-Host ('[status]PowerShell Gallery Name:' + $PSGalleryInfo.Name + ';CurrentVersion:' + $PSGalleryInfo.Version + '; NextVersion:' + $ModuleVersion )
Expand All @@ -48,7 +48,7 @@ New-ModuleManifest -Path:($FilePath_psd1) `
-FunctionsToExport:($Functions_Public.BaseName | Sort-Object) `
-RootModule:((Get-Item -Path:($FilePath_psm1)).Name) `
-ModuleVersion:($ModuleVersion) `
-Author:('JumpCloud Solutions Architect Team') `
-Author:('JumpCloud Customer Tools Team') `
-CompanyName:('JumpCloud') `
-Copyright:('(c) JumpCloud. All rights reserved.') `
-Description:('Powershell Module to run JumpCloud Active Directory Migration Utility.')
Expand All @@ -62,7 +62,7 @@ If ($ModuleChangelogVersion -ne $PSD1Version) {
($NewModuleChangelogRecord + ($ModuleChangelog | Out-String)).Trim() | Set-Content -Path:($FilePath_ModuleChangelog) -Force
} else {
# Get content between latest version and last
$ModuleChangelogContent = Get-Content -Path:($FilePath_ModuleChangelog) | Select -First 3
$ModuleChangelogContent = Get-Content -Path:($FilePath_ModuleChangelog) | Select-Object -First 3
$ReleaseDateRegex = [regex]'(?<=Release Date:\s)(.*)'
$ReleaseDateRegexMatch = $ModuleChangelogContent | Select-String -Pattern $ReleaseDateRegex
$ReleaseDate = $ReleaseDateRegexMatch.Matches.Value
Expand Down
Loading

0 comments on commit 1a4eabd

Please sign in to comment.