Packaging by use case
Recipe 6.2 showed how a package works. This recipe is about what goes into one. The Coding Design Guide is clear: package by use case, customer.ipam and customer.cmdb, not by delivery, customer.phase1. A phase package mixes things that change for different reasons, so updating one use case means re-importing all of them. A use-case package can be updated, tested and rolled back on its own.
You’ll build three packages for the decommissioning solution, and see what Orchestrator puts into a package without asking.
Getting ready
- The decommissioning solution from recipes 9.1 and 9.4, and the tests from recipe 9.6 if you’ve written them.
- Recipe 6.2 (packages: create, export, import).
How to do it
Decide the packages
-
Split the solution’s content by who needs it and how often it changes:
Package Holds Why on its own com.vcfguide.corecom.vcfguide.core.vc/waitForTaskand other shared contentAny solution may need it; it changes rarely, and must never depend on a use case (recipe 9.3) com.vcfguide.vm.decommissionthe five workflows, the actions in com.vcfguide.vm, the elementVCFG_DecommissionEverything for one use case, installed and updated together com.vcfguide.vm.decommission.testthe two [TEST]workflows from recipe 9.6The guide’s advice: tests in their own package, in source control, never imported into production
Build the shared package first
- Under Assets > Packages, create
com.vcfguide.corewith the description Shared building blocks any VCFG solution may use. Calls nothing outside itself. On the Content tab, add the actionwaitForTask. Save.
Build the use-case package, then clean it up
- Create
com.vcfguide.vm.decommission, with a description that tells an installer what to do: VM decommissioning: retire a VM on request, delete it after a grace period. Needs com.vcfguide.core. After import, run VCFG - VM - Configure Decommissioning. - On the Content tab, add the five workflows: VCFG - VM - Decommission VM, VCFG - VM - Delete Retired VMs, VCFG - VM - Configure Decommissioning, VCFG - LIB - Retire VM and VCFG - LIB - Delete VM. Save.
- Look at what’s in the package now. Orchestrator added what the workflows use: the actions, the configuration element
VCFG_Decommission, and alsowaitForTask, because the actions call it. That one belongs tocom.vcfguide.core. Remove it from this package. - Check that every action is there. Orchestrator finds an action when a workflow calls it as an Action element, or in a script as
System.getModule("module").action(…)in one expression. It misses an action called any other way, for example through a variable that holds the module.getRetiredInfo(recipe 9.6) is called asvmModule.getRetiredInfo(…), so add it by hand. - Check that nothing from the built-in library is in it. If one of your workflows calls a library workflow such as Remove all snapshots, the package may pull it in. Remove it: the target Orchestrator has its own, of its own version.
Export
- Export
com.vcfguide.coreandcom.vcfguide.vm.decommissionwith Add configuration attribute values to package cleared. The element goes without values, and the installer sets them with the setup workflow (recipe 9.4). Name the files by the naming standard:com.vcfguide.vm.decommission_v1.0.0_20261201.package. - Create
com.vcfguide.vm.decommission.testwith the two test workflows. Orchestrator addsVCFG_Decommissionto it, because the integration test is bound to it. Remove it: the element belongs to the use-case package, and a test package that carried it would replace the real one’s values on import.
Assets > Packages > com.vcfguide.vm.decommission, Content tab: five workflows, five actions in com.vcfguide.vm, one configuration element VCFG_Decommission; no waitForTask.
Install on another Orchestrator, in order
- Import
com.vcfguide.core, thencom.vcfguide.vm.decommission, then run VCFG - VM - Configure Decommissioning, then the integration test from recipe 9.6 (from the test package, on a test system). - For an update, change the content, raise the version of every workflow and action you changed, and export the use-case package again. On import, Orchestrator selects an element for replacement only when the package’s version is higher than the server’s (recipe 6.2), so a change without a new version is easy to miss on the target.
waitForTask and VCFG_Decommission; an action called through a variable wasn’t added. An element removed from a package stays out on export.VCFG_Decommission there before the setup workflow has run (it should fail in Check inputs of Retire VM, with retireFolder missing).How it works
Use case, not timeline. Phase 2 of a project rarely changes only phase 2 content. With customer.phase1 and customer.phase2, a fix to one workflow means re-importing a package full of unrelated work, and testing all of it again. With com.vcfguide.vm.decommission, the change, the test and the rollback are all about decommissioning.
Shared content in its own package. When two use-case packages both carry waitForTask, whichever is imported last decides its version on the target. Keep it in com.vcfguide.core, import that first, and use-case packages can’t overwrite it with an older copy.
Orchestrator packs what it can see. Adding a workflow brings what its schema references: actions in Action elements, called workflows, bound configuration elements, and actions called with System.getModule("…").name(…). It can’t see a call it would have to run the script to work out. Check the Content tab after every change, and remove anything that belongs elsewhere: shared content, built-in library content, and elements a test only reads.
Don’t copy the built-in library. The guide’s advice is to call the plug-in’s workflows and actions rather than copy their code, so that you get their fixes when the plug-in is updated, and Broadcom support recognises what you’re running. The same goes for packages: exporting a built-in workflow ships a frozen copy of it.
There's more
Editable and read-only copies. The guide suggests two exports of each package: an editable one for the team, and one for production with Edit contents cleared, so that workflows run there but can’t be changed there (recipe 6.2).
Packages and Git. If you keep content in Git (recipe 6.3), keep one folder per package, so that a pull request touches one use case. Export files themselves are build output; keep them in a release store rather than in the repository.
See also
- 6.2 Packages: create, export, import.
- 6.4 Promoting content from development to production.
- 9.4 Setup workflows, run after every import.
- VMware: vRealize Orchestrator Coding Design Guide, technical white paper, March 2016 (section Packaging).
