Make AWS Images Work with CloudFormation

root device / block device needs full '/dev/...' for CloudFormation to work (individual instance launches worked just fine though).

Also...
* HOCON += introduces unwanted spaces in motd
* minor log.debug fixes
* update gen_releases.py --help note
This commit is contained in:
Jake Buchholz Göktürk 2021-12-28 13:11:16 -08:00
parent c1469d6c31
commit 51cc63091f
5 changed files with 21 additions and 18 deletions

4
build
View File

@ -128,10 +128,10 @@ def install_overlay(overlay):
if is_images_conf(overlay, src_x): if is_images_conf(overlay, src_x):
rel_x = os.readlink(src_x) rel_x = os.readlink(src_x)
if os.path.islink(dest_x): if os.path.islink(dest_x):
print(f"\toverriding {dest_x}") log.debug('overriding %s', dest_x)
os.unlink(dest_x) os.unlink(dest_x)
print(f"\tln -s {rel_x} {dest_x}") log.debug('ln -s %s %s', rel_x, dest_x)
os.symlink(rel_x, dest_x) os.symlink(rel_x, dest_x)
continue continue

View File

@ -204,13 +204,13 @@ class AWSCloudAdapter(CloudAdapterInterface):
img = ec2c.register_image( img = ec2c.register_image(
Architecture=self.ARCH[ic.arch], Architecture=self.ARCH[ic.arch],
BlockDeviceMappings=[{ BlockDeviceMappings=[{
'DeviceName': 'xvda', 'DeviceName': '/dev/xvda',
'Ebs': {'SnapshotId': snapshot_id} 'Ebs': {'SnapshotId': snapshot_id}
}], }],
Description=description, Description=description,
EnaSupport=True, EnaSupport=True,
Name=ic.image_name, Name=ic.image_name,
RootDeviceName='xvda', RootDeviceName='/dev/xvda',
SriovNetSupport='simple', SriovNetSupport='simple',
VirtualizationType='hvm', VirtualizationType='hvm',
BootMode=self.BOOT_MODE[ic.firmware], BootMode=self.BOOT_MODE[ic.firmware],

View File

@ -18,13 +18,13 @@ Default {
motd { motd {
welcome = "Welcome to Alpine!" welcome = "Welcome to Alpine!"
wiki = "The Alpine Wiki contains a large amount of how-to guides and general\n" wiki = "The Alpine Wiki contains a large amount of how-to guides and general\n"\
wiki += "information about administrating Alpine systems.\n" "information about administrating Alpine systems.\n"\
wiki += "See <https://wiki.alpinelinux.org/>." "See <https://wiki.alpinelinux.org/>."
version_notes = "Release Notes:\n" version_notes = "Release Notes:\n"\
version_notes += "* <https://alpinelinux.org/posts/alpine-{version}.0/released.html>" "* <https://alpinelinux.org/posts/alpine-{version}.0/released.html>"
release_notes = "* <https://alpinelinux.org/posts/{release}/released.html" release_notes = "* <https://alpinelinux.org/posts/{release}/released.html"
} }
# initial provisioning script and data directory # initial provisioning script and data directory

View File

@ -7,11 +7,13 @@ import sys
import textwrap import textwrap
NOTE = textwrap.dedent(""" NOTE = textwrap.dedent("""
This script's output is meant to be compatible with alpine-ec2-ami's This script's output is compatible with the retired alpine-ec2-ami repo's
releases.yaml, in order to bridge the gap until https://alpinelinux.org/cloud releases/alpine.yaml, in order to bridge the gap until
can be updated to be generated from another source, or dynamically calls an https://alpinelinux.org/cloud dynamically calls a published-image metadata
published image metadata service. This script should only be run after service. This script should only be run after the main 'build' script has
the main 'build' script has been used successfully to publish all images. been used successfully to publish ALL images, and the STDOUT should be
committed to the https://gitlab.alpinelinux.org/alpine/infra/alpine-mksite
repo as 'cloud/releases-in.yaml'.
""") """)
sys.pycache_prefix = 'work/__pycache__' sys.pycache_prefix = 'work/__pycache__'

View File

@ -366,6 +366,7 @@ class ImageConfig():
actions = {} actions = {}
revision = 0 revision = 0
remote_image = clouds.latest_build_image(self) remote_image = clouds.latest_build_image(self)
log.debug('\n%s', remote_image)
step_state = step == 'state' step_state = step == 'state'
# enable actions based on the specified step # enable actions based on the specified step
@ -407,17 +408,17 @@ class ImageConfig():
elif remote_image: elif remote_image:
if remote_image.imported: if remote_image.imported:
# already imported, don't build/import again # already imported, don't build/import again
log.info('%s - already imported', self.image_key) log.debug('%s - already imported', self.image_key)
actions.pop('build', None) actions.pop('build', None)
actions.pop('import', None) actions.pop('import', None)
if remote_image.published: if remote_image.published:
# NOTE: re-publishing can update perms or push to new regions # NOTE: re-publishing can update perms or push to new regions
log.info('%s - already published', self.image_key) log.debug('%s - already published', self.image_key)
if self.local_path.exists(): if self.local_path.exists():
# local image's already built, don't rebuild # local image's already built, don't rebuild
log.info('%s - already locally built', self.image_key) log.debug('%s - already locally built', self.image_key)
actions.pop('build', None) actions.pop('build', None)
# merge remote_image data into image state # merge remote_image data into image state