-
Notifications
You must be signed in to change notification settings - Fork 19
Post‐Processor
Type: huaweicloud-import
Artifact BuilderId: packer.post-processor.huaweicloud-import
The Packer HuaweiCloud Import post-processor takes a source artifact from various builders and imports it to a HuaweiCloud Image.
The import process operates by making a temporary copy of the source artifact to an OBS bucket, and calling an import task in IMS on the file. Once completed, a HuaweiCloud Image is returned. The temporary copy in OBS can be discarded after the import is complete.
There are some configuration options available for the post-processor. There are two categories: required and optional parameters.
-
access_key
(string) - The access key of the HuaweiCloud to use. If omitted, the HW_ACCESS_KEY environment variable is used. -
secret_key
(string) - The secret key of the HuaweiCloud to use. If omitted, the HW_SECRET_KEY environment variable is used. -
region
(string) - The HuaweiCloud region in which to launch the server to create the image. If omitted, the HW_REGION_NAME environment variable is used. -
obs_bucket_name
(string) - The name of the OBS bucket where theraw
,zvhd2
,vmdk
orqcow2
file will be copied to for import. This bucket must exist when the post-processor is run. -
image_name
(string) - The name of the user-defined image, which contains 1-63 characters and only supports Chinese, English, numbers, '-_,.:[]'. -
image_os_version
(string) - The OS version, such as:CentOS 7.0 64bit
. You may refer to API docs for detail. -
min_disk
(int) - The minimum size (GB) of the system disk, the value ranges from 1 to 1024 and must be greater than the size of the image file. -
format
(string) - The format of the import image , Possible values are:raw
,zvhd2
,vmdk
orqcow2
.
-
obs_object_name
(string) - The name of the object key inobs_bucket_name
where theraw
,zvhd2
,vmdk
orqcow2
file will be copied to import. -
image_description
(string) - The description of the image. -
image_type
(string) - The image type. The value can beECS
orBMS
, the default value isECS
. -
image_tags
(map[string]string) - The tags of the packer image in key/value format. -
image_architecture
(string) - The image architecture type. The value can bex86
andarm
, the default value isx86
. -
enterprise_project_id
(string) - The ID of Enterprise Project in which to create the image. If omitted, the HW_ENTERPRISE_PROJECT_ID environment variable is used. -
quick_import
(bool) - Whether to use the quick import method to import the image. (Default:false
). Currently, onlyraw
andzvhd2
image files are supported, and the size of an image file cannot exceed 1 TB. You are advised to import image files that are smaller than 128 GB with the common method. -
skip_clean
(bool) - Whether we should skip removing the source image file uploaded to OBS after the import process has completed. Possible values are:true
to leave it in the OBS bucket,false
to remove it. (Default:false
). -
wait_image_ready_timeout
(string) - Timeout of creating the image. The timeout string is a possibly signed sequence of decimal numbers, each with optional fraction and a unit suffix, such as "40m", "1.5h" or "2h30m". The default timeout is "30m" which means 30 minutes.
Here is a basic example. This assumes that the builder has produced a RAW artifact.
"post-processors":[
{
"type":"huaweicloud-import",
"region": "cn-north-4",
"obs_bucket_name": "image-bucket",
"format": "raw",
"min_disk": 40,
"image_name": "packer_import_demo",
"image_os_version": "CentOS 7.0 64bit",
"image_description": "import by packer from OBS",
"image_architecture": "x86",
"image_tags": {
"owner": "packer",
"env": "release"
}
}
]
This will take the RAW generated by a builder and upload it to OBS. In this case, an existing bucket called image-bucket
in the cn-north-4
region will be where the copy is placed.
Once uploaded, the import process will start, creating a HuaweiCloud image in the cn-north-4
region with the name you specified in template file.