Listing as Code
I’ve often said that “the cloud is an API” or, more accurately, “the cloud is a set of related APIs and the compute, storage, and networking hardware upon which those APIs act” (although the first way of saying it is my favorite). What do we do with an API? We automate.
We’ve all heard of infrastructure as code, the declarative description of cloud infrastructure in a text format like YAML or JSON that can be consumed by a tool like Terraform to create the infrastructure and resources. In fact, the Oracle Cloud Marketplace offers applications that are deployable by using Terraform in just such a way.
Figure 1: An Application Page in the Oracle Cloud Marketplace
When we consider that, besides the Terraform code, the balance of a Marketplace listing is the text that describes the application and the URLs that specify illustrative images, we have the perfect formula for a listing as code. Combine that with a tool that can consume that code, and we have the ingredients for a useful continuous integration/continuous delivery (CI/CD) pipeline for Marketplace listings.
Why do we need such a pipeline? Although it’s true that we can create and update a Marketplace listing with the web interface, imagine a scenario in which a partner needs to update their listing because of ongoing product development. Such a partner likely already has their own CI/CD tooling for creating the deployable virtual machine images and the Terraform. Without the listing as code concept, manual steps are required at the end of every successful build: log in to the listing platform and update the listing. When the listing is backed by code, however, the process becomes entirely automated.
The Oracle Cloud Marketplace is supported by the Publisher API. Our CI/CD tool chain incorporates this API into a small Python script that consumes the YAML and Terraform that represent the listing. The script then makes the necessary API calls to update the listing with the updated metadata and Terraform. And all this happens without the need for human intervention.
Any automation platform can host this script. One such platform is GitHub Actions. With the metadata and Terraform stored in a GitHub repo, a set of GitHub actions are configured to run when new commits are pushed to that repo, whether they are updates to the listing metadata (descriptive text, links to screenshots, and so on) or updates to the Terraform, which instantiates the compute, storage, and networking resources needed to run the application.
Figure 2: GitHub Actions Workflow for Terraform Testing
In fact, we’ve gone a step further and included actions that invoke Packer to run arbitrary Packer build scripts against an empty Oracle Cloud Infrastructure platform image running Oracle Linux. In this way, a partner can supply their software via a URL to an RPM and create the VM image that is instantiated when a customer chooses to deploy their application through the Oracle Cloud Marketplace.
Figure 3: GitHub Actions Workflow for Running Packer
I hope this post has made you as excited as I am about the possibilities of this tool set. If you want to discuss having your application listed in the Oracle Cloud Marketplace backed by listing as code, contact me at email@example.com. Thanks for reading!