Skip to content

Add Oracle Cloud Infrastructure (OCI) connection and Generative AI hook#70160

Open
AlejandroMorgante wants to merge 2 commits into
apache:mainfrom
AlejandroMorgante:add-oci-generative-ai-hook
Open

Add Oracle Cloud Infrastructure (OCI) connection and Generative AI hook#70160
AlejandroMorgante wants to merge 2 commits into
apache:mainfrom
AlejandroMorgante:add-oci-generative-ai-hook

Conversation

@AlejandroMorgante

Copy link
Copy Markdown
Contributor

Adds foundational Oracle Cloud Infrastructure support to the Oracle provider so Airflow can integrate with OCI Generative AI Hosted Applications and Hosted Deployments.

OCI Generative AI management APIs are available through the official OCI Python SDK, while the Oracle provider previously focused on Oracle Database integrations. This PR establishes the reusable OCI connection and native-client hooks needed before lifecycle operators can be added in follow-up work.

New connection

  • oci connection type — stores inline OCI API key credentials, a default region, and an optional compartment OCID independently from the existing Oracle Database connection.
  • Authentication support — supports API key, OCI configuration file, instance principal, and resource principal authentication.
  • Connection test — validates credentials through IdentityClient.list_regions without depending on a Generative AI resource.
  • Connection UI — provides declarative and legacy metadata for the OCI-specific fields, labels, placeholders, hidden fields, and private-key password handling.

New hooks

  • OciBaseHook — builds OCI SDK configuration and signers, creates native OCI service clients, resolves compartment IDs, supports explicit service endpoints, and caches the configured client.
  • OciGenerativeAIHook — selects and exposes the native GenerativeAiClient through conn and get_conn() for Hosted Application, Hosted Deployment, and work-request lifecycle operations.

The hook architecture follows the native-client pattern used by the Amazon provider's boto3 hooks: the specialized hook selects the appropriate SDK client while callers and future operators use the native client directly. This preserves OCI response data, ETags, request identifiers, work-request identifiers, retry options, pagination, and concurrency-control arguments.

Packaging and security

  • The OCI SDK is available through the optional oci provider extra because it requires the LGPL-licensed crc32c transitive dependency. OCI functionality is therefore genuinely optional for users who only use Oracle Database integrations.
  • Hook modules remain importable without the OCI SDK and raise AirflowOptionalProviderFeatureException with installation guidance when OCI functionality is requested.
  • File-based credentials, principal authentication, and custom service endpoints are explicit hook arguments controlled by Dag authors. Connection fields retain inline credentials and defaults, preventing Connection editors from selecting worker-local files, ambient OCI identities, or non-standard endpoints.

Other changes

  • Provider metadata and generated provider information for the new OCI integration, connection, and hooks.
  • Documentation for OCI authentication, connection configuration, security boundaries, Generative AI endpoint mappings, Hosted Application authentication variants, and native-client examples.
  • Unit tests for the base hook, authentication modes, client construction, optional SDK behavior, UI metadata, security boundaries, and Generative AI client selection.

Testing

  • Provider suite: 100 Oracle provider tests passed.
  • Coverage: the new hooks have 100% statement and branch coverage.
  • Static validation: provider mypy, pre-commit and manual checks, selective-checks, and uv lock --check passed.
  • Documentation: the Oracle provider documentation build passed.
  • Optional dependency: both hook modules import without the OCI SDK installed, and the missing-extra failure path is covered.
  • Live OCI smoke test: the oci_default Connection test succeeded using inline key_content, and the native Generative AI hook listed Hosted Applications and Hosted Deployments in us-chicago-1.

No OCI resources were created, updated, or deleted during the live smoke test.

Connection UI

This PR introduces a new Connection type, so there is no equivalent before state.

OCI Connection form
Was generative AI tooling used to co-author this PR?
  • Yes — Codex (GPT-5)

Generated-by: Codex (GPT-5) following the guidelines

@AlejandroMorgante
AlejandroMorgante force-pushed the add-oci-generative-ai-hook branch from 0bbd204 to 7bf3b0a Compare July 21, 2026 04:32
@AlejandroMorgante AlejandroMorgante changed the title Add Oracle Cloud Infraestructure (OCI) connection and Generative AI hook Add Oracle Cloud Infrastructure (OCI) connection and Generative AI hook Jul 21, 2026
Oracle users need a shared authentication foundation for OCI services and native access to Hosted Application management APIs, matching the client-based integration pattern used by other cloud providers.
The lowest-direct-dependencies environment intentionally excludes optional FAB form packages, so Oracle tests must remain collectible without them.
@AlejandroMorgante
AlejandroMorgante force-pushed the add-oci-generative-ai-hook branch from 7bf3b0a to b3db666 Compare July 21, 2026 12:57
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant