Alpine 3.16 Released

alpine.pkr.hcl
* fix setup-ssh in QEMU boot command

build
* add 'rollback' target, which when used with --revise will clean up any imported but unpublished images (use before 'build --clean configs')
* fix download of UEFI firmware - ovmf apk split aarch64 to new aavmf apk

configs
* alpine.conf - remove 3.12, add 3.16
* add ..._name to dimensional configs
* add cloud_(image|launch)_url

image_configs.py
* methods to resolve (image|launch)_url values

clouds/aws.py
* warn if setting image deprecation fails, but continue
This commit is contained in:
Jake Buchholz Göktürk 2022-05-23 19:17:45 -07:00
parent dd0e7b280c
commit faf93af63e
14 changed files with 63 additions and 21 deletions

View File

@ -61,7 +61,7 @@ source qemu alpine {
"root<enter>",
"setup-interfaces<enter><enter><enter><enter>",
"ifup eth0<enter><wait${var.qemu.cmd_wait}>",
"setup-sshd -c openssh<enter><wait${var.qemu.cmd_wait}>",
"setup-sshd openssh<enter><wait${var.qemu.cmd_wait}>",
"echo PermitRootLogin yes >> /etc/ssh/sshd_config<enter>",
"service sshd restart<enter>",
"echo 'root:${local.password}' | chpasswd<enter>",

31
build
View File

@ -48,13 +48,19 @@ from image_configs import ImageConfigManager
### Constants & Variables
STEPS = ['configs', 'state', 'local', 'import', 'publish']
STEPS = ['configs', 'state', 'rollback', 'local', 'import', 'publish']
LOGFORMAT = '%(asctime)s - %(name)s - %(levelname)s - %(message)s'
WORK_CLEAN = {'bin', 'include', 'lib', 'pyvenv.cfg', '__pycache__'}
WORK_OVERLAYS = ['configs', 'scripts']
OVMF_FIRMWARE = {
'aarch64': 'usr/share/OVMF/QEMU_EFI.fd',
'x86_64': 'usr/share/OVMF/OVMF.fd'
UEFI_FIRMWARE = {
'aarch64': {
'apk': 'aavmf',
'bin': 'usr/share/AAVMF/QEMU_EFI.fd',
},
'x86_64': {
'apk': 'ovmf',
'bin': 'usr/share/OVMF/OVMF.fd',
}
}
alpine = Alpine()
@ -120,6 +126,9 @@ def install_overlay(overlay):
os.makedirs(dest_dir, exist_ok=True)
for src in unique_list(['.'] + args.custom):
src_dir = os.path.join(src, overlay)
if not os.path.exists(src_dir):
log.debug('%s does not exist, skipping', src_dir)
continue
for x in glob(os.path.join(src_dir, '**'), recursive=True):
x = x.removeprefix(src_dir + '/')
src_x = os.path.join(src_dir, x)
@ -169,10 +178,12 @@ def install_qemu_firmware():
log.info('Installing UEFI firmware in work environment')
os.makedirs(firm_dir)
for arch, bin in OVMF_FIRMWARE.items():
v = alpine.apk_version('community', arch, 'ovmf')
ovmf_url = f"{alpine.repo_url('community', arch)}/ovmf-{v}.apk"
data = urlopen(ovmf_url).read()
for arch, a_cfg in UEFI_FIRMWARE.items():
apk = a_cfg['apk']
bin = a_cfg['bin']
v = alpine.apk_version('community', arch, apk)
apk_url = f"{alpine.repo_url('community', arch)}/{apk}-{v}.apk"
data = urlopen(apk_url).read()
# Python tarfile library can't extract from APKs
tar_cmd = ['tar', '-zxf', '-', '-C', firm_dir, bin]
@ -241,6 +252,8 @@ console.setFormatter(logfmt)
log.addHandler(console)
log.debug(args)
# TODO: rollback requires --revise
# set up credential provider, if we're going to use it
if args.use_broker:
clouds.set_credential_provider(debug=args.debug)
@ -274,7 +287,7 @@ if not image_configs.refresh_state(
log.info('No pending actions to take at this time.')
sys.exit(0)
if args.step == 'state':
if args.step == 'state' or args.step == 'rollback':
sys.exit(0)
# install firmware if missing

View File

@ -370,10 +370,13 @@ class AWSCloudAdapter(CloudAdapterInterface):
# set up AMI deprecation
ec2c = image.meta.client
log.info('%s: Setting EOL deprecation time on %s', r, image.id)
ec2c.enable_image_deprecation(
ImageId=image.id,
DeprecateAt=f"{tags.end_of_life}T23:59:59Z"
)
try:
ec2c.enable_image_deprecation(
ImageId=image.id,
DeprecateAt=f"{tags.end_of_life}T23:59:59Z"
)
except Exception:
log.warning('Unable to set EOL Deprecation on %s image:', r, exc_info=True)
artifacts[r] = image.id

View File

@ -46,10 +46,10 @@ Default {
# profile build matrix
Dimensions {
version {
"3.16" { include required("version/3.16.conf") }
"3.15" { include required("version/3.15.conf") }
"3.14" { include required("version/3.14.conf") }
"3.13" { include required("version/3.13.conf") }
"3.12" { include required("version/3.12.conf") }
edge { include required("version/edge.conf") }
}
arch {

View File

@ -1,5 +1,6 @@
# vim: ts=2 et:
name = [aarch64]
arch_name = aarch64
# aarch64 is UEFI only
EXCLUDE = [bios]

View File

@ -1,5 +1,6 @@
# vim: ts=2 et:
name = [x86_64]
arch_name = x86_64
# TODO: until we have a image metadata service, let's avoid UEFI
EXCLUDE = [uefi]

View File

@ -1,5 +1,7 @@
# vim: ts=2 et:
name = [cloudinit]
name = [cloudinit]
bootstrap_name = cloud-init
bootstrap_url = "https://cloud-init.io/"
# start cloudinit images with 3.15
EXCLUDE = ["3.12", "3.13", "3.14"]

View File

@ -1,5 +1,7 @@
# vim: ts=2 et:
name = [tiny]
name = [tiny]
bootstrap_name = Tiny Cloud
bootstrap_url = "https://gitlab.alpinelinux.org/alpine/cloud/tiny-cloud"
services {
sysinit.tiny-cloud-early = true

View File

@ -1,6 +1,9 @@
# vim: ts=2 et:
builder = qemu
cloud_name = Amazon Web Services
cloud_image_url = "https://{region}.console.aws.amazon.com/ec2/home#Images:visibility=public-images;imageId={image_id}",
cloud_launch_url = "https://{region}.console.aws.amazon.com/ec2/home#launchAmi={image_id}"
builder = qemu
ntp_server = 169.254.169.123
kernel_modules {

View File

@ -1,5 +1,6 @@
# vim: ts=2 et:
name = [bios]
name = [bios]
firmware_name = BIOS
bootloader = extlinux
packages.syslinux = --no-scripts

View File

@ -1,5 +1,6 @@
# vim: ts=2 et:
name = [uefi]
name = [uefi]
firmware_name = UEFI
bootloader = grub-efi
packages {

View File

@ -1,3 +1,5 @@
# vim: ts=2 et:
include required("base/1.conf")
include required("base/1.conf")
# NOTE: EOL 2022-05-01

View File

@ -0,0 +1,7 @@
# vim: ts=2 et:
include required("base/4.conf")
motd {
sudo_removed = "NOTE: 'sudo' is no longer installed by default, please use 'doas' instead."
}

View File

@ -206,6 +206,12 @@ class ImageConfig():
def image_description(self):
return self.description.format(**self.__dict__)
def image_url(self, region, image_id):
return self.cloud_image_url.format(region=region, image_id=image_id, **self.__dict__)
def launch_url(self, region, image_id):
return self.cloud_launch_url.format(region=region, image_id=image_id, **self.__dict__)
@property
def tags(self):
# stuff that really ought to be there