diff options
author | Jake Buchholz <tomalok@gmail.com> | 2020-08-15 13:36:02 -0700 |
---|---|---|
committer | Jake Buchholz <tomalok@gmail.com> | 2020-08-15 13:36:02 -0700 |
commit | 998ded7f2c922d14d3209df5042980b7e2ebe680 (patch) | |
tree | ccd1ae4ad83f808558635753b9633d9a195bda3d | |
parent | 2b76c6ebf655e14a8d7ce774137df3c13d6c232a (diff) | |
download | alpine-ec2-ami-998ded7f2c922d14d3209df5042980b7e2ebe680.tar.bz2 alpine-ec2-ami-998ded7f2c922d14d3209df5042980b7e2ebe680.tar.xz alpine-ec2-ami-998ded7f2c922d14d3209df5042980b7e2ebe680.zip |
Fix 'revision' and 'end_of_life'
Also...
* update alpine.conf with 3.12
* update apk-tools and alpine-keys
* use test profile to test fixes and newer features
-rw-r--r-- | README.md | 3 | ||||
-rw-r--r-- | profiles/alpine.conf | 13 | ||||
-rw-r--r-- | profiles/arch/aarch64-1 | 4 | ||||
-rw-r--r-- | profiles/arch/x86_64-1 | 8 | ||||
-rw-r--r-- | profiles/test.conf | 15 | ||||
-rw-r--r-- | profiles/version/edge | 4 | ||||
-rwxr-xr-x | scripts/builder.py | 22 | ||||
-rwxr-xr-x | scripts/test-setup_script.sh | 12 |
8 files changed, 53 insertions, 28 deletions
@@ -117,6 +117,3 @@ temporary build-related artifacts. | |||
117 | 117 | ||
118 | * New Alpine Linux *versions* are currently not auto-detected and added as a | 118 | * New Alpine Linux *versions* are currently not auto-detected and added as a |
119 | core version profile; this process is, at the moment, still a manual task. | 119 | core version profile; this process is, at the moment, still a manual task. |
120 | |||
121 | * Although it's possible to build "aarch64" (arm64) AMIs, they don't quite work | ||
122 | yet. | ||
diff --git a/profiles/alpine.conf b/profiles/alpine.conf index fbb086d..0c55058 100644 --- a/profiles/alpine.conf +++ b/profiles/alpine.conf | |||
@@ -1,6 +1,7 @@ | |||
1 | ### Profile for Building the Publically-Available Alpine Linux AMIs | 1 | ### Profile for Building the Publically-Available Alpine Linux AMIs |
2 | # vim: ts=2 et: | 2 | # vim: ts=2 et: |
3 | 3 | ||
4 | version-3_12 { include required("version/3.12") } | ||
4 | version-3_11 { include required("version/3.11") } | 5 | version-3_11 { include required("version/3.11") } |
5 | version-3_10 { include required("version/3.10") } | 6 | version-3_10 { include required("version/3.10") } |
6 | version-3_9 { include required("version/3.9") } | 7 | version-3_9 { include required("version/3.9") } |
@@ -15,15 +16,13 @@ alpine { | |||
15 | 16 | ||
16 | # Build definitions | 17 | # Build definitions |
17 | BUILDS { | 18 | BUILDS { |
18 | # merge version, arch, and profile vars | 19 | # merge version, arch, profile; add { revision = "r1" } if needed |
20 | v3_12-x86_64 = ${version-3_12} ${arch-x86_64} ${alpine} | ||
19 | v3_11-x86_64 = ${version-3_11} ${arch-x86_64} ${alpine} | 21 | v3_11-x86_64 = ${version-3_11} ${arch-x86_64} ${alpine} |
20 | v3_10-x86_64 = ${version-3_10} ${arch-x86_64} ${alpine} | 22 | v3_10-x86_64 = ${version-3_10} ${arch-x86_64} ${alpine} |
21 | v3_9-x86_64 = ${version-3_9} ${arch-x86_64} ${alpine} | 23 | v3_9-x86_64 = ${version-3_9} ${arch-x86_64} ${alpine} |
22 | edge-x86_64 = ${version-edge} ${arch-x86_64} ${alpine} { | 24 | edge-x86_64 = ${version-edge} ${arch-x86_64} ${alpine} |
23 | revision = "@NOW@" | ||
24 | } | ||
25 | 25 | ||
26 | edge-aarch64 = ${version-edge} ${arch-aarch64} ${alpine} { | 26 | v3_12-aarch64 = ${version-3_12} ${arch-aarch64} ${alpine} |
27 | revision = "@NOW@" | 27 | edge-aarch64 = ${version-edge} ${arch-aarch64} ${alpine} |
28 | } | ||
29 | } | 28 | } |
diff --git a/profiles/arch/aarch64-1 b/profiles/arch/aarch64-1 index 37564e5..f40af5a 100644 --- a/profiles/arch/aarch64-1 +++ b/profiles/arch/aarch64-1 | |||
@@ -6,5 +6,5 @@ build_arch = "arm64" | |||
6 | build_instance_type = "a1.medium" | 6 | build_instance_type = "a1.medium" |
7 | apk_tools = "https://github.com/alpinelinux/apk-tools/releases/download/v2.10.3/apk-tools-2.10.3-aarch64-linux.tar.gz" | 7 | apk_tools = "https://github.com/alpinelinux/apk-tools/releases/download/v2.10.3/apk-tools-2.10.3-aarch64-linux.tar.gz" |
8 | apk_tools_sha256 = "58a07e547c83c3a30eb0a0bd73db57d6bbaf92cc093df7a1d9805631f7d349e3" | 8 | apk_tools_sha256 = "58a07e547c83c3a30eb0a0bd73db57d6bbaf92cc093df7a1d9805631f7d349e3" |
9 | alpine_keys = "http://dl-cdn.alpinelinux.org/alpine/v3.9/main/aarch64/alpine-keys-2.1-r1.apk" | 9 | alpine_keys = "http://dl-cdn.alpinelinux.org/alpine/v3.12/main/aarch64/alpine-keys-2.2-r0.apk" |
10 | alpine_keys_sha256 = "1ae4cebb43adee47a68aa891660e69a1ac6467690daca6f211aabff36a17cad1" | 10 | alpine_keys_sha256 = "94f287d541a03017d37895e46dc43bb62ce2e66ee99bb96b8c3de5c6638d5953" |
diff --git a/profiles/arch/x86_64-1 b/profiles/arch/x86_64-1 index 40b60dc..ce30a7b 100644 --- a/profiles/arch/x86_64-1 +++ b/profiles/arch/x86_64-1 | |||
@@ -3,7 +3,7 @@ | |||
3 | 3 | ||
4 | arch = "x86_64" | 4 | arch = "x86_64" |
5 | build_arch = "x86_64" | 5 | build_arch = "x86_64" |
6 | apk_tools = "https://github.com/alpinelinux/apk-tools/releases/download/v2.10.3/apk-tools-2.10.3-x86_64-linux.tar.gz" | 6 | apk_tools = "https://github.com/alpinelinux/apk-tools/releases/download/v2.10.4/apk-tools-2.10.4-x86_64-linux.tar.gz" |
7 | apk_tools_sha256 = "4d0b2cda606720624589e6171c374ec6d138867e03576d9f518dddde85c33839" | 7 | apk_tools_sha256 = "efe948160317fe78058e207554d0d9195a3dfcc35f77df278d30448d7b3eb892" |
8 | alpine_keys = "http://dl-cdn.alpinelinux.org/alpine/v3.9/main/x86_64/alpine-keys-2.1-r1.apk" | 8 | alpine_keys = "http://dl-cdn.alpinelinux.org/alpine/v3.12/main/x86_64/alpine-keys-2.2-r0.apk" |
9 | alpine_keys_sha256 = "9c7bc5d2e24c36982da7aa49b3cfcb8d13b20f7a03720f25625fa821225f5fbc" | 9 | alpine_keys_sha256 = "d75cfd3eb6c863779f4eccb55ab5b6c5a8e47e4538c717fae580d3c47c70574a" |
diff --git a/profiles/test.conf b/profiles/test.conf index 74019b1..dc86fd0 100644 --- a/profiles/test.conf +++ b/profiles/test.conf | |||
@@ -14,17 +14,22 @@ test { | |||
14 | ami_name_prefix = "test-" | 14 | ami_name_prefix = "test-" |
15 | ami_desc_prefix = "Alpine Test " | 15 | ami_desc_prefix = "Alpine Test " |
16 | ami_user = "test" | 16 | ami_user = "test" |
17 | setup_script = scripts/test-setup_script.sh | ||
18 | setup_copy { | ||
19 | base = profiles/base | ||
20 | aarch64 = profiles/arch/aarch64 | ||
21 | } | ||
17 | } | 22 | } |
18 | 23 | ||
19 | # Build definitions | 24 | # Build definitions |
20 | BUILDS { | 25 | BUILDS { |
21 | # merge version, arch, profile, and build vars | 26 | # merge version, arch, profile, and build vars |
22 | v3_12-x86_64 = ${version-3_12} ${arch-x86_64} ${test} { revision = "r0" } | 27 | v3_12-x86_64 = ${version-3_12} ${arch-x86_64} ${test} |
23 | v3_11-x86_64 = ${version-3_11} ${arch-x86_64} ${test} { revision = "r0" } | 28 | v3_11-x86_64 = ${version-3_11} ${arch-x86_64} ${test} { revision = "r1" } |
24 | v3_10-x86_64 = ${version-3_10} ${arch-x86_64} ${test} { revision = "r0" } | 29 | v3_10-x86_64 = ${version-3_10} ${arch-x86_64} ${test} { revision = "r2" } |
25 | v3_9-x86_64 = ${version-3_9} ${arch-x86_64} ${test} { revision = "r0" } | 30 | v3_9-x86_64 = ${version-3_9} ${arch-x86_64} ${test} { revision = "r3" } |
26 | edge-x86_64 = ${version-edge} ${arch-x86_64} ${test} | 31 | edge-x86_64 = ${version-edge} ${arch-x86_64} ${test} |
27 | 32 | ||
28 | v3_12-aarch64 = ${version-3_12} ${arch-aarch64} ${test} { revision = "r0" } | 33 | v3_12-aarch64 = ${version-3_12} ${arch-aarch64} ${test} |
29 | edge-aarch64 = ${version-edge} ${arch-aarch64} ${test} | 34 | edge-aarch64 = ${version-edge} ${arch-aarch64} ${test} |
30 | } | 35 | } |
diff --git a/profiles/version/edge b/profiles/version/edge index 07c583d..1bde7b5 100644 --- a/profiles/version/edge +++ b/profiles/version/edge | |||
@@ -7,8 +7,8 @@ include required("../base/current") | |||
7 | # add edge-specific tweaks... | 7 | # add edge-specific tweaks... |
8 | version = "edge" | 8 | version = "edge" |
9 | release = "edge" | 9 | release = "edge" |
10 | end_of_life = "@TOMORROW@" | 10 | end_of_life = null # defaults to tomorrow |
11 | revision = "@NOW@" | 11 | revision = null # defaults to datetime |
12 | 12 | ||
13 | repos { | 13 | repos { |
14 | "http://dl-cdn.alpinelinux.org/alpine/edge/main" = true | 14 | "http://dl-cdn.alpinelinux.org/alpine/edge/main" = true |
diff --git a/scripts/builder.py b/scripts/builder.py index 21df3fe..3f1d8f7 100755 --- a/scripts/builder.py +++ b/scripts/builder.py | |||
@@ -459,12 +459,24 @@ class ConfigBuilder: | |||
459 | return datetime.fromisoformat(input).isoformat(timespec="seconds") | 459 | return datetime.fromisoformat(input).isoformat(timespec="seconds") |
460 | 460 | ||
461 | @classmethod | 461 | @classmethod |
462 | def resolve_tomorrow(cls, input): | 462 | def resolve_now(cls): |
463 | return cls.now.strftime("%Y%m%d%H%M%S") | ||
464 | |||
465 | @classmethod | ||
466 | def resolve_revision(cls, input): | ||
467 | if input is None or input == "": | ||
468 | return cls.resolve_now() | ||
469 | return input | ||
470 | |||
471 | @classmethod | ||
472 | def resolve_tomorrow(cls): | ||
463 | return cls.tomorrow.isoformat(timespec="seconds") | 473 | return cls.tomorrow.isoformat(timespec="seconds") |
464 | 474 | ||
465 | @classmethod | 475 | @classmethod |
466 | def resolve_now(cls, input): | 476 | def resolve_end_of_life(cls, input): |
467 | return cls.now.strftime("%Y%m%d%H%M%S") | 477 | if input is None or input == "": |
478 | return cls.resolve_tomorrow() | ||
479 | return input | ||
468 | 480 | ||
469 | @classmethod | 481 | @classmethod |
470 | def fold_comma(cls, input): | 482 | def fold_comma(cls, input): |
@@ -503,9 +515,9 @@ class ConfigBuilder: | |||
503 | "repos" : self.fold_repos, | 515 | "repos" : self.fold_repos, |
504 | "pkgs" : self.fold_packages, | 516 | "pkgs" : self.fold_packages, |
505 | "svcs" : self.fold_services, | 517 | "svcs" : self.fold_services, |
506 | "revision" : self.resolve_now, | 518 | "revision" : self.resolve_revision, |
507 | "end_of_life" : lambda x: \ | 519 | "end_of_life" : lambda x: \ |
508 | self.force_iso_date(self.resolve_tomorrow(x)), | 520 | self.force_iso_date(self.resolve_end_of_life(x)), |
509 | } | 521 | } |
510 | 522 | ||
511 | def build_all(self): | 523 | def build_all(self): |
diff --git a/scripts/test-setup_script.sh b/scripts/test-setup_script.sh new file mode 100755 index 0000000..18e3fdb --- /dev/null +++ b/scripts/test-setup_script.sh | |||
@@ -0,0 +1,12 @@ | |||
1 | #!/usr/bin/env sh | ||
2 | |||
3 | set -ex | ||
4 | |||
5 | # copy a directory into place | ||
6 | cp -a ./base "$TARGET/home/$EC2_USER/test" | ||
7 | |||
8 | # process a file and put it into place | ||
9 | tac ./aarch64 | rev > "$TARGET/home/$EC2_USER/test/46hcraa" | ||
10 | |||
11 | # set ownership of installed things | ||
12 | chroot "$TARGET" chown -R "$EC2_USER:$EC2_USER" "/home/$EC2_USER/test" | ||