Git integration and branching
Version history (recipe 6.1) lives inside one Orchestrator. Connect that Orchestrator to a Git repository and the same history is pushed to a server your team already backs up, reviews, and understands. Each change you save on Orchestrator becomes a commit you can push to a branch, and changes others push to that branch can be pulled back in. Branches are what make Git useful for more than backup: in recipe 6.4 a development and a production Orchestrator follow two branches of one repository.
In this recipe you prepare a GitHub repository, connect vco01.vmw.lab to its develop branch, push the chapter’s content, pull a change made in GitHub, and roll the server back to an earlier commit. GitLab works the same way. Only the token page differs.
Getting ready
- Administrator rights on
vco01.vmw.lab, and the content from recipe 6.1 on it. - A GitHub account, and an empty private repository you can create branches in. This recipe calls it
vcfguide-content. If you use GitLab, create a project instead. vco01able to reachgithub.com(or your GitLab server) on TCP 443. If the appliance goes out through a proxy, set that up first.- A VCF licence. Broadcom documents Git integration as needing a VMware Cloud Foundation licence. Every VCF 9 Orchestrator has one.
How to do it
Prepare the repository
- In GitHub, create the private repository
vcfguide-contentwith aREADME.md, so it has amainbranch. - Create a second branch,
develop, frommain.vco01will push todevelop.mainis for content that’s been reviewed (recipe 6.4). - Create a fine-grained personal access token for Orchestrator. Limit it to the repository
vcfguide-content, give it Contents read and write access, and set an expiry date you’ll remember. Copy the token: GitHub shows it only once.
repo scope is needed instead.Connect Orchestrator
- On
vco01, go to Administration > Git Repositories and click Add Repository. From 9.1.2, Git repositories are on the combined Administration > Repositories page, next to the package repositories for environments (recipe 4.3). - Enter the repository’s HTTPS URL,
https://github.com/<your-account>/vcfguide-content.git, your GitHub user name, and the token as the access token. - Click Validate. Orchestrator connects to GitHub with the token and lists the branches it finds.
- Change the Name to
vcfguide-content, and add a description such asVCF Orchestrator Guide content, development. - Click Make active repository, choose the branch
develop, and click Save. - Back in the list of repositories,
vcfguide-contentshows the status Active.
Administration > Git Repositories > Add Repository on vco01: URL https://github.com/…/vcfguide-content.git, user name, token (hidden), Validate succeeded, Name vcfguide-content, Make active repository on, branch develop selected.
Administration > Git Repositories list with vcfguide-content, branch develop, status Active.
Push the content
- Go to Administration > Git History. The page compares the server’s local history with the
developbranch. Expand an entry to see which objects changed. - Click Push. Enter the commit title
Chapter 6 example contentand, if you like, a short description. - Select the changes to push. For the first push, select the workflow, the action, and the configuration element from recipe 6.1.
- Click Push. When it finishes, the entry shows as pushed.
- Open the
developbranch in GitHub. There’s a new commit with your title, and the repository now holds the three objects as files, under folders for workflows, actions, and configuration elements.
Administration > Git History on vco01, Push dialog: commit title Chapter 6 example content, description, and the changed objects (Report powered-on VMs, countPoweredOnVms, vcfguide-ch6-settings) selected.
GitHub, repository vcfguide-content, branch develop: the commit Chapter 6 example content and the folder tree Orchestrator created, opened down to the file for Report powered-on VMs.
Push from the editor
- Open Report powered-on VMs, change its description, and save.
- You don’t have to go to Git History for one object. The workflow editor has a version control at the bottom: use it to push this workflow’s change on its own, with a commit title.
Pull a change made elsewhere
- In GitHub, open the file for
vcfguide-ch6-settingsondevelopand change the value ofreportPrefixfromVCF GuidetoVCF Guide (Git). Commit it todevelop. - On
vco01, go to Administration > Git History and click Pull. Orchestrator fetches the new commit and applies it. - Open
vcfguide-ch6-settings.reportPrefixnow readsVCF Guide (Git), and the element’s Version History shows the pull as a new entry. Change it back in Orchestrator, save, and push.
Go back to an earlier commit
- In Git History, select the commit Chapter 6 example content and click Reset to this. Confirm with Ok.
- The server’s content is now exactly as it was at that commit: the workflow’s later description is gone. Content that didn’t exist at that commit is removed from the server altogether.
- To return to the latest state of the branch, click Pull.
How it works
Two repositories, one branch. Orchestrator already keeps its content in a local Git repository (recipe 6.1). Connecting an external repository links that local repository to one branch of a remote one. Push sends local commits to the branch. Before it does, Orchestrator brings in any commits on the branch that it doesn’t have yet and replays its own on top, as git pull --rebase would. The server log of a failed push in KB 314887 shows that rebase step. Pull brings the branch’s commits in and applies them to the server’s content. Only one repository can be active at a time, and it follows one branch.
Change sets. Git History shows the difference between the server and the branch as a list of change sets, one for each saved change. You choose which to push, and Discard all throws away every local change that hasn’t been pushed. Any workflow developer can push or discard a change set, whatever their group permissions. If that’s too open for production, keep developer roles off the production server (recipe 6.4).
Secrets never reach Git. When Orchestrator writes an object to the repository, it replaces every SecureString value with a __NULL__ placeholder. That’s deliberate: credentials don’t belong in Git history. It has a consequence you need to plan for. If the server ever replays the whole repository into its database, the placeholders overwrite the real values, and your passwords become empty. Broadcom KB 446735 lists what triggers that full re-sync:
- making a different repository active,
- changing the repository’s URL,
- changing the branch it follows, for example from
developtomain, - turning Git integration off and on again, in the client or through the API.
Choose the repository and branch once, before you push anything. If you must change them, write down every SecureString value first, so you can re-enter them afterwards. apiToken in vcfguide-ch6-settings is in the example to remind you.
Conflicts. A pull applies remote commits one after another. When a remote change and a local one touch the same object, the pull stops on a merge conflict, and each conflicting object has to be resolved before it can go on. Changes made by hand in the repository, including changes to line endings by a Git client on Windows, are the usual cause.
vco01, then pull) and record how the client presents it: the Resolve Conflicts window from recipe 6.1, or another dialog.Limits worth knowing. Orchestrator only works with SHA-1 commit hashes. If an abbreviated hash in the local repository matches one in the remote, push fails with Could not resolve uniquely the abbreviated object ID, and the only way out is to discard or reset the local repository (KB 314887). Each Orchestrator has one SSH key, so to connect repositories from different accounts, use HTTPS with a token rather than SSH. Workflows generated by Generate CRUD workflows for a table aren’t tracked and can’t be pushed.
There's more
SSH instead of a token. Instead of an HTTPS URL and a token, you can enter the repository’s SSH URL. Orchestrator then authenticates with its own SSH key pair. Add its public key to the repository as a deploy key with write access. The REST API returns the key with GET /vco/api/content-repositories/public-keys.
Restoring one workflow from Git. Pull and Reset to this work on the whole server. There’s no way to pull a single file. To get back one workflow that was deleted from Orchestrator but still exists in Git, Broadcom’s KB 453014 suggests a detour: import the workflow’s file from the repository into a sandbox Orchestrator, put it in a package there, and import that package into the server that lost it. Try Deleted Items first (recipe 6.1). It’s much quicker.
Large pulls. Pulling many commits with many conflicts can run into the database transaction timeout. Broadcom KB 452775 suggests squashing or rebasing the branch in Git first, and, if that isn’t enough, raising the timeout from the appliance’s root shell:
vracli vro properties set -k com.vmware.o11n.db.transaction.timeout -v 1200Back up the appliance before changing properties (recipe 2.6).
vracli vro properties set accepts this key and that it needs no restart. KB 452775 was written for 8.18.Push and pull from a pipeline. Everything in Git History is also in the REST API’s Repository (Version Control) Service: GET /vco/api/content-repositories/state shows how far the server is ahead of or behind the branch, and push and pull are requests, such as POST /vco/api/content-repositories/requests/pull, that you start and then poll until they finish. A scheduled workflow or an external pipeline can pull every night, so a server never drifts far from its branch.
vco01 and record the request bodies, the status values to poll for, and the response when a merge conflict stops a pull (KB 452775 describes a MERGE_CONFLICT status with the conflicting paths).Clusters. A three-node cluster (recipe 2.4) shares one database, and so one local repository and one connection. Set up Git once, on any node’s client.
See also
- 6.1 Version history and restore, for the local history Git builds on.
- 6.4 Promoting content from development to production, which uses a second branch and a pull request.
- Broadcom TechDocs (VCF 9.0): VCF Operations orchestrator Object Version History, with Reset Your VCF Operations orchestrator Content Inventory to a Previous State with Git; Prepare Your GitLab Environment and the pages beside it.
- Broadcom TechDocs (VCF 9.1): Git Branching for VCF Operations orchestrator Content Management, under Operations and Maintenance Tasks for VCF Operations Orchestrator.
- VMware Docs (Aria Automation Orchestrator 8.16–8.17): Configure a connection to a Git repository and Push changes to a Git repository.
- Broadcom KB 446735 (secure strings after Git synchronization), 314887 (abbreviated object ID), 453014 (restoring one workflow from Git), 452775 (large pulls and merge conflicts).
- Broadcom developer documentation (VCF Operations Orchestrator API, latest): Repository (Version Control) Service.
- Cloudblogger: Git & Orchestrator: automated synchronization with remote repo, a workflow that pushes and pulls through the REST API.
- GitHub Docs: Managing your personal access tokens.
- CloudBlogger, the author’s blog: How do Orchestrator constructs look in Git?, Don’t Ignore .gitignore in vRO 8.x, Disable Git Push from Non-Dev Orchestrators.
