Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
30 commits
Select commit Hold shift + click to select a range
bd72b33
Update .gitignore with new exclusions
potatoqualitee Jul 19, 2025
3089321
Add devcontainer setup and AI
potatoqualitee Jul 19, 2025
cb0833b
Add preview release workflow and update build process
potatoqualitee Jul 19, 2025
c301682
Refactor build scripts and add MSI install helper
potatoqualitee Jul 19, 2025
736ebca
Update target frameworks and add publish profile
potatoqualitee Jul 19, 2025
230c986
Add DbaRenewableToken wrapper class
potatoqualitee Jul 19, 2025
4ba72b0
Update target frameworks and package dependencies
potatoqualitee Jul 19, 2025
41a993b
Update project configuration and dependencies (Claude minimal changes)
potatoqualitee Jul 19, 2025
13c58d5
Update SQL Server and AnalysisServices DLLs
potatoqualitee Jul 19, 2025
fe27b6c
Simplify SqlClient and LumenWorks import logic
potatoqualitee Jul 19, 2025
6cdf0f5
Update default dbatools branch in build workflow
potatoqualitee Jul 19, 2025
6a48de0
Azure.Core - Update assembly list for PowerShell editions
potatoqualitee Jul 19, 2025
7379b0d
Add Azure.Core and Azure.Identity to assembly list
potatoqualitee Jul 19, 2025
4a20f78
Bump module version to 2025.7.19
potatoqualitee Jul 19, 2025
d895f66
Refactor sqlpackage path detection in build workflow
potatoqualitee Jul 19, 2025
aeb7f3d
Change sqlpackage error to warning in build workflow
potatoqualitee Jul 19, 2025
1dc4062
Update sqlpackage not found warning in build workflow
potatoqualitee Jul 19, 2025
c21ce8d
Improve sqlpackage search in build workflow
potatoqualitee Jul 19, 2025
9d41199
Fix sqlpackage path casing in build workflow
potatoqualitee Jul 19, 2025
635c665
Update build workflow for core library artifacts
potatoqualitee Jul 19, 2025
c4c0ae5
Update NuGet package versions in dbatools.csproj
potatoqualitee Jul 19, 2025
7032c54
Add Microsoft.Bcl.AsyncInterfaces to DLL imports
potatoqualitee Jul 19, 2025
3f37418
Add System.Text.Json to required assemblies
potatoqualitee Jul 19, 2025
6e20bf8
Add Windows-specific GAC reference for net472
potatoqualitee Jul 19, 2025
9d4a955
Add PowerShell SDK reference for non-Windows net472
potatoqualitee Jul 19, 2025
57cbab3
Update sqlpackage paths in CI workflows
potatoqualitee Jul 19, 2025
a6dd4f2
Remove handling of 'private' directory from build scripts
potatoqualitee Jul 19, 2025
804a8fc
Merge branch 'main' into freshold
potatoqualitee Jul 19, 2025
16b0576
Remove mcp.json configuration file
potatoqualitee Jul 19, 2025
42e04ea
Remove sqlpackage GitHub Actions workflow
potatoqualitee Jul 19, 2025
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 1 addition & 2 deletions .claude/settings.local.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
{
"model": "opus",
"model": "sonnet",
"cleanupPeriodDays": 30,
"dangerously-skip-permissions": true,
"permissions": {
"defaultMode": "bypassPermissions",
"allow": ["*"],
Expand Down
4 changes: 3 additions & 1 deletion .devcontainer/devcontainer.json
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,9 @@
}
},
"terminal.integrated.shell.linux": "pwsh",
"terminal.integrated.defaultProfile.linux": "pwsh"
"terminal.integrated.defaultProfile.linux": "pwsh",
"powershell.developer.editorServicesLogLevel": "Error",
"powershell.integratedConsole.suppressStartupBanner": true
},
"extensions": [
"ms-vscode.powershell",
Expand Down
1 change: 1 addition & 0 deletions .devcontainer/scripts/profile.ps1
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
$env:POWERSHELL_UPDATECHECK = 'Off'
145 changes: 92 additions & 53 deletions .github/workflows/build-release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,32 @@ on:
required: false

jobs:
linux-build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4

- name: Setup .NET
uses: actions/setup-dotnet@v4
with:
dotnet-version: |
8.0.x
6.0.x

- name: Build core/lib
shell: pwsh
run: |
./build/build.ps1 -CoreOnly

- name: Upload Linux artifacts
uses: actions/upload-artifact@v4
with:
name: core-lib-linux
path: artifacts/dbatools.library/core/lib/

build-windows:
runs-on: windows-latest
needs: linux-build

steps:
- name: Checkout code
Expand All @@ -45,7 +69,23 @@ jobs:
shell: pwsh
run: |
# Run the build script
.\build\build.ps1
.\build\build.ps1 -BuildZip

- name: Download Linux artifacts
uses: actions/download-artifact@v4
with:
name: core-lib-linux
path: artifacts/core-lib-linux/

- name: Extract core-lib-linux artifact and copy to core/lib
shell: pwsh
run: Copy-Item -Path "artifacts/core-lib-linux/*" -Destination "artifacts/dbatools.library/core/lib" -Recurse -Force

- name: Ensure sqlpackage is executable
shell: pwsh
run: |
chmod +x ./artifacts/dbatools.library/core/lib/dac/linux/sqlpackage
chmod +x ./artifacts/dbatools.library/core/lib/dac/mac/sqlpackage

- name: Verify critical files and directories
shell: pwsh
Expand All @@ -56,14 +96,13 @@ jobs:
$criticalPaths = @(
"desktop\lib",
"desktop\lib\runtimes\win-x64\native",
"core\lib\dac\windows",
"desktop\third-party",
"core\lib",
"core\lib\runtimes\win-x64\native",
"core\lib\dac\windows",
"core\lib\dac\linux",
"core\lib\dac\mac",
"core\third-party",
"private"
"core\third-party"
)

$missingPaths = @()
Expand Down Expand Up @@ -110,7 +149,7 @@ jobs:
path: artifacts/dbatools.library.zip

test-sqlpackage:
name: Test SqlPackage on ${{ matrix.os }}
name: Test sqlpackage on ${{ matrix.os }}
runs-on: ${{ matrix.os }}
needs: build-windows
strategy:
Expand Down Expand Up @@ -144,7 +183,7 @@ jobs:
exit 1
}

- name: Test SqlPackage
- name: Test sqlpackage
shell: pwsh
run: |
# Import the built module
Expand All @@ -158,71 +197,68 @@ jobs:
Write-Host "Module loaded successfully with version: $($module.Version)"
Write-Host "Module path: $($module.ModuleBase)"

# Determine SqlPackage path based on OS
# Determine sqlpackage path based on OS
$modulePath = $module.ModuleBase
if ($IsWindows -or $PSVersionTable.PSVersion.Major -eq 5) {
Write-Host "Testing Windows SqlPackage..."
$dacPath = Join-Path $modulePath "core/lib/dac/windows"
$sqlPackageName = "SqlPackage.exe"
} elseif ($IsLinux) {
Write-Host "Testing Linux SqlPackage..."
$dacPath = Join-Path $modulePath "core/lib/dac/linux"
$sqlPackageName = "SqlPackage"
} elseif ($IsMacOS) {
Write-Host "Testing macOS SqlPackage..."
$dacPath = Join-Path $modulePath "core/lib/dac/mac"
$sqlPackageName = "SqlPackage"
} else {
Write-Error "Unknown operating system"
exit 1
}
$sqlPackageName = @(
(Join-Path $modulePath "desktop/lib/dac/SqlPackage.exe"),
(Join-Path $modulePath "core/lib/dac/windows/sqlpackage.exe"),
(Join-Path $modulePath "core/lib/dac/linux/sqlpackage"),
(Join-Path $modulePath "core/lib/dac/mac/sqlpackage")
)

# Check if SqlPackage directory exists
if (-not (Test-Path $dacPath)) {
Write-Error "SqlPackage directory not found: $dacPath"
Write-Host "Available directories in core/lib:"
Get-ChildItem (Join-Path $modulePath "core/lib") -Directory | ForEach-Object { Write-Host " - $($_.Name)" }
exit 1
foreach ($sqlPackage in $sqlPackageName) {
if (Test-Path $sqlPackage) {
Write-Host "Found sqlpackage at: $sqlPackage"
} else {
Write-Warning "sqlpackage not found: $sqlPackage"
Write-Host "Available directories in module"
Get-ChildItem $modulePath -Recurse | Where-Object Name -match sqlpack | Select-Object Fullname
}
}

# Check if SqlPackage executable exists
$sqlPackagePath = Join-Path $dacPath $sqlPackageName
if (-not (Test-Path $sqlPackagePath)) {
Write-Error "SqlPackage executable not found: $sqlPackagePath"
Write-Host "Files in $dacPath :"
Get-ChildItem $dacPath | ForEach-Object { Write-Host " - $($_.Name)" }
exit 1
$sqlPackagePath = if ($IsMacOS) {
Join-Path $modulePath "core/lib/dac/mac/sqlpackage"
} elseif ($IsLinux) {
Join-Path $modulePath "core/lib/dac/linux/sqlpackage"
} else {
# if core then core
if ($PSVersionTable.PSEdition -eq 'Core') {
Join-Path $modulePath "core/lib/dac/windows/sqlpackage.exe"
} else {
# if desktop then desktop
Join-Path $modulePath "desktop/lib/dac/SqlPackage.exe"
}
}

Write-Host "SqlPackage found at: $sqlPackagePath"
Write-Host "Using sqlpackage at: $sqlPackagePath"

# Make SqlPackage executable on non-Windows platforms
# Make sqlpackage executable on non-Windows platforms
if ($IsLinux -or $IsMacOS) {
chmod +x $sqlPackagePath
}

# Test SqlPackage execution
# Test sqlpackage execution
try {
Write-Host "Testing SqlPackage execution..."
Write-Host "Testing sqlpackage execution..."
$versionOutput = & $sqlPackagePath /Version 2>&1
Write-Host "SqlPackage version: $versionOutput"
Write-Host "sqlpackage version: $versionOutput"

# Basic functionality test - show help
Write-Host "`nTesting SqlPackage help command..."
Write-Host "`nTesting sqlpackage help command..."
$helpOutput = & $sqlPackagePath /? 2>&1 | Select-Object -First 10
$helpOutput | ForEach-Object { Write-Host $_ }
Write-Host "... (output truncated)"

# Verify expected output from help
$helpString = $helpOutput -join "`n"
if ($helpString -match "Specifies a name value pair" -or $helpString -match "SqlPackage" -or $helpString -match "Command") {
Write-Host "`nSqlPackage test completed successfully!"
if ($helpString -match "Specifies a name value pair" -or $helpString -match "sqlpackage" -or $helpString -match "Command") {
Write-Host "`nsqlpackage test completed successfully!"
} else {
Write-Error "SqlPackage help output does not contain expected content"
Write-Error "sqlpackage help output does not contain expected content"
exit 1
}
} catch {
Write-Error "Failed to execute SqlPackage: $_"
Write-Error "Failed to execute sqlpackage: $_"
exit 1
}

Expand Down Expand Up @@ -252,7 +288,7 @@ jobs:
}

# Download dbatools from GitHub
$branch = "${{ github.event.inputs.dbatools_branch || 'newver' }}"
$branch = "${{ github.event.inputs.dbatools_branch || 'newestver' }}"
Write-Host "Downloading dbatools from GitHub (branch: $branch)..."

$zipUrl = "https://github.com/dataplat/dbatools/archive/refs/heads/$branch.zip"
Expand Down Expand Up @@ -309,17 +345,20 @@ jobs:
Write-Host "Importing dbatools..."
Import-Module dbatools -Force

Write-Host "Testing Get-DbaManagementObject..."
Write-Host "Testing Connect-DbaInstance..."
try {
$result = Get-DbaManagementObject
Write-Host "Test passed: Get-DbaManagementObject ran without fail"
$result = Connect-DbaInstance -SqlInstance localhost
} catch {
Write-Error "Test failed with exception: $_"
exit 1
if ($PSItem.Exception.Message -notmatch "not accessible") {
Write-Error "Test failed with exception: $_"
exit 1
} else {
Write-Host "Test failed successfully (lol) with inaccessible instance message: $($PSItem.Exception.Message)" -ForegroundColor Green
}
}

create-preview-release:
needs: [build-windows, test-sqlpackage]
needs: [linux-build, build-windows, test-sqlpackage]
runs-on: windows-latest
# Create release if manually triggered OR if version contains "preview"
if: github.event_name == 'workflow_dispatch' || github.event_name == 'push'
Expand Down
44 changes: 39 additions & 5 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,14 +5,42 @@ defaults:
run:
shell: pwsh
jobs:
# Linux tests are disabled - build-core.ps1 script not found
# Keeping Windows build test only for now
linux-build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4

- name: Setup .NET
uses: actions/setup-dotnet@v4
with:
dotnet-version: |
8.0.x
6.0.x

- name: Build core/lib
shell: pwsh
run: |
./build/build.ps1 -CoreOnly

- name: Upload Linux artifacts
uses: actions/upload-artifact@v4
with:
name: core-lib-linux
path: artifacts/dbatools.library/core/lib/

windows-tests:
runs-on: windows-latest
needs: linux-build

steps:
- uses: actions/checkout@v4

- name: Download Linux artifacts
uses: actions/download-artifact@v4
with:
name: core-lib-linux
path: artifacts/dbatools.library/core/lib/

- name: Setup .NET
uses: actions/setup-dotnet@v4
with:
Expand All @@ -31,6 +59,13 @@ jobs:
run: |
./build/build.ps1

- name: Copy Linux core/lib files
shell: pwsh
run: |
Copy-Item -Path artifacts/core-lib-linux/* -Destination artifacts/dbatools.library/core/lib/ -Recurse -Force
# delete windows sqlpackage on core cuz its the same as desktop
Remove-Item -Path artifacts/dbatools.library/core/lib/dac/windows -Recurse -Force -ErrorAction Ignore

- name: Verify critical files and directories
shell: pwsh
run: |
Expand All @@ -39,15 +74,14 @@ jobs:
$artifactsDir = "./artifacts/dbatools.library"
$criticalPaths = @(
"desktop\lib",
"desktop\lib\dac",
"desktop\lib\runtimes\win-x64\native",
"desktop\third-party",
"core\lib",
"core\lib\runtimes\win-x64\native",
"core\lib\dac\windows",
"core\lib\dac\linux",
"core\lib\dac\mac",
"core\third-party",
"private"
"core\third-party"
)

$missingPaths = @()
Expand Down
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -40,3 +40,4 @@ lib/
.devcontainer/.env
dbatools.library.zip
/artifacts
.roo/mcp.json
11 changes: 0 additions & 11 deletions .roo/mcp.json

This file was deleted.

13 changes: 8 additions & 5 deletions CLAUDE.md
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,7 @@ Get-DbatoolsLoadedAssembly
1. **Clean**: Removes previous build artifacts
2. **Compile**: Builds C# projects for both target frameworks
3. **Package Dependencies**: Downloads and extracts:
- SQL Server DacFramework (SqlPackage)
- SQL Server DacFramework (sqlpackage)
- Third-party NuGet packages (Bogus, LumenWorks CSV)
- XESmartTarget for Extended Events
4. **Platform Distribution**: Copies assemblies to appropriate platform directories
Expand Down Expand Up @@ -159,17 +159,20 @@ This file provides guidance to Claude Code (claude.ai/code) when working with co
## Development Commands

### Testing

> **Note:** The following test commands reference Appveyor and Windows PowerShell scripts. For modern Linux/macOS/PowerShell Core setups or non-Appveyor CI, substitute with appropriate Pester/Invoke-Pester commands, and paths using forward slashes as needed.

```powershell
# Run all tests
# Run all tests (legacy, Windows/Appveyor)
.\tests\appveyor.pester.ps1

# Run tests with code coverage
# Run tests with code coverage (Windows/Appveyor)
.\tests\appveyor.pester.ps1 -IncludeCoverage

# Run specific test file
# Run specific test file (cross-platform)
Invoke-Pester ./tests/Get-DbaDatabase.Tests.ps1

# Finalize test results
# Finalize test results (Windows/Appveyor)
.\tests\appveyor.pester.ps1 -Finalize
```

Expand Down
Loading
Loading