You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Adds composable Aspire DACPAC pipeline steps for SQL database project and package resources:
build-<resource> and publish-<resource> for deterministic DACPAC artifacts and split-job CI;
report-<resource> and script-<resource> for read-only review;
deploy-<resource> for explicit SqlPackage deployment;
IncludeInPublish and IncludeInDeploy opt-ins for aggregate commands;
DacpacSource.File or DacpacSource.Existing for consuming artifacts without rebuilding or restoring the SQL project;
provisioning, dependency, and per-database ordering for aggregate deployment.
The existing aspire run lifecycle remains unchanged and still uses DacFx. Pipeline operations use a pinned SqlPackage through dotnet dnx, keep connection strings out of command-line arguments, and merge user publish-profile options with the Aspire target. Public and polyglot APIs are experimental.
PR Checklist
Created a feature/dev branch in your fork (vs. submitting directly from a commit on main)
Based off latest main branch of toolkit
PR doesn't include merge commits (always rebase on top of our main, if needed)
Tests for the changes have been added (for bug fixes / features) (if applicable)
Contains NO breaking changes
Every new API (including internal ones) has full XML docs
Go and TypeScript polyglot AppHost coverage is included in the test project and passed.
Real SqlPackage probes covered build/publish split jobs, report/script without database mutation, repeated deploy idempotence, and ordered multi-resource aggregate deployment.
Known Aspire-wide behavior: when a file-sourced DACPAC makes ProcessParameters run, Aspire may also process unrelated global parameters. The DACPAC integration cannot filter that global step; missing non-DACPAC parameters can therefore produce warnings or prompts.
The reason will be displayed to describe this comment to others. Learn more.
🟡 Changes recommended
Unresolved critical defects can expose connection credentials, create deployment dependency cycles, bypass prerequisite ordering, allow concurrent deployments to the same target, and produce an invalid DACPAC in the Go example.
Adds composable DACPAC pipeline operations to the SQL Database Projects integration, supporting artifact-based CI and explicit schema deployment alongside the existing local DacFx workflow.
Changes:
Registers build, publish, report, script, and deploy steps with aggregate-command opt-ins and deployment ordering.
Adds configurable artifact sources and a pinned SqlPackage runner with publish-profile merging, output redaction, and cancellation.
Extends tests, documentation, and C#, TypeScript, and Go examples.
Local SqlServerDatabaseResource references register and reuse a secret pipeline connection-string parameter; run mode remains unchanged.
Validation: analyzer build clean; 35 focused pipeline tests pass; full integration suite passes with 90 completed, 1 skipped, and 0 failed. Go and TypeScript tests pass.
Final rerun on 931fa213: 36 focused pipeline tests passed; full integration suite passed with 91 completed, 1 skipped, 0 failed. Analyzer build is clean, and Go/TypeScript tests pass.
CI failure traced to the Ubuntu AppHost run path: generated project metadata is relative, and the explicit pipeline MSBuild evaluator was accidentally reused by the local DacFx flow. 81dfc0ca restores the established local resource.GetDacpacPath() resolution while keeping external property evaluation only for explicit pipeline builds. The affected run-mode test and all 36 pipeline tests pass locally.
The reason will be displayed to describe this comment to others. Learn more.
🟡 Changes recommended
Unresolved critical issues can expose database credentials through logs and nonsecret parameters, and allow concurrent schema deployments against the same database.
The reason will be displayed to describe this comment to others. Learn more.
Both paths now reject non-secret parameters with an error pointing to AddParameter(..., secret: true): the local fallback (ConfigureLocalTargetParameters) and the explicit TargetConnectionStringParameterName (ValidateSecretTargetParameter), via the shared FindSecretTargetParameter. Both run while the pipeline model is configured, before any step action or credential resolution. Covered by LocalSqlServerReferenceRejectsExistingNonSecretParameter and TargetParameterMustBeSecret.
Addressed the second review pass in 1decd917: connection strings are parsed with SqlConnectionStringBuilder so short/quoted passwords are redacted; target parameters must be secret; schema deploys are runtime-serialized by resolved server/database identity; generated project metadata honors AssemblyConfigurationAttribute. Validation: analyzer build clean, 41 pipeline tests passed, 18 AddSqlProject tests passed. The full local run hit a Docker Desktop outage, while the CI rerun will cover Docker-backed tests.
Pipeline mode accepts `WithDacDeployOptions(path)` publish profiles and preserves their deployment properties and SQLCMD variables. A `WithConfigureDacDeployOptions(...)` callback cannot be serialized for SqlPackage and is rejected by report, script, and deploy operations with a clear error. The callback remains supported for local DacFx deployment. When a local `SqlServerDatabaseResource` is referenced in pipeline mode, the integration registers a secret `<database-resource>-connection-string` parameter instead of attempting to resolve the container endpoint. Supply it through `Parameters__<database-resource>_connection_string` (with dashes represented by underscores).
The DACPAC pipeline APIs are experimental and may change. See the `CTASPIREPIPELINES001` diagnostic when compiling against them.
The reason will be displayed to describe this comment to others. Learn more.
Replaced in cb9f7ac: the profile directory is created with a protected DirectorySecurity ACL on Windows (and 0700 via Directory.CreateTempSubdirectory on Unix). There is no icacls call anymore.
The reason will be displayed to describe this comment to others. Learn more.
🟡 Changes recommended
A test fails on Unix, unnecessary fallback-parameter handling can reject valid explicit targets, and generated pipeline actions lack execution coverage.
This test fails on Unix: MSBuild returns the backslash-separated property unchanged, while the fixture creates bin/Debug/Database.dacpac. The resolver passes the property to Path.GetFullPath, which does not interpret backslashes as directory separators on Unix, so the path assertion fails. Use forward slashes here, which work on both Windows and Unix.
No tests execute the generated PipelineStep.Action delegates, leaving DACPAC selection, target resolution, and runner invocation untested. Add tests with an injected ISqlPackageRunner for report/script artifacts, deploy's Publish request, and propagation of failures and cancellation. Also execute the publish step to verify that it copies the artifact without resolving target credentials.
The reason will be displayed to describe this comment to others. Learn more.
Fixed in cb9f7ac: the local fallback secret parameter is registered only when no explicit target parameter is configured, independent of call order. A test covers it.
The reason will be displayed to describe this comment to others. Learn more.
Fixed: the fallback <database>-connection-string parameter is registered and validated only when no explicit TargetConnectionStringParameterName is configured, using the final merged options, so the order of the fluent calls does not matter. Covered by ExplicitTargetDoesNotRegisterOrValidateLocalFallback.
The reason will be displayed to describe this comment to others. Learn more.
It lets AddSqlProject register the pipeline steps without requiring WithPipelineOptions. I renamed it to AddDefaultPipelineSteps and documented it in cb9f7ac.
The reason will be displayed to describe this comment to others. Learn more.
Agreed, the name was misleading. The options merge now uses ConfigurationBinder plus RejectBlank: null keeps the current value, a blank string throws (cb9f7ac).
The reason will be displayed to describe this comment to others. Learn more.
Which name do you mean, aggregateRoots / deploySteps / provisionSteps? Happy to rename (e.g. aggregateRoots -> optedInDeploySteps). The aggregate wiring was also simplified in cb9f7ac.
The reason will be displayed to describe this comment to others. Learn more.
To be honest I'm having a hard time understanding what's happening here exactly. Perhaps a few well placed comments could help me understand the mental model
The reason will be displayed to describe this comment to others. Learn more.
I simplified this into a single topological ordering of the opted-in deploy steps and their transitive closure, followed by per-target serialization, and added comments describing that model in cb9f7ac. Let me know if anything is still unclear.
Source alone decides whether to build; project-backed resources default to Build (differs from the issue text, where building required publish). Use Source = Existing to avoid rebuilding.
Security hardening: exact SqlPackage version, DTD-prohibited profile loading, protected temp profile deleted in finally, no secrets in argv, best-effort output redaction.
Add composable Aspire pipeline steps for building, publishing, reporting, scripting, and deploying DACPACs while preserving the existing local DacFx behavior. Support split-job artifacts, secret-safe SqlPackage profiles, and aggregate deploy ordering.
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Protect credential profiles from creation, preserve existing DACPAC inputs, and complete deployment dependency and target ordering. Add secret connection parameters for local SQL references and strengthen graph, runner, and polyglot regression coverage.
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Keep the established DacFx resolver for run-mode project deployment while retaining external MSBuild property evaluation for explicit pipeline build configurations.
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
- Bind configuration overrides with ConfigurationBinder and reject blank values
- Default project-backed resources to Build; Source alone decides whether to build
- Require an exact SqlPackage version and prohibit DTDs in user publish profiles
- Redact connection strings and passwords with DbConnectionStringBuilder
- Register the local fallback connection-string parameter only when needed
- Move artifact helpers into DacpacPipelineArtifacts
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
The reason will be displayed to describe this comment to others. Learn more.
🟡 Changes recommended
Switching away from File source leaves an unused DACPAC parameter that can trigger prompts or failures, and the new fixture’s backslash path causes its test to fail on Linux/macOS.
The reason will be displayed to describe this comment to others. Learn more.
Added VerifyPipelineReportScriptAndDeploySteps in 7230865. It runs the real report-, script- and deploy- steps through the pipeline with SqlServerContainerFixture and SqlPackage, asserting that report/script produce artifacts without creating the database, and that deploy creates the schema.
The reason will be displayed to describe this comment to others. Learn more.
Added VerifyPipelineReportScriptAndDeploySteps: it runs the real report-, script- and deploy- step actions through the pipeline against SQL Server in a container with SqlPackage. Report and script produce their artifacts without creating the database; deploy creates the schema.
…, pipeline functional test
- Remove the owned dacpac-path parameter when Source changes away from File
- Use forward slashes in the Existing source test fixture
- Add a functional test running report, script and deploy steps against SQL Server
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
The reason will be displayed to describe this comment to others. Learn more.
🔵 Needs a closer look
Human assessment is needed because artifact-only publishing can prompt for unused database credentials, with behavior depending on which other operations trigger parameter processing.
Summary of how the review findings were addressed (head 72308654, CI green on Ubuntu and Windows; local suite 113 passed, 1 skipped, 0 failed):
Secrets: the target connection string only goes into a private temporary publish profile (restricted ACL / 0700, deleted in finally), never into argv. Non-secret target parameters are rejected on both the local fallback and the explicit-parameter path. Output redaction is best effort.
Parameters: the fallback parameter is registered only when needed, and the -dacpac-path parameter is removed when Source moves away from File, so ProcessParameters does not prompt for unused values.
Ordering: deploy ordering is a single topological sort with per-target serialization (not a distributed lock).
Clarity: simplified options merge, renamed/commented helpers, artifacts in their own file, DirectorySecurity instead of icacls.
Tests: functional coverage of report/script/deploy through SqlPackage, plus a portable fixture for the Existing source.
The reason will be displayed to describe this comment to others. Learn more.
Removed the obsolete ASPIREPIPELINES001 suppression in b519299. I kept CTASPIREPIPELINES001 because removing it still fails compilation while this test uses the integration API marked Experimental.
Aspire 17 no longer requires suppressing ASPIREPIPELINES001 in the functional tests. Keep the integration's CTASPIREPIPELINES001 suppression for its experimental API.\n\nCo-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Aspire 17 no longer requires suppressing ASPIREPIPELINES001 for pipeline APIs. Keep the integration's CTASPIREPIPELINES001 suppression for its experimental public API.\n\nCo-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
This branch has not been deployed
No deployments
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
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.
Closes #2342
Adds composable Aspire DACPAC pipeline steps for SQL database project and package resources:
build-<resource>andpublish-<resource>for deterministic DACPAC artifacts and split-job CI;report-<resource>andscript-<resource>for read-only review;deploy-<resource>for explicit SqlPackage deployment;IncludeInPublishandIncludeInDeployopt-ins for aggregate commands;DacpacSource.FileorDacpacSource.Existingfor consuming artifacts without rebuilding or restoring the SQL project;The existing
aspire runlifecycle remains unchanged and still uses DacFx. Pipeline operations use a pinned SqlPackage throughdotnet dnx, keep connection strings out of command-line arguments, and merge user publish-profile options with the Aspire target. Public and polyglot APIs are experimental.PR Checklist
Other information
Validation run on the rebased branch:
dotnet build .\src\CommunityToolkit.Aspire.Hosting.SqlDatabaseProjects\CommunityToolkit.Aspire.Hosting.SqlDatabaseProjects.csproj -p:EnableAspireIntegrationAnalyzers=true -p:NoWarn=NU1903 -v:minimal— passed, 0 warnings/errors.dotnet test .\tests\CommunityToolkit.Aspire.Hosting.SqlDatabaseProjects.Tests\CommunityToolkit.Aspire.Hosting.SqlDatabaseProjects.Tests.csproj— passed: 91 completed, 1 skipped, 0 failed.Known Aspire-wide behavior: when a file-sourced DACPAC makes
ProcessParametersrun, Aspire may also process unrelated global parameters. The DACPAC integration cannot filter that global step; missing non-DACPAC parameters can therefore produce warnings or prompts.