Skip to content

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

28 Commits
 
 
 
 
 
 

Repository files navigation

OIA Hub Promotion Pipeline (Azure DevOps + PowerShell)

Automate promotion of Oracle Intelligent Advisor (OIA) Hub deployments from a source workspace (e.g. RN_UAT) to a target workspace (e.g. RN_PROD) using Azure DevOps Pipelines and PowerShell. Exports activated deployments ending with …_U, then promotes them as …_P (creating a new version if they already exist).

What this does

Export stage

Authenticates to OIA UAT Hub (client credentials).

Lists deployments in a workspace (q={"workspace":"RN_UAT"}), filters names ending in U.

Resolves active version, downloads ZIP snapshots.

Builds manifest.csv → sourceName,version,destName,servicesJson.

Publishes a pipeline artifact named oia-export.

Promote stage

Authenticates to OIA PROD Hub.

Uses manifest.csv + ZIPs to:

Create a new version if target deployment exists, or

Create a new deployment (compatibilityMode, services, initial version).

Optional: only promote a subset via deployList (e.g. Proj_U:1;Other_U:2;).

Promote-only mode

Reuses a previous oia-export artifact (no calls to UAT).

You provide the previous run ID via a queue-time variable.

Repo layout / (repo root) ├─ azure-pipelines.yml # Windows-only pipeline (PowerShell) └─ (optional) scripts/*.ps1

Prerequisites

OIA Hub

Source & Target Hubs reachable (often same Hub, different workspaces).

API Clients on both with Manager role.

API version (e.g., 12.2.39).

Azure DevOps

Project + YAML pipeline connected to this GitHub repo.

Self-hosted Windows Agent (pool name e.g. Local).

Variable group (Azure DevOps → Pipelines → Library)

Create (e.g.) “OIA DevOps Variable Group”, set secrets accordingly:

UAT_OIA_BASE_URL https:///opa-hub PROD_OIA_BASE_URL https:///opa-hub OIA_API_VERSION 12.2.39

UAT_OIA_CLIENT_ID (secret) UAT_OIA_CLIENT_SECRET (secret) PROD_OIA_CLIENT_ID (secret) PROD_OIA_CLIENT_SECRET (secret)

SOURCE_WORKSPACE RN_UAT TARGET_WORKSPACE RN_PROD ACTIVATE_AFTER_PROMOTE true # or false FILTER_SUFFIX U

Queue-time variable (create once in pipeline UI)

Name: artifactRunId

Value: (leave blank)

Mark Settable at queue time

This is only needed for Promote-only runs.

Pipeline parameters (shown at run time)

deployList — AUTO (default) uses the full export; or specify subset like Proj_U:3;Other_U:1;.

skipExport — false by default. Set to true for Promote-only (reuse previous artifact).

skipPromote — false by default. Set to true for Export-only.

In Promote-only mode, set variable artifactRunId to the run number that produced the oia-export artifact.

How to run

  1. Export-only

Queue the pipeline with skipPromote = true.

Result: Artifact oia-export (contains manifest.csv and deployments*.zip).

  1. Full run (Export → Promote)

Run with defaults.

Promotes everything ending in U. Optional: set deployList to promote only some.

  1. Promote-only (reuse a past export)

Queue with skipExport = true.

In Variables, set artifactRunId to the export run ID (see below).

Optional: set deployList to a subset.

The pipeline downloads the exact oia-export from that run and promotes from it (no UAT calls).

Finding the run ID

Open the successful Export run in Azure DevOps:

URL ends with /runs/ or buildId= → that is your artifactRunId.

(Optional) Add a tiny step to print it during Export:

Write-Host "Export artifact created by run ID: $(Build.BuildId)"

Where files go

During run (agent):

C:\azagent_work<build>\s\out\manifest.csv C:\azagent_work<build>\s\out\deployments<Name>_.zip

Published artifact: oia-export (download from the run’s Artifacts panel).

During Promote: the artifact is downloaded to $(Pipeline.Workspace)\oia-export and copied to artifact.

OIA REST calls used (high level)

POST /auth — client credentials → access token

GET /deployments?q={"workspace":"RN_UAT"}&fields=name,workspace,activeVersionNo,services

GET /deployments/{name}/activeVersion (fallback)

GET /deployments/{name}/versions/{ver}/snapshot → ZIP

POST /deployments/{name}/versions → add version

POST /deployments → create deployment

Body shape must be { "items": [ { ... } ] }

compatibilityMode is required ("current"/"latest"/"previous")

services must be an array from: interview, webserviceAssess, webserviceInterview, chatservice

Common gotchas

401/403: bad client credentials or missing Manager role.

404 on /snapshot: wrong name or version; version not present/active for that deployment.

Artifact not found in Promote-only: ensure artifactRunId is set; YAML includes runVersion: 'specific' so the exact run is used.

Case sensitivity: deployment names are case-sensitive; suffix mapping …_U → …_P is literal.

Notes for PowerShell readers

All HTTP calls are Invoke-RestMethod/Invoke-WebRequest with TLS 1.2 forced:

[Net.ServicePointManager]::SecurityProtocol = [Net.SecurityProtocolType]::Tls12

Manifest line format:

,,,

Example:

TravelClaims_U,3,TravelClaims_P,["interview","webserviceInterview"]

On update we call POST /deployments/{destName}/versions (new version). On create we call POST /deployments with the wrapper items[], compatibilityMode, services, and one initial version.

Why this structure

Deterministic promotion from explicit artifacts and a clear manifest.

Reproducible Promote-only runs that don’t hit UAT again.

Auditable: artifacts, logs, and run IDs tell the complete story.

Secure: secrets in Library variable group; tokens never echoed.

Quick start checklist

Create variable group with Hub URLs, API version, client creds, workspaces.

Ensure self-hosted Windows agent pool is online.

Create pipeline from azure-pipelines.yml.

In pipeline’s Variables, add artifactRunId (settable at queue time, blank by default).

Run Export-only once to produce an artifact.

Run Full or Promote-only as needed (set artifactRunId for Promote-only).

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

Packages

Contributors

Languages