-
Notifications
You must be signed in to change notification settings - Fork 4
Getting started
- Target system - VMware Cloud or on-prem vRealize Automation system
- Entity - vRealize Automation object that can be generated and/or reverse generated
- Client - Http client that is used to send and receive data to and from vRA
- Model - Our representation of different entities, as required for generation purposes
- Generation - the act of creating content in the target system
- Reverse generation - the act of creating code representation of existing content in the target system
It's recommended that you use a Maven project for content development as we've build our tooling around it, but any other project format should work as well if you're confident you can set that up.
-
Create your project
- (Optionally) Reverse generate any existing content
- Write content
- Package and distribute
Content files are written in Groovy and they look like this:
import com.vmware.devops.model.cloudassembly.infrastructure.VsphereCloudAccount
return VsphereCloudAccount.builder()
.hostname("my-vc-url")
.username("[email protected]")
.password("password")
.datacenters(["Datacenter"])
.build()
Each configuration can return no generation entities, a single generation entity or a list of generation entities.
Often you may want to specify some defaults when generating content, like a default project of default Jenkins endpoint. These can be set up in the generation context.
import com.vmware.devops.GenerationContext
import com.vmware.devops.model.codestream.Input
import com.vmware.devops.model.codestream.JenkinsTask
import com.vmware.devops.model.codestream.Pipeline
import com.vmware.devops.model.codestream.Stage
GenerationContext context = context
context.globalConfiguration.defaultProject = "my-default-project"
return Pipeline.builder()
.name("sample-pipeline")
.stages([
Stage.builder()
.name("Stage-1")
// .project("override-default")
.tasks([
JenkinsTask.builder()
.name("Task-1")
.job("test-job")
.inputs([
new Input("changeA", "Hello")
])
.build()
])
.build()
])
.build()
In the above example the sample-pipeline
Codestream pipeline will be created in the my-default-project
project. If you want to override the defaults, simply define the project for the pipeline .project("override-default")
The generation context is a singleton, so changes there persist for every content file that's processed after the one that modifies it. For bigger projects, is recommended that you extract changes in the generation context in a separate files, so they are easy to track.
Full list of options in the generation context is available here.
For more information how generation and reverse generation works under the hood, see Generation and reverse generation