Building a distributing a marketplace image for CycleCloud
Disclaimer
The scripts in this repository are provided "as is" without any support from Microsoft, or CycleCloud.
This only serves as an example of how to build a CycleCloud image with Packer.
See LICENSE for further information.
Introduction
The process for publishing a new image in Marketplace is:
- Create a VM with an attached managed disk and install CycleCloud into the disk
- Capture the VHD for the OS image and the managed disk
- Launch and test a new VM usig both VHDs
- Copy both VHDs to the storage account linked to the marketplace publisher account
- Go to the Cloud Partner Portal to update the artifact
The scripts in this repo use packer to build the images. These are then tested and the VHDs copied to the publishing storage account. The packer process, the deployment of the test VM, and the VHD transfer are scripted.
The Marketplace publishing guideline recommends that a separate subscription is used to hold the marketplace-linked VHDs, and that this subscription should not be used for anything else besides holding the storage account.
- The PM subscription is used to build the packer image and testing
- A separate marketplace subscription is used for the storage account
Pre-requisites
The scripts used require the following installed in your PATH
- jq
- packer
- az cli (logged in)
- Pogo credentials for both packer build VHD (this is in the PM subscription)
- Pogo credentials for the marketplace-linked storage account (this is in a separate subscription)
You should also have a config.json file in this directory. This json file has the following structure:
{
"subscription_id": "PM-Subscription-Used-By-Packer",
"location": "eastus",
"cyclecloud_installer_url": "https://cyclecloudarm.blob.core.windows.net/cyclecloudrelease",
"cyclecloud_version": "7.6.0",
"packer": {
"executable": "packer"
},
"service_principal": {
"name": "sp-usedby-packer-for-building-vm",
"tenant_id": "",
"application_id": "",
"password": ""
},
"build": {
"resource_group": "cyclecloud_mrktpl_image_builder",
"storage_account": "cyclecloudimagebuilder",
"blob_container": "imagevhds",
"image_name": "centos75",
"image_publisher": "OpenLogic",
"image_offer": "CentOS",
"image_sku": "7.5",
"vm_size": "Standard_D2_v3"
},
"publish": {
"resource_group": "cyclecloud_mrktpl_storage_account",
"storage_account": "azurecyclecloudmrktpl",
"image_container": "imagevhds",
""storage_key": "ACCESSKEY-For-StorageAccount",
}
}
Steps
- Edit or create config.json
- Replace cyclecloud_version with the version to be pushed
- fill in the service principal used for the packer build
- fill in the storage_key for the Marketplace Storage Account
-
Run the build script. This launches the packer process
./build_image.sh
- The script will output the OS_VHD_URL and DATA_VHD_URL
-
Test the images using the VHD URLs:
The build script outputs the URLs for the VHDs. To test the VHDs, provide them as input to the test script:
./test_vhd.sh ${OS_VHD_URL} ${DATA_VHD_URL}
-
Copy VHDs to azure marketplace storage account The target storage account is the one that is actually used for publishing. After verifying that the test VM using the VHD is working, copy it to the storage account for publishing:
./deploy_vhd.sh ${OS_VHD_URL} ${DATA_VHD_URL}
-
Go to the publishing portal, update the SKU with a new version and VHD artifacts
-
See CycleCloud Publishing for details on how to use the Marketplace Portal.