-
Notifications
You must be signed in to change notification settings - Fork 1
Added support for creating a marketplace image in Alibaba #43
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Changes from all commits
96f7764
90a31f7
88ef674
3bcf07e
61d812e
109a88b
bf32d9c
c5a2087
71efa9c
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,56 @@ | ||
| # frozen_string_literal: true | ||
| cred_dir = ::File.expand_path(::File.join('~', '.alibaba')) | ||
| credential_file = ::File.join(cred_dir, 'credentials') | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I think we should probably move the alibaba credentials into the same data_bag that has the Azure, GCP, and AWS creds.
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I have used the same format as the data bag so it should just be a case of copying and paste from what I have. I do not know where the data bag for those is to update. To get this working I used a local version of the data bag that kitchen could read. |
||
|
|
||
| TIMESTAMP = Time.now.strftime('%Y_%m_%d_%H_%M_%S').freeze | ||
| INVALID_AMI_NAME_CHARACTERS = /[^\w\(\)\.\-\/]/ | ||
|
|
||
| def normalize_name(name) | ||
| # Append timestamp | ||
| # Remove invalid characters | ||
| # Ensure it's 128 characters or less | ||
| "#{name}_#{TIMESTAMP}".gsub(INVALID_AMI_NAME_CHARACTERS, '').strip[0..127] | ||
| end | ||
|
|
||
| default['marketplace_image']['alibaba']['cred_dir'] = cred_dir | ||
| default['marketplace_image']['alibaba']['credential_file'] = credential_file | ||
|
|
||
| default['marketplace_image']['alibaba']['public']['compliance']['enabled'] = false | ||
| default['marketplace_image']['alibaba']['public']['automate']['enabled'] = false | ||
|
|
||
| default['marketplace_image']['alibaba']['product_urls'] = { | ||
| 'marketplace' => 'http://chef-software.oss-cn-beijing.aliyuncs.com/chef-marketplace_0.2.5%2B20171003114422.git.4.cce18c9-1_amd64.deb', | ||
| 'automate' => 'http://chef-software.oss-cn-beijing.aliyuncs.com/automate_1.6.179-1_amd64.deb', | ||
| 'chef_server' => 'http://chef-software.oss-cn-beijing.aliyuncs.com/chef-server-core_12.16.9-1_amd64.deb', | ||
| } | ||
|
|
||
| default_marketplace_config = { | ||
| 'role' => 'automate', | ||
| 'platform' => 'alibaba', | ||
| 'user' => 'ubuntu', | ||
| 'support_email' => '[email protected]', | ||
| 'sales_email' => '[email protected]', | ||
| 'reporting_cron_enabled' => false, | ||
| 'doc_url' => 'https://docs.chef.io/alibaba_marketplace.html', | ||
| 'disable_outbound_traffic' => false, | ||
| 'license_type' => 'fixed', | ||
| 'free_node_count' => 5, | ||
| } | ||
|
|
||
| alibaba_builder_config = { | ||
| 'type' => 'alicloud-ecs', | ||
| 'region' => 'cn-beijing', | ||
| 'image_name' => 'chef_automate_20171020_1', | ||
| 'source_image' => 'ubuntu_14_0405_64_20G_alibase_20170824.vhd', | ||
| 'ssh_username' => 'root', | ||
| 'instance_type' => 'ecs.n4.xlarge', | ||
| 'io_optimized' => 'true', | ||
| 'internet_charge_type' => 'PayByTraffic', | ||
| 'image_force_delete' => 'true', | ||
| } | ||
|
|
||
| default['marketplace_image']['alibaba']['automate'] = { | ||
| 'name' => 'alibaba_automate_BYOL', | ||
| 'builder_options' => alibaba_builder_config, | ||
| 'marketplace_config_options' => default_marketplace_config, | ||
| } | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,4 @@ | ||
| #!/bin/bash | ||
|
|
||
| # Perform a distribution upgrade | ||
| sudo apt-get -o Dpkg::Options::="--force-confdef" -o Dpkg::Options::="--force-confold" dist-upgrade -y |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,8 @@ | ||
| #!/bin/bash | ||
|
|
||
| # Download an install Marketplace from the Alibaba Object Storage service | ||
|
|
||
| set -ex | ||
|
|
||
| wget -q -O chef-marketplace.deb <%= @url %> | ||
| sudo dpkg -i chef-marketplace.deb |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,3 @@ | ||
| { | ||
| "urls": <%= @urls %> | ||
| } |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
While I think it's good that we're upgrading packer, I'd prefer to see the default version updated to 1.0.4 and breaking changes in other packer definitions fixed. We're tracking that work on: CLOUD-261 and CLOUD-262
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Agreed - did not want to assume upgrading the default version whilst I was getting the initial Alibaba work going