Promoting content from development to production
Recipes 6.2 and 6.3 moved content by hand. That’s fine once. When a team changes workflows every week, promotion needs to be a routine: the same steps every time, a record of what went where, and no way for development’s settings to leak into production. There are two good routes, and they suit different teams:
- Packages through the REST API. A script exports a package from development and imports it into production. Production keeps its own configuration values. Every release is a file you can archive.
- Git branches. Development follows the branch
develop, production followsmain, and a pull request in GitHub is the gate between them. Every change is reviewed before production pulls it.
This recipe does both with the chapter’s example content, from vco01.vmw.lab to the Orchestrator embedded in VCF Automation at auto.vmw.lab, which stands in for production in the lab.
Getting ready
- The package
com.vcfguide.chapter6onvco01, imported once onauto.vmw.lab(recipe 6.2), and the configuration elementvcfguide-ch6-settingsthere with its own values. - For the package route: a Linux or macOS shell with
curl, a bearer token for each Orchestrator, and the CA certificate that signed both servers’ TLS certificates, saved asvmw-lab-ca.pem. Chapter 7 shows how to get a token. - For the Git route:
vco01connected to thedevelopbranch ofvcfguide-content(recipe 6.3), and a second token forauto.vmw.labwith the same access to that repository.
How to do it
Route 1: a package through the REST API
- On
vco01, make the change you want to promote, raise the version of every object you changed, and save the packagecom.vcfguide.chapter6so it holds the new versions (recipe 6.2). - Save this script as
promote-package.sh. It exports the package without values, secrets, or tags, keeps a dated copy, and imports it into production without values or tags:
#!/usr/bin/env bash# Promotes one Orchestrator package from development to production.# SRC_TOKEN and DST_TOKEN are bearer tokens for the two servers (Chapter 7).set -euo pipefail
PACKAGE="com.vcfguide.chapter6"SRC="https://vco01.vmw.lab/vco/api"DST="https://auto.vmw.lab/vco/api"CACERT="vmw-lab-ca.pem"FILE="$PACKAGE.package"
# Export: no configuration values, no SecureString values, no global tagscurl --fail --silent --show-error --cacert "$CACERT" \ -H "Authorization: Bearer $SRC_TOKEN" \ -H "Accept: application/zip" \ -o "$FILE" \ "$SRC/packages/$PACKAGE?exportConfigurationAttributeValues=false&exportConfigSecureStringAttributeValues=false&exportGlobalTags=false"echo "Exported $FILE ($(wc -c < "$FILE") bytes)"
# Keep every releasemkdir -p releasescp "$FILE" "releases/$PACKAGE-$(date +%Y%m%d-%H%M%S).package"
# Import: keep production's values and tags; don't replace newer elementscurl --silent --show-error --cacert "$CACERT" \ -H "Authorization: Bearer $DST_TOKEN" \ -F "file=@$FILE" \ -w "\nHTTP %{http_code}\n" \ "$DST/packages?overwrite=false&importConfigurationAttributeValues=false&importConfigSecureStringAttributeValues=false&tagImportMode=DoNotImport"- Set the two tokens and run it:
export SRC_TOKEN='…' DST_TOKEN='…'bash promote-package.sh- Read the last line.
HTTP 202means the import was accepted. The response body above it lists any elements that failed in anerrorsarray.HTTP 409means one or more elements in the package are older than the ones in production, and nothing was imported: someone changed production directly, or you forgot to raise a version number. - On
auto.vmw.lab, open Report powered-on VMs. Its version is the one you promoted, andvcfguide-ch6-settingsstill has production’s values.
Terminal running bash promote-package.sh: the Exported com.vcfguide.chapter6.package (… bytes) line, the JSON import result, and HTTP 202; beside it, the releases folder with two dated package files.
promote-package.sh against vco01 and auto.vmw.lab on 9.1.1 and record: that /vco/api is the base path on both; the JSON body of a 202 and of a 409; what overwrite=true does (the 9.1 API reference doesn’t describe it); and whether an import through the API needs production to trust vco01’s signing certificate first, as the client asks in recipe 6.2.Route 2: Git branches and a pull request
- On
auto.vmw.lab, open the Orchestrate tab, go to Administration > Git Repositories, and addvcfguide-contentas in recipe 6.3, with its own token. Make it active on the branchmain, notdevelop. - Before production pulls anything, write down every
SecureStringvalue it holds, such asapiTokeninvcfguide-ch6-settings. Connecting a repository replays it into the server, and secrets come back empty (recipe 6.3). - On
vco01, change Report powered-on VMs, raise its version, save it, and push it todevelopfrom Git History. - In GitHub, open a pull request from
developtomain, titled with what changed. The Files changed tab shows exactly which objects changed, line by line. Ask a colleague to review it, then merge it. - On
auto.vmw.lab, go to Administration > Git History and click Pull. The merged change arrives. - Re-enter any
SecureStringvalues that came back empty, and check the values ofvcfguide-ch6-settings(see How it works). Run Report powered-on VMs on production.
GitHub pull request from develop into main on vcfguide-content, Files changed tab showing the changed lines of Report powered-on VMs (version and script), with an approving review.
Administration > Git History on the embedded Orchestrator at auto.vmw.lab, active repository vcfguide-content on main, with the merge commit from the pull request at the top.
How it works
What promotion carries, and what it doesn’t. Both routes move content: workflows, actions, policies, configuration elements, resource elements. Neither moves what that content needs from the server around it. Before the first promotion, make production match development in these, and keep them matched:
| Needs to match | How | Recipe |
|---|---|---|
| Plug-ins and their versions | Install the same plug-in files | 5.1 |
| Plug-in inventory: vCenters, REST hosts, databases, brokers | Run the same configuration workflows, with the same names | 1.9, 5.2–5.8 |
| Environments for Python, Node.js, and PowerShell actions | Create them with the same names and package versions | 4.3–4.5 |
| Certificates the workflows trust | Import them into production’s trust store | 2.2 |
| Configuration values and secrets | Set them on production, once | 4.7 |
The package route keeps production’s values. The script exports with exportConfigurationAttributeValues=false and imports with importConfigurationAttributeValues=false, so values never travel in either direction. A new configuration element arrives with its variables but no values, and you fill them in once on production. After that, each promotion updates the element’s variables, if they changed, and leaves its values alone. overwrite=false makes the import refuse a package that would replace newer objects, so an emergency fix made directly on production isn’t lost: you get a 409 and have to bring the fix back into development first.
The Git route shares everything but secrets. In Git, a configuration element is one file, values and all, and both servers pull the same file. Only SecureString values stay on each server, because Orchestrator writes __NULL__ in their place (KB 446735). And a pull replaces local changes that haven’t been pushed (KB 453014), so a value you set on production by hand can be overwritten by the next pull of that element. Plan for it in one of these ways:
- keep values that differ between environments as
SecureStringvariables, which Git never carries, and set them once on each server; - keep them out of the repository’s configuration elements and set them on production after each pull, through the REST API (recipe 4.7, There’s more);
- or use the package route for configuration elements and the Git route only for workflows and actions.
Production pulls, it never pushes. In the Git route, auto.vmw.lab only ever pulls. If someone edits a workflow on production, that change sits in production’s Git History as an unpushed change set, and the next pull can overwrite it or stop on a conflict. Give developers no developer role on production, so changes can only arrive through main.
Why not one branch? If both servers followed develop, every push from development would reach production at its next pull, reviewed or not. Two branches put a pull request between them, and GitHub’s branch protection can require a review before anything merges into main.
Which route? Packages suit teams that release in batches, need a file per release for change control, or promote into servers that can’t reach a Git server. Git suits teams that already review code in pull requests and change workflows often. Many teams use Git between developers and packages for the last step into production.
There's more
Check before you import. The 9.1 packages service also has POST /vco/api/packages/import-details, which reads a package file and reports what an import would do, without importing anything. Call it in the script before the import, and stop if it reports an element that would go backwards.
POST /vco/api/packages/import-details with com.vcfguide.chapter6.package on 9.1.1 and record its response fields, so the script can check them.Promote from a pipeline. The script needs nothing but curl, so it runs as a job in GitHub Actions, GitLab CI, or Jenkins. Keep the two tokens in the pipeline’s secret store, run the job by hand or on a tag, and keep the dated packages as the job’s artifacts instead of in a local folder.
Several developers. Broadcom’s 8.x guide gives three rules for teams, and they still hold: each developer builds and tests on an Orchestrator of their own, never on the shared one; the content lives in source control (in 9.x, Git integration, recipe 6.3, or Build Tools for VMware Aria projects); and imports into production happen in a planned window, not whenever someone finishes. A release imported in one go, at a known time, is easy to roll back and to explain.
Test before production. A third server, for testing, fits either route: a second import in the script, or a test branch between develop and main. The rule is the same: content only moves forward, and nobody edits a server further along the line.
Rolling back. With packages, import the previous release’s file from releases/. Its versions are older than production’s, so the import needs overwrite=true, or the older elements selected by hand in the client (recipe 6.2). With Git, revert the merge in GitHub, merge the revert into main, and pull. Don’t use Reset to this on production. It also removes content added since that commit, and moves production off the branch’s latest commit.
Promoting into VCF Automation. Workflows that VCF Automation calls, for example from extensibility subscriptions or catalog items, are found by their ID. A package or a pull keeps the ID, so subscriptions on production keep pointing at the right workflow after a promotion. Recreating a workflow by hand gives it a new ID and breaks them. Chapter 8 covers the VCF Automation side.
See also
- 6.2 Packages: create, export, import, for the import options the script sets.
- 6.3 Git integration and branching, for connecting a server to a branch, and secrets in Git.
- 4.7 Working with configuration elements in code, for one element per target and setting values from outside.
- Broadcom developer documentation (VCF Operations Orchestrator API, latest): Packages service, Export Package, Import Package, and Repository (Version Control) Service.
- Broadcom TechDocs (VCF 9.0): Import a Package and Key features of the VCF Operations orchestrator platform, on managing workflow development across several instances with Git.
- Broadcom KB 446735 (secure strings after Git synchronization) and 453014 (pull and unpushed local changes).
- GitHub Docs: About protected branches.
- CloudBlogger, the author’s blog: Upload a vRO package using vRO Node.js action, Build Tools for Aria: Challenges First, Rewards Later.
