Skip to content

Fix Oracle initialization script handling - #19601

Draft
Sébastien Ros (sebastienros) wants to merge 2 commits into
mainfrom
sebros/fix-oracle-dbsetup-bind-mount
Draft

Fix Oracle initialization script handling#19601
Sébastien Ros (sebastienros) wants to merge 2 commits into
mainfrom
sebros/fix-oracle-dbsetup-bind-mount

Conversation

@sebastienros

@sebastienros Sébastien Ros (sebastienros) commented Aug 22, 2026

Copy link
Copy Markdown
Contributor

Description

Oracle Database Free ships with a pre-built database, so setup scripts do not run unless empty data storage triggers database creation. In addition, WithInitFiles copied flat scripts to Oracle's parent scripts directory instead of the startup directory, and generated passwords could contain characters rejected by fresh-database creation.

This change:

  • Copies flat WithInitFiles content to /opt/oracle/scripts/startup while preserving existing parent directories containing Oracle's startup/ or setup/ layout.
  • Keeps WithDbSetupBindMount mount-only while documenting that it must be paired with empty data storage for Oracle Free.
  • Generates alphanumeric passwords with Oracle's required lowercase, uppercase, and numeric complexity.
  • Splits and repairs startup/setup functional coverage and adds deterministic app-model regression tests.

User-facing usage

C# AppHost:

var startupOracle = builder.AddOracle("startup-oracle")
                           .WithInitFiles("./oracle/startup");

var setupOracle = builder.AddOracle("setup-oracle")
                         .WithDataVolume()
                         .WithDbSetupBindMount("./oracle/setup");

TypeScript AppHost:

const startupOracle = await builder.addOracle("startup-oracle")
                                   .withInitFiles("./oracle/startup");

const setupOracle = await builder.addOracle("setup-oracle")
                                 .withDataVolume()
                                 .withDbSetupBindMount("./oracle/setup");

Validation included 48 targeted unit/API tests, both supported WithInitFiles layouts against a real Oracle container, and the fresh-database setup scenario.

Fixes: #5190

Checklist

  • Is this feature complete?
    • Yes. Ready to ship.
    • No. Follow-up changes expected.
  • Are you including unit tests for the changes and scenario tests if relevant?
    • Yes
    • No
  • Did you add public API?
    • Yes
      • If yes, did you have an API Review for it?
        • Yes
        • No
      • Did you add <remarks /> and <code /> elements on your triple slash comments?
        • Yes
        • No
    • No
  • Does the change make any security assumptions or guarantees?
    • Yes
      • If yes, have you done a threat model and had a security review?
        • Yes
        • No
    • No

Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>

Copilot-Session: 2d04c45e-ad3f-4bba-9057-ac1d3fea5538
Copilot AI balanced review requested due to automatic review settings August 22, 2026 05:22
@github-actions

Copy link
Copy Markdown
Contributor

🚀 Dogfood this PR with:

⚠️ WARNING: Do not do this without first carefully reviewing the code of this PR to satisfy yourself it is safe.

curl -fsSL https://raw.githubusercontent.com/microsoft/aspire/main/eng/scripts/get-aspire-cli-pr.sh | bash -s -- 19601

Or

  • Run remotely in PowerShell:
iex "& { $(irm https://raw.githubusercontent.com/microsoft/aspire/main/eng/scripts/get-aspire-cli-pr.ps1) } 19601"

@github-actions github-actions Bot added the needs-area-label An area label is needed to ensure this gets routed to the appropriate area owners label Aug 22, 2026
@github-actions

This comment has been minimized.

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Fixes Oracle container initialization behavior in the container-backed hosting integration.

Changes:

  • Targets startup scripts at Oracle’s expected directory.
  • Generates Oracle-compatible passwords.
  • Adds setup/startup tests and usage guidance.

Reviewed changes

Copilot reviewed 4 out of 4 changed files in this pull request and generated 2 comments.

File Description
OracleDatabaseBuilderExtensions.cs Updates script path, password generation, and documentation.
README.md Documents startup and setup script usage.
AddOracleTests.cs Adds app-model and password regression tests.
OracleFunctionalTests.cs Separates real-container initialization scenarios.

.withInitFiles("./oracle/startup");
```

Use `WithDbSetupBindMount` for scripts that should run once while Oracle creates the database. Oracle Database Free images include a pre-built database, so setup scripts run only when the container starts with empty data storage. Configure a new data volume or an empty data bind mount together with the setup scripts:
await app.StartAsync();

await app.WaitForTextAsync(DatabaseReadyText, cancellationToken: cts.Token);
await app.WaitForTextAsync("DONE: Executing user defined scripts", cancellationToken: cts.Token);
Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>

Copilot-Session: 2d04c45e-ad3f-4bba-9057-ac1d3fea5538
Copilot AI review requested due to automatic review settings August 22, 2026 05:44
@github-actions

Copy link
Copy Markdown
Contributor

Tests selector (audit mode)

The full test matrix and all jobs still run in audit mode. The tests and jobs below are what selective CI would run under enforcement.

1 / 102 test projects · 2 jobs, from 3 changed files.

Selected test projects (1 / 102)

Aspire.Hosting.Oracle.Tests

Selected jobs (2)

extension-e2e, typescript-api-compat


How these were chosen — grouped by what changed

🔧 src/Aspire.Hosting.Oracle/OracleDatabaseBuilderExtensions.cs (changed source)
1 directly: Aspire.Hosting.Oracle.Tests

🧪 tests/Aspire.Hosting.Oracle.Tests/AddOracleTests.cs (changed test)
1 directly: Aspire.Hosting.Oracle.Tests

🧪 tests/Aspire.Hosting.Oracle.Tests/OracleFunctionalTests.cs (changed test)
1 directly: Aspire.Hosting.Oracle.Tests

Job reasons

Job Triggered by
extension-e2e src/Aspire.Hosting.Oracle/OracleDatabaseBuilderExtensions.cs
• affected project Aspire.Hosting.Oracle
typescript-api-compat affected project Aspire.Hosting.Oracle

Selection computed for commit 5056b88.

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 4 out of 4 changed files in this pull request and generated 1 comment.

Suppressed comments (1)

src/Aspire.Hosting.Oracle/README.md:57

  • Changing the fallback generator does not repair passwords already persisted by an earlier run: GetParameterValue prefers Parameters:{name}-password from configuration over the new default. An existing app that previously generated an unsupported special character can therefore still fail when it switches to empty storage. Add migration guidance to remove or replace that persisted value with an alphanumeric password before fresh-database creation.
Use `WithDbSetupBindMount` for scripts that should run once while Oracle creates the database. Oracle Database Free images include a pre-built database, so setup scripts run only when the container starts with empty data storage. Configure a new data volume or an empty data bind mount together with the setup scripts:

Comment on lines +160 to +162
/// <remarks>
/// Oracle executes scripts in the startup scripts directory each time the database container starts.
/// </remarks>
@github-actions

Copy link
Copy Markdown
Contributor

Retrying the failed CI jobs for this pull request from the CI run attempt. The rerun is being tracked in the rerun attempt.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

needs-area-label An area label is needed to ensure this gets routed to the appropriate area owners

Projects

None yet

Development

Successfully merging this pull request may close these issues.

OracleDatabaseServerResource.WithDbSetupBindMount has no effect

2 participants