alibaba / packer-provider

Apache License 2.0
92 stars 26 forks source link

No alicloud image was found matching filters: centos_7_9_x64_20G_alibase_20211027.vhd #78

Open wwyhy opened 2 years ago

wwyhy commented 2 years ago

Hi,

We are trying to build a image base on official image, and using the official published image from page https://help.aliyun.com/document_detail/100410.html

But we got the error "no matching image found". Please help on this. thanks!


+ packer build base.json
alicloud-ecs: output will be in this color.

==> alicloud-ecs: Prevalidating source region and copied regions...
==> alicloud-ecs: Prevalidating image name...
==> alicloud-ecs: No alicloud image was found matching filters: centos_7_9_x64_20G_alibase_20211027.vhd
Build 'alicloud-ecs' errored after 855 milliseconds 521 microseconds: No alicloud image was found matching filters: centos_7_9_x64_20G_alibase_20211027.vhd

==> Wait completed after 855 milliseconds 711 microseconds

==> Some builds didn't complete successfully and had errors:
--> alicloud-ecs: No alicloud image was found matching filters: centos_7_9_x64_20G_alibase_20211027.vhd
alexyueer commented 2 years ago

centos_7_9_x64_20G_alibase_20211027.vhd is not online in zhangjiakou, it will publish soon.

wwyhy commented 2 years ago

@alexyueer

Thanks for your quickly response,

I tried change to another one, but latest 4 images are NOT working. and the centos_7_9_x64_20G_alibase_20210623.vhd is worked in Sep 2021. now it is also not working.

please suggest how can i proceed this? thanks in advance!

wangweihong commented 10 months ago

Got same error. No alicloud image was found matching filters: centos_7_9_x64_20G_alibase_20230815.vhd

image exists by call DescribeImages.

{
  "TotalCount": 1,
  "PageSize": 10,
  "RequestId": "C0FD71A1-40EA-55DB-B965-DB3B96808F79",
  "PageNumber": 1,
  "Images": {
    "Image": [
      {
        "ImageOwnerAlias": "system",
        "Description": "Kernel version is 3.10.0-1160.92.1.el7.x86_64, 2023.8.17",
        "IsSelfShared": "",
        "Platform": "CentOS",
        "ResourceGroupId": "",
        "Size": 20,
        "IsSubscribed": false,
        "BootMode": "BIOS",
        "OSName": "CentOS  7.9 64位",
        "IsPublic": true,
        "ImageId": "centos_7_9_x64_20G_alibase_20230815.vhd",
        "DetectionOptions": {},
        "Features": {
          "NvmeSupport": "supported"
        },
        "OSNameEn": "CentOS  7.9 64 bit",
        "Tags": {
          "Tag": []
        },
        "LoginAsNonRootSupported": true,
        "Status": "Available",
        "Progress": "100%",
        "Usage": "instance",
        "Architecture": "x86_64",
        "ProductCode": "",
        "IsCopied": false,
        "ImageFamily": "acs:centos_7_9_x64",
        "IsSupportIoOptimized": true,
        "IsSupportCloudinit": true,
        "ImageName": "centos_7_9_x64_20G_alibase_20230815.vhd",
        "DiskDeviceMappings": {
          "DiskDeviceMapping": []
        },
        "ImageVersion": "v2023.8.17",
        "OSType": "linux",
        "CreationTime": "2023-08-24T07:09:57Z"
      }
    ]
  },
  "RegionId": "cn-shenzhen"
}
alexyueer commented 10 months ago

Got same error. No alicloud image was found matching filters: centos_7_9_x64_20G_alibase_20230815.vhd

image exists by call DescribeImages.

{
  "TotalCount": 1,
  "PageSize": 10,
  "RequestId": "C0FD71A1-40EA-55DB-B965-DB3B96808F79",
  "PageNumber": 1,
  "Images": {
    "Image": [
      {
        "ImageOwnerAlias": "system",
        "Description": "Kernel version is 3.10.0-1160.92.1.el7.x86_64, 2023.8.17",
        "IsSelfShared": "",
        "Platform": "CentOS",
        "ResourceGroupId": "",
        "Size": 20,
        "IsSubscribed": false,
        "BootMode": "BIOS",
        "OSName": "CentOS  7.9 64位",
        "IsPublic": true,
        "ImageId": "centos_7_9_x64_20G_alibase_20230815.vhd",
        "DetectionOptions": {},
        "Features": {
          "NvmeSupport": "supported"
        },
        "OSNameEn": "CentOS  7.9 64 bit",
        "Tags": {
          "Tag": []
        },
        "LoginAsNonRootSupported": true,
        "Status": "Available",
        "Progress": "100%",
        "Usage": "instance",
        "Architecture": "x86_64",
        "ProductCode": "",
        "IsCopied": false,
        "ImageFamily": "acs:centos_7_9_x64",
        "IsSupportIoOptimized": true,
        "IsSupportCloudinit": true,
        "ImageName": "centos_7_9_x64_20G_alibase_20230815.vhd",
        "DiskDeviceMappings": {
          "DiskDeviceMapping": []
        },
        "ImageVersion": "v2023.8.17",
        "OSType": "linux",
        "CreationTime": "2023-08-24T07:09:57Z"
      }
    ]
  },
  "RegionId": "cn-shenzhen"
}

centos_7_9_x64_20G_alibase_20230919.vhd

Got same error. No alicloud image was found matching filters: centos_7_9_x64_20G_alibase_20230815.vhd

image exists by call DescribeImages.

{
  "TotalCount": 1,
  "PageSize": 10,
  "RequestId": "C0FD71A1-40EA-55DB-B965-DB3B96808F79",
  "PageNumber": 1,
  "Images": {
    "Image": [
      {
        "ImageOwnerAlias": "system",
        "Description": "Kernel version is 3.10.0-1160.92.1.el7.x86_64, 2023.8.17",
        "IsSelfShared": "",
        "Platform": "CentOS",
        "ResourceGroupId": "",
        "Size": 20,
        "IsSubscribed": false,
        "BootMode": "BIOS",
        "OSName": "CentOS  7.9 64位",
        "IsPublic": true,
        "ImageId": "centos_7_9_x64_20G_alibase_20230815.vhd",
        "DetectionOptions": {},
        "Features": {
          "NvmeSupport": "supported"
        },
        "OSNameEn": "CentOS  7.9 64 bit",
        "Tags": {
          "Tag": []
        },
        "LoginAsNonRootSupported": true,
        "Status": "Available",
        "Progress": "100%",
        "Usage": "instance",
        "Architecture": "x86_64",
        "ProductCode": "",
        "IsCopied": false,
        "ImageFamily": "acs:centos_7_9_x64",
        "IsSupportIoOptimized": true,
        "IsSupportCloudinit": true,
        "ImageName": "centos_7_9_x64_20G_alibase_20230815.vhd",
        "DiskDeviceMappings": {
          "DiskDeviceMapping": []
        },
        "ImageVersion": "v2023.8.17",
        "OSType": "linux",
        "CreationTime": "2023-08-24T07:09:57Z"
      }
    ]
  },
  "RegionId": "cn-shenzhen"
}

for shenzhen, centos_7_9_x64_20G_alibase_20230815.vhd is the lastest image and centos_7_9_x64_20G_alibase_20230919.vhd will be online soon. for hangzhou, centos_7_9_x64_20G_alibase_20230815.vhd is deprecated and centos_7_9_x64_20G_alibase_20230919.vhd is the lastest image.

wangweihong commented 10 months ago

I tried both image. but failed. I wonder if I can use aliyun public image to packer new image?

my packer version

root@wwhvw:/home/wwhvw# packer version
Packer v1.9.4

plugin installed

root@wwhvw:/home/wwhvw/packer-demo/aliyun# packer plugins installed
/root/.config/packer/plugins/github.com/hashicorp/alicloud/packer-plugin-alicloud_v1.1.0_x5.0_linux_amd64

hcl template

variable "access_key" {
  type    = string
  default = "${env("ALICLOUD_ACCESS_KEY")}"
}

variable "secret_key" {
  type    = string
  default = "${env("ALICLOUD_SECRET_KEY")}"
}

source "alicloud-ecs" "aliyun-test" {
  access_key           = "${var.access_key}"
  image_name           = "packer_basic{{timestamp}}"
  instance_type        = "ecs.t5-lc1m1.small"
  internet_charge_type = "PayByTraffic"
  io_optimized         = "true"
  region               = "cn-shenzhen"
  secret_key           = "${var.secret_key}"
  #source_image         = "centos_7_9_x64_20G_alibase_20230815.vhd"
  source_image         = "centos_7_9_x64_20G_alibase_20230919.vhd"
  ssh_username         = "root"
  run_tags = {
    "Built by"   = "Packer"
    "Managed by" = "Packer"
  }
}

build {
  sources = ["source.alicloud-ecs.aliyun-test"]

  provisioner "shell" {
    inline = ["sleep 30", "yum install redis.x86_64 -y"]
  }

}
alexyueer commented 10 months ago

Try to use image_family, and you can find os related image_family. Any error, please copy the execution detail.

wangweihong commented 10 months ago

still fail.

source "alicloud-ecs" "aliyun-test" {
  access_key           = "${var.access_key}"
  image_name           = "packer_basic{{timestamp}}"
  instance_type        = "ecs.t5-lc1m1.small"
  internet_charge_type = "PayByTraffic"
  io_optimized         = "true"
  region               = "cn-shenzhen"
  secret_key           = "${var.secret_key}"
  #source_image         = "centos_7_9_x64_20G_alibase_20230815.vhd"
  #source_image         = "centos_7_9_x64_20G_alibase_20230919.vhd"
  image_family          = "acs:centos_7_9_x64"
  ssh_username         = "root"
  run_tags = {
    "Built by"   = "Packer"
    "Managed by" = "Packer"
  }
}
2023/10/12 08:13:02 Starting build run: alicloud-ecs.aliyun-test
2023/10/12 08:13:02 Running builder:
2023/10/12 08:13:02 [INFO] (telemetry) Starting builder alicloud-ecs.aliyun-test
==> alicloud-ecs.aliyun-test: Prevalidating source region and copied regions...
==> alicloud-ecs.aliyun-test: Prevalidating image name...
==> alicloud-ecs.aliyun-test: No alicloud image was found matching image family: acs:centos_7_9_x64
2023/10/12 08:13:07 [INFO] (telemetry) ending alicloud-ecs.aliyun-test
==> Wait completed after 4 seconds 496 milliseconds
2023/10/12 08:13:07 machine readable: error-count []string{"1"}
==> Some builds didn't complete successfully and had errors:
2023/10/12 08:13:07 machine readable: alicloud-ecs.aliyun-test,error []string{"No alicloud image was found matching image family: acs:centos_7_9_x64"}
==> Builds finished but no artifacts were created.
2023/10/12 08:13:07 [INFO] (telemetry) Finalizing.
Build 'alicloud-ecs.aliyun-test' errored after 4 seconds 495 milliseconds: No alicloud image was found matching image family: acs:centos_7_9_x64

==> Wait completed after 4 seconds 496 milliseconds

==> Some builds didn't complete successfully and had errors:
--> alicloud-ecs.aliyun-test: No alicloud image was found matching image family: acs:centos_7_9_x64

==> Builds finished but no artifacts were created.
2023/10/12 08:13:09 [WARN] (telemetry) Error finalizing report. This is safe to ignore. Post "https://checkpoint-api.hashicorp.com/v1/telemetry/packer": context deadline exceeded
2023/10/12 08:13:09 waiting for all plugin processes to complete...
2023/10/12 08:13:09 /root/.config/packer/plugins/github.com/hashicorp/alicloud/packer-plugin-alicloud_v1.1.0_x5.0_linux_amd64: plugin process exited
2023/10/12 08:13:09 /usr/bin/packer: plugin process exited

image

alexyueer commented 10 months ago

The specified sub account used in packer is not authorized.

wangweihong commented 10 months ago

@alexyueer OMG. Thanks a lot! You save my life.