Packages: create, export, import
A package is Orchestrator’s way of moving content. It’s a signed file that holds workflows, actions, policies, configuration elements, and resource elements, together with everything they depend on. For most objects you create in the client, a package is the only way to export them and import them somewhere else.
In this recipe you put the workflow from recipe 6.1 into a package, check that its action and configuration element came along, export it, and import it into the Orchestrator embedded in VCF Automation. Then you change the workflow and import it again, to see how Orchestrator decides what to overwrite.
Getting ready
- The workflow Report powered-on VMs, the action
com.vcfguide.chapter6/countPoweredOnVms, and the configuration elementvcfguide-ch6-settingsfrom recipe 6.1, onvco01.vmw.lab. - A login with administrator rights on
vco01.vmw.lab, and on the target: the Orchestrate tab of the Provider Consumption organization in VCF Automation,auto.vmw.lab(recipe 1.1). - The vCenter
vc01.vmw.labregistered on the target too, so the workflow can run there. - A package signing certificate that works on
vco01. If export fails with500, OK, fix that first (recipe 2.3).
How to do it
Create the package
- On
vco01, go to Assets > Packages and click New Package. - On the General tab, enter the name
com.vcfguide.chapter6and the descriptionChapter 6 example content: Report powered-on VMs. Keep the name to letters, digits, and dots. Special characters aren’t allowed. - Open the Content tab and click Add. Find Report powered-on VMs, select it, and click Add.
- Click Create.
- Open the package again and look at the Content tab. Besides the workflow, it now lists the action
countPoweredOnVmsand the configuration elementvcfguide-ch6-settings. Orchestrator found them by reading the workflow, and added them when it created the package.
Assets > Packages, package com.vcfguide.chapter6, Content tab listing the workflow Report powered-on VMs, the action com.vcfguide.chapter6/countPoweredOnVms, and the configuration element vcfguide-ch6-settings, with type and version columns.
Export it
- In the list of packages, click Export on
com.vcfguide.chapter6. The export dialog offers three options:
| Option | What it adds | For this package |
|---|---|---|
| Add configuration attribute values to package | The values of configuration element variables | On |
| Add configuration SecureString attribute values to package | The values of SecureString variables, such as passwords |
Off |
| Add global tags to package | The global tags on the objects | Off |
- Under the access rights for whoever imports the package, leave View contents, Add to package, and Edit contents selected.
- Click Ok. Your browser downloads
com.vcfguide.chapter6.packageto its download folder.
Export dialog for com.vcfguide.chapter6: Add configuration attribute values to package selected, Add configuration SecureString attribute values to package and Add global tags to package cleared, and the three access rights View contents, Add to package, Edit contents selected.
Import it into the second Orchestrator
- In VCF Automation, open the Provider Consumption organization’s Orchestrate tab, go to Assets > Packages, and click Import. Browse to
com.vcfguide.chapter6.packageand click Open. - The General tab shows the package’s name, description, number of items, and the certificate it was signed with. The certificate is
vco01’s package signing certificate, which this server hasn’t seen before. Check that it’s the one you expect (recipe 2.3), and confirm that you trust it. - Open the Package elements tab. All three elements are new on this server, so all three are selected.
- Leave Import Configuration Attribute Values selected, so
reportPrefixarrives with its value. In the tags drop-down, choose not to import tags. - Click Import.
Import dialog on the embedded Orchestrator at auto.vmw.lab, General tab: package com.vcfguide.chapter6, description, 3 items, and the certificate details of vco01's signing certificate with the trust prompt.
- Check the result on the target. The workflow is in VCF Orchestrator Guide/Chapter 6, the action is in
com.vcfguide.chapter6, and the configuration element is in VCF Orchestrator Guide/Chapter 6, withreportPrefixset toVCF GuideandapiTokenempty. - Open
vcfguide-ch6-settingson the target, enter a value forapiToken, and save. Run Report powered-on VMs. It logs the same kind of line as onvco01.
Import a newer version
- Back on
vco01, open Report powered-on VMs, change the log text from VMs powered on to VMs are powered on, raise the Version to1.2.0, and save. - Open the package
com.vcfguide.chapter6and save it, so it picks up the new version, and export it again as in steps 6 to 8. - Import it on the target again. This time the Package elements tab compares each element with the one already there. The workflow is newer, so it’s selected. The action and the configuration element are the same version as on the server, so they aren’t.
- Clear Import Configuration Attribute Values. The target already has its own values, and an import with values would overwrite them. Click Import.
Import dialog on auto.vmw.lab, Package elements tab: Report powered-on VMs 1.2.0 (server 1.1.0) selected; countPoweredOnVms and vcfguide-ch6-settings at the same version, not selected; Import Configuration Attribute Values cleared.
How it works
What goes in. When you add an object to a package, Orchestrator reads it for references: the actions and workflows a workflow calls, the configuration elements its variables are bound to, the resource elements a script loads. Each one found is added, and so are its own references, until nothing new turns up. That’s why you only added the workflow. The search reads scripts as text, so an action named in a comment, such as // was System.getModule("com.vcfguide.chapter6").oldCount(), is added too. Broadcom calls this expected behaviour. Remove dead references from scripts rather than fight them in the package.
What doesn’t. A package carries content, not the plug-ins or plug-in configuration that content needs. The target must already have the same plug-ins (recipe 5.1), the same vCenter or REST host registered under the same name, and the same environments for Python, Node.js, or PowerShell actions (recipe 4.3). The import doesn’t warn you. The workflow imports, then fails on its first run.
POST /packages/{packageName}/environment/{envId} and …/environment_repository/{envRepoId}). Check on 9.1.1 whether a package that holds a Python action adds its environment as a dependency, and whether the client lets you add one by hand.Versions decide what’s overwritten. On import, each element is matched with the object of the same ID on the server, not the same name. If the package’s version number is higher, the element is selected and replaces the server’s object. If it’s the same or lower, it isn’t selected. You can still select an older version by hand, and then it replaces a newer one. This is why version numbers matter (recipe 6.1): a change saved without raising the number looks unchanged to an import, and is silently skipped.
Values belong to the server. A configuration element’s variables and their values are separate things in a package. The first import of vcfguide-ch6-settings brought the variables and the value of reportPrefix. The second import, with Import Configuration Attribute Values cleared, would leave the target’s values alone even if the element itself were updated. SecureString values travel only if you choose Add configuration SecureString attribute values to package on export. Leave it off unless both servers really should share a secret, and then treat the .package file like a password.
Signed, and rights attached. Orchestrator signs every package with its signing certificate, and the certificate travels in the file. On import, the target checks the signature and shows you the certificate, so you can tell where the package came from and that it wasn’t changed on the way. The access rights you chose on export, View contents, Add to package, and Edit contents, travel with the elements and limit what the importing server may do with them. Clearing Edit contents, for example, gives the target workflows that run but can’t be changed there.
com.vcfguide.chapter6 with Edit contents cleared, import it on auto.vmw.lab, and record what an administrator there can and can’t do with the workflow on 9.1.1.There's more
One package per deliverable. Name packages like action modules, in reverse DNS, and keep one package per thing you ship: a use case, a team’s library, a product integration. Then the package’s version history (packages have one too, recipe 6.1) tells you what each delivery contained.
Back up library content you changed. An import can overwrite any object with the same ID, including workflows and actions that ship with Orchestrator under com.vmware.library if a package contains a changed copy. Broadcom’s import procedure starts with “back up any standard objects you have modified”. Better still, never modify them: duplicate the workflow or action into your own folder or module and change the copy.
Resource elements on their own. A single resource element, such as an HTML template or a JSON file, can also be exported and imported on its own under Assets > Resources, without a package. Everything else needs one.
Rebuild after big changes. If you remove a reference from a workflow, the package still holds the element it used to call. The REST API has a Rebuild Package call, POST /vco/api/packages/{packageName}/rebuild, that scans the package’s content again. To drop an element by hand, remove it on the Content tab. A dependency can only be removed after the object that needs it.
Read a package before you import it. The import dialog’s General and Package elements tabs are a preview. Nothing changes until you click Import. Use them to check what a package from a vendor or a colleague would overwrite before you let it.
Package files are ZIP archives. You can open a .package file with any ZIP tool to see what’s inside: the elements and their signatures. Don’t edit it. A changed element no longer matches its signature, and the import refuses it.
com.vcfguide.chapter6.package with a ZIP tool and record its layout on 9.1.1 (the 9.1 API reference gives its media type as application/zip). Change one byte of an element and confirm that the import refuses it.See also
- 2.3 Managing the package signing certificate, for the certificate shown in step 10 and the
500, OKerror. - 4.7 Working with configuration elements in code, on keeping values per server.
- 6.4 Promoting content from development to production, which exports and imports this package through the REST API.
- Broadcom TechDocs (VCF 9.0): Managing Packages, Create a Package, Export a Package, and Import a Package.
- Broadcom developer documentation (VCF Operations Orchestrator API, latest): Packages service.
- Broadcom KB 445863: package creation fails with
500, OK. - CloudBlogger, the author’s blog: Lock Orchestrator workflows: make them non-editable.
