Fix 'revision' and 'end_of_life' (#80)

Also...
* update alpine.conf with 3.12
* update apk-tools and alpine-keys
* use test profile to test fixes and newer features
This commit is contained in:
tomalok 2020-08-17 11:11:50 -07:00 committed by GitHub
parent 2b76c6ebf6
commit 10058c1113
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
8 changed files with 53 additions and 28 deletions

View File

@ -117,6 +117,3 @@ temporary build-related artifacts.
* New Alpine Linux *versions* are currently not auto-detected and added as a
core version profile; this process is, at the moment, still a manual task.
* Although it's possible to build "aarch64" (arm64) AMIs, they don't quite work
yet.

View File

@ -1,6 +1,7 @@
### Profile for Building the Publically-Available Alpine Linux AMIs
# vim: ts=2 et:
version-3_12 { include required("version/3.12") }
version-3_11 { include required("version/3.11") }
version-3_10 { include required("version/3.10") }
version-3_9 { include required("version/3.9") }
@ -15,15 +16,13 @@ alpine {
# Build definitions
BUILDS {
# merge version, arch, and profile vars
# merge version, arch, profile; add { revision = "r1" } if needed
v3_12-x86_64 = ${version-3_12} ${arch-x86_64} ${alpine}
v3_11-x86_64 = ${version-3_11} ${arch-x86_64} ${alpine}
v3_10-x86_64 = ${version-3_10} ${arch-x86_64} ${alpine}
v3_9-x86_64 = ${version-3_9} ${arch-x86_64} ${alpine}
edge-x86_64 = ${version-edge} ${arch-x86_64} ${alpine} {
revision = "@NOW@"
}
edge-x86_64 = ${version-edge} ${arch-x86_64} ${alpine}
edge-aarch64 = ${version-edge} ${arch-aarch64} ${alpine} {
revision = "@NOW@"
}
v3_12-aarch64 = ${version-3_12} ${arch-aarch64} ${alpine}
edge-aarch64 = ${version-edge} ${arch-aarch64} ${alpine}
}

View File

@ -6,5 +6,5 @@ build_arch = "arm64"
build_instance_type = "a1.medium"
apk_tools = "https://github.com/alpinelinux/apk-tools/releases/download/v2.10.3/apk-tools-2.10.3-aarch64-linux.tar.gz"
apk_tools_sha256 = "58a07e547c83c3a30eb0a0bd73db57d6bbaf92cc093df7a1d9805631f7d349e3"
alpine_keys = "http://dl-cdn.alpinelinux.org/alpine/v3.9/main/aarch64/alpine-keys-2.1-r1.apk"
alpine_keys_sha256 = "1ae4cebb43adee47a68aa891660e69a1ac6467690daca6f211aabff36a17cad1"
alpine_keys = "http://dl-cdn.alpinelinux.org/alpine/v3.12/main/aarch64/alpine-keys-2.2-r0.apk"
alpine_keys_sha256 = "94f287d541a03017d37895e46dc43bb62ce2e66ee99bb96b8c3de5c6638d5953"

View File

@ -3,7 +3,7 @@
arch = "x86_64"
build_arch = "x86_64"
apk_tools = "https://github.com/alpinelinux/apk-tools/releases/download/v2.10.3/apk-tools-2.10.3-x86_64-linux.tar.gz"
apk_tools_sha256 = "4d0b2cda606720624589e6171c374ec6d138867e03576d9f518dddde85c33839"
alpine_keys = "http://dl-cdn.alpinelinux.org/alpine/v3.9/main/x86_64/alpine-keys-2.1-r1.apk"
alpine_keys_sha256 = "9c7bc5d2e24c36982da7aa49b3cfcb8d13b20f7a03720f25625fa821225f5fbc"
apk_tools = "https://github.com/alpinelinux/apk-tools/releases/download/v2.10.4/apk-tools-2.10.4-x86_64-linux.tar.gz"
apk_tools_sha256 = "efe948160317fe78058e207554d0d9195a3dfcc35f77df278d30448d7b3eb892"
alpine_keys = "http://dl-cdn.alpinelinux.org/alpine/v3.12/main/x86_64/alpine-keys-2.2-r0.apk"
alpine_keys_sha256 = "d75cfd3eb6c863779f4eccb55ab5b6c5a8e47e4538c717fae580d3c47c70574a"

View File

@ -14,17 +14,22 @@ test {
ami_name_prefix = "test-"
ami_desc_prefix = "Alpine Test "
ami_user = "test"
setup_script = scripts/test-setup_script.sh
setup_copy {
base = profiles/base
aarch64 = profiles/arch/aarch64
}
}
# Build definitions
BUILDS {
# merge version, arch, profile, and build vars
v3_12-x86_64 = ${version-3_12} ${arch-x86_64} ${test} { revision = "r0" }
v3_11-x86_64 = ${version-3_11} ${arch-x86_64} ${test} { revision = "r0" }
v3_10-x86_64 = ${version-3_10} ${arch-x86_64} ${test} { revision = "r0" }
v3_9-x86_64 = ${version-3_9} ${arch-x86_64} ${test} { revision = "r0" }
v3_12-x86_64 = ${version-3_12} ${arch-x86_64} ${test}
v3_11-x86_64 = ${version-3_11} ${arch-x86_64} ${test} { revision = "r1" }
v3_10-x86_64 = ${version-3_10} ${arch-x86_64} ${test} { revision = "r2" }
v3_9-x86_64 = ${version-3_9} ${arch-x86_64} ${test} { revision = "r3" }
edge-x86_64 = ${version-edge} ${arch-x86_64} ${test}
v3_12-aarch64 = ${version-3_12} ${arch-aarch64} ${test} { revision = "r0" }
v3_12-aarch64 = ${version-3_12} ${arch-aarch64} ${test}
edge-aarch64 = ${version-edge} ${arch-aarch64} ${test}
}

View File

@ -7,8 +7,8 @@ include required("../base/current")
# add edge-specific tweaks...
version = "edge"
release = "edge"
end_of_life = "@TOMORROW@"
revision = "@NOW@"
end_of_life = null # defaults to tomorrow
revision = null # defaults to datetime
repos {
"http://dl-cdn.alpinelinux.org/alpine/edge/main" = true

View File

@ -459,12 +459,24 @@ class ConfigBuilder:
return datetime.fromisoformat(input).isoformat(timespec="seconds")
@classmethod
def resolve_tomorrow(cls, input):
def resolve_now(cls):
return cls.now.strftime("%Y%m%d%H%M%S")
@classmethod
def resolve_revision(cls, input):
if input is None or input == "":
return cls.resolve_now()
return input
@classmethod
def resolve_tomorrow(cls):
return cls.tomorrow.isoformat(timespec="seconds")
@classmethod
def resolve_now(cls, input):
return cls.now.strftime("%Y%m%d%H%M%S")
def resolve_end_of_life(cls, input):
if input is None or input == "":
return cls.resolve_tomorrow()
return input
@classmethod
def fold_comma(cls, input):
@ -503,9 +515,9 @@ class ConfigBuilder:
"repos" : self.fold_repos,
"pkgs" : self.fold_packages,
"svcs" : self.fold_services,
"revision" : self.resolve_now,
"revision" : self.resolve_revision,
"end_of_life" : lambda x: \
self.force_iso_date(self.resolve_tomorrow(x)),
self.force_iso_date(self.resolve_end_of_life(x)),
}
def build_all(self):

12
scripts/test-setup_script.sh Executable file
View File

@ -0,0 +1,12 @@
#!/usr/bin/env sh
set -ex
# copy a directory into place
cp -a ./base "$TARGET/home/$EC2_USER/test"
# process a file and put it into place
tac ./aarch64 | rev > "$TARGET/home/$EC2_USER/test/46hcraa"
# set ownership of installed things
chroot "$TARGET" chown -R "$EC2_USER:$EC2_USER" "/home/$EC2_USER/test"