aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJake Buchholz <tomalok@gmail.com>2019-04-22 18:33:53 -0700
committerJake Buchholz <tomalok@gmail.com>2019-04-22 18:33:53 -0700
commit7cca8269b28f2b88de06614933b6f0b0aaa154a7 (patch)
treede7cad6f748ba1a800bab94de48c78b6309c9e16
parent0d63605eabc3dc1016f1693589845f478657103c (diff)
downloadalpine-ec2-ami-7cca8269b28f2b88de06614933b6f0b0aaa154a7.tar.bz2
alpine-ec2-ami-7cca8269b28f2b88de06614933b6f0b0aaa154a7.tar.xz
alpine-ec2-ami-7cca8269b28f2b88de06614933b6f0b0aaa154a7.zip
switch profile configs to HOCON
-rw-r--r--Makefile13
-rw-r--r--profiles/alpine-amis.conf36
-rw-r--r--profiles/alpine-amis.yaml48
l---------profiles/arch/aarch641
-rw-r--r--profiles/arch/aarch64-16
-rw-r--r--profiles/arch/aarch64-3.9.yaml13
-rw-r--r--profiles/arch/aarch64-current.yaml12
-rw-r--r--profiles/arch/aarch64-edge.yaml18
l---------profiles/arch/x86_641
-rw-r--r--profiles/arch/x86_64-15
-rw-r--r--profiles/arch/x86_64-3.9.yaml13
-rw-r--r--profiles/arch/x86_64-current.yaml13
-rw-r--r--profiles/arch/x86_64-edge.yaml18
-rw-r--r--profiles/base/178
-rw-r--r--profiles/base/1.yaml78
l---------profiles/base/current1
-rw-r--r--profiles/base/current.yaml13
-rw-r--r--profiles/base/edge.yaml18
-rw-r--r--profiles/test.conf28
-rw-r--r--profiles/test.yaml48
-rw-r--r--profiles/version/3.913
-rw-r--r--profiles/version/3.9.yaml15
l---------profiles/version/current1
-rw-r--r--profiles/version/current.yaml13
-rw-r--r--profiles/version/edge16
-rw-r--r--profiles/version/edge.yaml23
-rw-r--r--scripts/resolve-profile.py.in33
27 files changed, 216 insertions, 359 deletions
diff --git a/Makefile b/Makefile
index acfb9f2..82dd6ab 100644
--- a/Makefile
+++ b/Makefile
@@ -1,21 +1,22 @@
1ALL_SCRIPTS := $(wildcard scripts/*) 1ALL_SCRIPTS := $(wildcard scripts/*)
2ALL_PROFILES := $(shell find profiles -name '*.yaml' -type f) 2CORE_PROFILES := $(wildcard profiles/*/*)
3CORE_PROFILES := $(shell for i in base version arch; do ls profiles/$$i/*.yaml | sort -V; done) 3TARGET_PROFILES := $(wildcard profiles/*.conf)
4PROFILE := default 4PROFILE := default
5BUILD := 5BUILD :=
6 6
7.PHONY: amis 7.PHONY: amis clean
8
8amis: build build/profile build/packer.json 9amis: build build/profile build/packer.json
9 build/make-amis $(BUILD) 10 build/make-amis $(BUILD)
10 11
11build: $(SCRIPTS) 12build: $(SCRIPTS)
12 [ -d build ] || mkdir build 13 [ -d build ] || mkdir build
13 python3 -m venv build/.py3 14 python3 -m venv build/.py3
14 build/.py3/bin/pip install pyyaml boto3 15 build/.py3/bin/pip install pyhocon pyyaml boto3
15 (cd build; for i in $(ALL_SCRIPTS); do ln -sf ../$$i .; done) 16 (cd build; for i in $(ALL_SCRIPTS); do ln -sf ../$$i .; done)
16 17
17build/profile: build build/resolve-profile.py $(ALL_PROFILES) 18build/profile: build build/resolve-profile.py $(CORE_PROFILES) $(TARGET_PROFILES)
18 cat $(CORE_PROFILES) profiles/$(PROFILE).yaml | build/resolve-profile.py $(PROFILE) 19 build/resolve-profile.py $(PROFILE)
19 20
20build/packer.json: build build/yaml2json.py packer.yaml 21build/packer.json: build build/yaml2json.py packer.yaml
21 build/yaml2json.py packer.yaml > build/packer.json 22 build/yaml2json.py packer.yaml > build/packer.json
diff --git a/profiles/alpine-amis.conf b/profiles/alpine-amis.conf
new file mode 100644
index 0000000..6ece5d4
--- /dev/null
+++ b/profiles/alpine-amis.conf
@@ -0,0 +1,36 @@
1### Profile for Building the Publically-Available Alpine Linux AMIs
2
3version_current { include "version/current" }
4arch_x86_64 { include "arch/x86_64" }
5
6# profile vars
7alpine-amis {
8 revision = "1"
9 build_region = "us-west-2"
10 build_subnet = "subnet-b80c36e2"
11 ami_access = [ "all" ]
12 ami_regions = [
13 "ap-northeast-1"
14 "ap-northeast-2"
15# "ap-northeast-3" # skipped, available by subscription only
16 "ap-southeast-1"
17 "ap-southeast-2"
18 "ap-south-1"
19 "ca-central-1"
20 "eu-central-1"
21 "eu-north-1"
22 "eu-west-1"
23 "eu-west-2"
24 "eu-west-3"
25 "sa-east-1"
26 "us-east-1"
27 "us-east-2"
28 "us-west-1"
29 "us-west-2"
30 ]
31}
32
33# Build definitions
34builds {
35 current-x86_64 = ${version_current} ${arch_x86_64} ${alpine-amis}
36}
diff --git a/profiles/alpine-amis.yaml b/profiles/alpine-amis.yaml
deleted file mode 100644
index 119601f..0000000
--- a/profiles/alpine-amis.yaml
+++ /dev/null
@@ -1,48 +0,0 @@
1### Profile for Building the Publically-Available Alpine Linux AMIs
2
3# Profile overrides
4alpine-amis: &alpine-amis
5 revision: '1'
6 build_region: us-west-2
7 build_subnet: subnet-b80c36e2
8 ami_access:
9 - all
10 ami_regions:
11 - ap-northeast-1
12 - ap-northeast-2
13# - ap-northeast-3 # skipped, available by subscription only
14 - ap-southeast-1
15 - ap-southeast-2
16 - ap-south-1
17 - ca-central-1
18 - eu-central-1
19 - eu-north-1
20 - eu-west-1
21 - eu-west-2
22 - eu-west-3
23 - sa-east-1
24 - us-east-1
25 - us-east-2
26 - us-west-1
27 - us-west-2
28
29# Build definitions
30builds:
31 current-x86_64:
32 <<: *_base-current
33 <<: *_version-current
34 <<: *_x86_64-current
35 <<: *alpine-amis
36 repos:
37 <<: *_base-current-repos
38 <<: *_version-current-repos
39 <<: *_x86_64-current-repos
40 pkgs:
41 <<: *_base-current-pkgs
42 <<: *_version-current-pkgs
43 <<: *_x86_64-current-pkgs
44 svcs:
45 <<: *_base-current-svcs
46 <<: *_version-current-svcs
47 <<: *_x86_64-current-svcs
48
diff --git a/profiles/arch/aarch64 b/profiles/arch/aarch64
new file mode 120000
index 0000000..f1b77e5
--- /dev/null
+++ b/profiles/arch/aarch64
@@ -0,0 +1 @@
aarch64-1 \ No newline at end of file
diff --git a/profiles/arch/aarch64-1 b/profiles/arch/aarch64-1
new file mode 100644
index 0000000..083a744
--- /dev/null
+++ b/profiles/arch/aarch64-1
@@ -0,0 +1,6 @@
1### aarch64 vars, revision 1
2
3arch = "aarch64"
4build_arch = "arm64"
5build_instance_type = "a1.medium"
6bootloader = "grub"
diff --git a/profiles/arch/aarch64-3.9.yaml b/profiles/arch/aarch64-3.9.yaml
deleted file mode 100644
index c7ec980..0000000
--- a/profiles/arch/aarch64-3.9.yaml
+++ /dev/null
@@ -1,13 +0,0 @@
1### aarch64 Version 3.9 Variables
2
3_aarch64-3.9: &_aarch64-3_9
4 # Architecture
5 arch: aarch64
6 build_arch: arm64
7 build_instance_type: a1.medium
8 bootloader: grub
9
10 # aarch64 repos/pkgs/svcs for 3.9
11 repos: &_aarch64-3_9-repos {}
12 pkgs: &_aarch64-3_9-pkgs {}
13 svcs: &_aarch64-3_9-svcs {}
diff --git a/profiles/arch/aarch64-current.yaml b/profiles/arch/aarch64-current.yaml
deleted file mode 100644
index 1b4e624..0000000
--- a/profiles/arch/aarch64-current.yaml
+++ /dev/null
@@ -1,12 +0,0 @@
1### aarch64 Current Version Variables
2
3_aarch64-current: &_aarch64-current
4 # currently from 3.9
5 <<: *_aarch64-3_9
6 # re-anchor for current
7 repos: &_aarch64-current-repos
8 <<: *_aarch64-3_9-repos
9 pkgs: &_aarch64-current-pkgs
10 <<: *_aarch64-3_9-pkgs
11 svcs: &_aarch64-current-svcs
12 <<: *_aarch64-3_9-svcs
diff --git a/profiles/arch/aarch64-edge.yaml b/profiles/arch/aarch64-edge.yaml
deleted file mode 100644
index 97d76e2..0000000
--- a/profiles/arch/aarch64-edge.yaml
+++ /dev/null
@@ -1,18 +0,0 @@
1### aarch64 Edge Variables
2
3_aarch64-edge: &_aarch64-edge
4 # base on current (for now)
5 <<: *_aarch64-current
6 # overrides (if any)
7
8 # aarch64 repos/pkgs/svcs for edge
9 repos: &_aarch64-edge-repos
10 <<: *_aarch64-current-repos
11 # overrides (if any)
12 pkgs: &_aarch64-edge-pkgs
13 <<: *_aarch64-current-pkgs
14 # overrides (if any)
15 svcs: &_aarch64-edge-svcs
16 <<: *_aarch64-current-svcs
17 # overrides (if any)
18
diff --git a/profiles/arch/x86_64 b/profiles/arch/x86_64
new file mode 120000
index 0000000..f3c4f51
--- /dev/null
+++ b/profiles/arch/x86_64
@@ -0,0 +1 @@
x86_64-1 \ No newline at end of file
diff --git a/profiles/arch/x86_64-1 b/profiles/arch/x86_64-1
new file mode 100644
index 0000000..ca4bcb9
--- /dev/null
+++ b/profiles/arch/x86_64-1
@@ -0,0 +1,5 @@
1### x86_64 vars, revision 1
2
3arch = "x86_64"
4build_arch = "x86_64"
5bootloader = "syslinux"
diff --git a/profiles/arch/x86_64-3.9.yaml b/profiles/arch/x86_64-3.9.yaml
deleted file mode 100644
index 79b8908..0000000
--- a/profiles/arch/x86_64-3.9.yaml
+++ /dev/null
@@ -1,13 +0,0 @@
1### x86_64 Version 3.9 Variables
2
3_x86_64-3.9: &_x86_64-3_9
4 # Architecture
5 arch: x86_64
6 build_arch: x86_64
7 bootloader: syslinux
8
9 # x86_64 repos/pkgs/svcs for 3.9
10 repos: &_x86_64-3_9-repos {}
11 pkgs: &_x86_64-3_9-pkgs {}
12 svcs: &_x86_64-3_9-svcs {}
13
diff --git a/profiles/arch/x86_64-current.yaml b/profiles/arch/x86_64-current.yaml
deleted file mode 100644
index 6dc5555..0000000
--- a/profiles/arch/x86_64-current.yaml
+++ /dev/null
@@ -1,13 +0,0 @@
1### x86_64 Current Version Variables
2
3_x86_64-current: &_x86_64-current
4 # Current is 3.9
5 <<: *_x86_64-3_9
6 # re-anchor for current
7 repos: &_x86_64-current-repos
8 <<: *_x86_64-3_9-repos
9 pkgs: &_x86_64-current-pkgs
10 <<: *_x86_64-3_9-pkgs
11 svcs: &_x86_64-current-svcs
12 <<: *_x86_64-3_9-svcs
13
diff --git a/profiles/arch/x86_64-edge.yaml b/profiles/arch/x86_64-edge.yaml
deleted file mode 100644
index 2e2f1d2..0000000
--- a/profiles/arch/x86_64-edge.yaml
+++ /dev/null
@@ -1,18 +0,0 @@
1### x86_64 Edge Variables
2
3_x86_64-edge: &_x86_64-edge
4 # base from current (at the moment)
5 <<: *_x86_64-current
6 # overrides (if any)
7
8 # x86_64 repos/pkgs/svcs for edge
9 repos: &_x86_64-edge-repos
10 <<: *_x86_64-current-repos
11 # overrides (if any)
12 pkgs: &_x86_64-edge-pkgs
13 <<: *_x86_64-current-pkgs
14 # overrides (if any)
15 svcs: &_x86_64-edge-svcs
16 <<: *_x86_64-current-pkgs
17 # overrides (if any)
18
diff --git a/profiles/base/1 b/profiles/base/1
new file mode 100644
index 0000000..8b88c2a
--- /dev/null
+++ b/profiles/base/1
@@ -0,0 +1,78 @@
1### base vars, revision 1
2
3# Profile/Build
4profile = null
5profile_build = null
6
7# Versioning
8version = null
9release = null
10end_of_life = null
11revision = null
12
13# Architecture
14arch = null
15build_arch = null
16
17# Builder-instance
18build_region = null
19build_subnet = null
20build_security_group = null
21build_instance_type = "t3.nano"
22build_public_ip = null # was ""
23build_user = "ec2-user"
24build_ami_name = "amzn2-ami-hvm-2.0.*-gp2"
25build_ami_owner = "137112412989"
26build_ami_latest = "true"
27
28# AMI build/deploy
29ami_name_prefix = "alpine-ami-"
30ami_name_suffix = ""
31ami_desc_prefix = "Alpine Linux "
32ami_desc_suffix = " - https://github.com/mcrute/alpine-ec2-ami"
33ami_volume_size = "1"
34ami_encrypt = "false"
35ami_user = "alpine"
36ami_access = null
37ami_regions = null
38
39# AMI configuration
40bootloader = null
41repos {}
42pkgs {
43 linux-virt = true
44 alpine-mirrors = true
45 chrony = true
46 haveged = true
47 nvme-cli = true
48 openssh = true
49 sudo = true
50 tiny-ec2-bootstrap = true
51 tzdata = true
52}
53svcs {
54 # sysinit
55 devfs = "sysinit"
56 dmesg = "sysinit"
57 hwdrivers = "sysinit"
58 mdev = "sysinit"
59 # boot
60 acpid = "boot"
61 bootmisc = "boot"
62 haveged = "boot"
63 hostname = "boot"
64 hwclock = "boot"
65 modules = "boot"
66 swap = "boot"
67 sysctl = "boot"
68 syslog = "boot"
69 # default
70 chronyd = "default"
71 networking = "default"
72 sshd = "default"
73 tiny-ec2-bootstrap = "default"
74 # shutdown
75 killprocs = "shutdown"
76 mount-ro = "shutdown"
77 savecache = "shutdown"
78}
diff --git a/profiles/base/1.yaml b/profiles/base/1.yaml
deleted file mode 100644
index 29c7354..0000000
--- a/profiles/base/1.yaml
+++ /dev/null
@@ -1,78 +0,0 @@
1### Base Variables, Revsion #1
2
3_base-1: &_base-1
4 # Profile/Build
5 profile:
6 profile_build:
7
8 # Versioning
9 version:
10 release:
11 end_of_life:
12 revision:
13
14 # Architecture
15 arch:
16 build_arch:
17
18 # Builder-instance
19 build_region:
20 build_subnet:
21 build_security_group:
22 build_instance_type: t3.nano
23 build_public_ip: ''
24 build_user: ec2-user
25 build_ami_name: amzn2-ami-hvm-2.0.*-gp2
26 build_ami_owner: '137112412989'
27 build_ami_latest: 'true'
28
29 # AMI build/deploy
30 ami_name_prefix: alpine-ami-
31 ami_name_suffix: ''
32 ami_desc_prefix: 'Alpine Linux '
33 ami_desc_suffix: ' - https://github.com/mcrute/alpine-ec2-ami'
34 ami_volume_size: '1'
35 ami_encrypt: 'false'
36 ami_user: alpine
37 ami_access:
38 ami_regions:
39
40 # AMI configuration
41 bootloader:
42 repos: &_base-1-repos {}
43 pkgs: &_base-1-pkgs
44 linux-virt:
45 alpine-mirrors:
46 chrony:
47 haveged:
48 nvme-cli:
49 openssh:
50 sudo:
51 tiny-ec2-bootstrap:
52 tzdata:
53 svcs: &_base-1-svcs
54 # sysinit
55 devfs: sysinit
56 dmesg: sysinit
57 hwdrivers: sysinit
58 mdev: sysinit
59 # boot
60 acpid: boot
61 bootmisc: boot
62 haveged: boot
63 hostname: boot
64 hwclock: boot
65 modules: boot
66 swap: boot
67 sysctl: boot
68 syslog: boot
69 # default
70 chronyd:
71 networking:
72 sshd:
73 tiny-ec2-bootstrap:
74 # shutdown
75 killprocs: shutdown
76 mount-ro: shutdown
77 savecache: shutdown
78
diff --git a/profiles/base/current b/profiles/base/current
new file mode 120000
index 0000000..56a6051
--- /dev/null
+++ b/profiles/base/current
@@ -0,0 +1 @@
1 \ No newline at end of file
diff --git a/profiles/base/current.yaml b/profiles/base/current.yaml
deleted file mode 100644
index 7f5e33d..0000000
--- a/profiles/base/current.yaml
+++ /dev/null
@@ -1,13 +0,0 @@
1### Current Revision Base Variables
2
3_base-current: &_base-current
4 # Current base revision
5 <<: *_base-1
6 # re-anchor for current
7 repos: &_base-current-repos
8 <<: *_base-1-repos
9 pkgs: &_base-current-pkgs
10 <<: *_base-1-pkgs
11 svcs: &_base-current-svcs
12 <<: *_base-1-svcs
13
diff --git a/profiles/base/edge.yaml b/profiles/base/edge.yaml
deleted file mode 100644
index efd3442..0000000
--- a/profiles/base/edge.yaml
+++ /dev/null
@@ -1,18 +0,0 @@
1### Edge Base Variables
2
3_base-edge: &_base-edge
4 # base from current (at the moment)
5 <<: *_base-current
6 # overrides (if any)
7
8 # base repos/pkgs/svcs for edge
9 repos: &_base-edge-repos
10 <<: *_base-current-repos
11 # overrides (if any)
12 pkgs: &_base-edge-pkgs
13 <<: *_base-current-pkgs
14 # overrides (if any)
15 svcs: &_base-edge-svcs
16 <<: *_base-current-svcs
17 # overrides (if any)
18
diff --git a/profiles/test.conf b/profiles/test.conf
new file mode 100644
index 0000000..3a44458
--- /dev/null
+++ b/profiles/test.conf
@@ -0,0 +1,28 @@
1### Profile for Testing Builds
2
3version_current { include "version/current" }
4version_edge { include "version/edge" }
5arch_x86_64 { include "arch/x86_64" }
6
7# specific to this profile's builds
8test {
9 build_region = "us-west-2"
10 build_subnet = "subnet-033a30d7b5220d177"
11 ami_regions = [
12 "us-east-1"
13 "us-west-2"
14 ]
15}
16
17# Build definitions
18builds {
19 # merge version, arch, and profile vars
20 test-current-x86_64 = ${version_current} ${arch_x86_64} ${test}
21 # build-specific override
22 test-current-x86_64 {
23 revision = "test"
24 }
25
26 # merge version, arch, and profile vars
27 test-edge-x86_64 = ${version_edge} ${arch_x86_64} ${test}
28}
diff --git a/profiles/test.yaml b/profiles/test.yaml
deleted file mode 100644
index bcb21e1..0000000
--- a/profiles/test.yaml
+++ /dev/null
@@ -1,48 +0,0 @@
1### Profile for Testing Builds
2
3# Profile overrides
4test: &test
5 build_region: us-west-2
6 build_subnet: subnet-033a30d7b5220d177
7 ami_regions:
8 - us-east-1
9 - us-west-2
10
11# Build definitions
12builds:
13 test-current-x86_64:
14 <<: *_base-current
15 <<: *_version-current
16 <<: *_x86_64-current
17 repos:
18 <<: *_base-current-repos
19 <<: *_version-current-repos
20 <<: *_x86_64-current-repos
21 pkgs:
22 <<: *_base-current-pkgs
23 <<: *_version-current-pkgs
24 <<: *_x86_64-current-pkgs
25 svcs:
26 <<: *_base-current-svcs
27 <<: *_version-current-svcs
28 <<: *_x86_64-current-svcs
29 <<: *test
30 revision: 'test'
31 test-edge-x86_64:
32 <<: *_base-edge
33 <<: *_version-edge
34 <<: *_x86_64-edge
35 repos:
36 <<: *_base-edge-repos
37 <<: *_version-edge-repos
38 <<: *_x86_64-edge-repos
39 pkgs:
40 <<: *_base-edge-pkgs
41 <<: *_version-edge-pkgs
42 <<: *_x86_64-edge-pkgs
43 svcs:
44 <<: *_base-edge-svcs
45 <<: *_version-edge-svcs
46 <<: *_x86_64-edge-svcs
47 <<: *test
48
diff --git a/profiles/version/3.9 b/profiles/version/3.9
new file mode 100644
index 0000000..7c98ba1
--- /dev/null
+++ b/profiles/version/3.9
@@ -0,0 +1,13 @@
1### version 3.9 vars
2
3# start with base vars
4include "../base/current"
5
6# set version-specific vars
7version = "3.9"
8release = "3.9.3"
9end_of_life = null # set to YYYY-MM-DD when known
10repos {
11 "http://dl-cdn.alpinelinux.org/alpine/v3.9/main": true
12 "http://dl-cdn.alpinelinux.org/alpine/v3.9/community": true
13}
diff --git a/profiles/version/3.9.yaml b/profiles/version/3.9.yaml
deleted file mode 100644
index 40c2307..0000000
--- a/profiles/version/3.9.yaml
+++ /dev/null
@@ -1,15 +0,0 @@
1### Version 3.9 Variables
2
3_version-3.9: &_version-3_9
4 # Versioning
5 version: '3.9'
6 release: '3.9.3'
7 #end_of_life: 'YYYY-MM-DD' # set when known
8
9 # version repos/pkgs/svcs for 3.9
10 repos: &_version-3_9-repos
11 "http://dl-cdn.alpinelinux.org/alpine/v3.9/main":
12 "http://dl-cdn.alpinelinux.org/alpine/v3.9/community":
13 pkgs: &_version-3_9-pkgs {}
14 svcs: &_version-3_9-svcs {}
15
diff --git a/profiles/version/current b/profiles/version/current
new file mode 120000
index 0000000..a02597f
--- /dev/null
+++ b/profiles/version/current
@@ -0,0 +1 @@
3.9 \ No newline at end of file
diff --git a/profiles/version/current.yaml b/profiles/version/current.yaml
deleted file mode 100644
index 855972c..0000000
--- a/profiles/version/current.yaml
+++ /dev/null
@@ -1,13 +0,0 @@
1### Current Version Variables
2
3_version-current: &_version-current
4 # from latest version
5 <<: *_version-3_9
6 # re-anchor for current
7 repos: &_version-current-repos
8 <<: *_version-3_9-repos
9 pkgs: &_version-current-pkgs
10 <<: *_version-3_9-pkgs
11 svcs: &_version-current-svcs
12 <<: *_version-3_9-svcs
13
diff --git a/profiles/version/edge b/profiles/version/edge
new file mode 100644
index 0000000..248d31c
--- /dev/null
+++ b/profiles/version/edge
@@ -0,0 +1,16 @@
1### edge vars
2
3# based on current
4include "current"
5
6# add edge-specific tweaks...
7version = edge
8release = edge
9end_of_life = "@TODAY@"
10revision = "@NOW@"
11repos = null
12repos {
13 "http://dl-cdn.alpinelinux.org/alpine/edge/main": true
14 "http://dl-cdn.alpinelinux.org/alpine/edge/community": true
15 "http://dl-cdn.alpinelinux.org/alpine/edge/testing": true
16}
diff --git a/profiles/version/edge.yaml b/profiles/version/edge.yaml
deleted file mode 100644
index 528d56c..0000000
--- a/profiles/version/edge.yaml
+++ /dev/null
@@ -1,23 +0,0 @@
1### Edge Version Variables
2
3_version-edge: &_version-edge
4 # from current version
5 <<: *_version-current
6 # overrides
7 version: edge
8 release: edge
9 end_of_life: '@TODAY@'
10 revision: '@NOW@'
11
12 # version repos/pkgs/svcs for edge
13 repos: &_version-edge-repos
14 http://dl-cdn.alpinelinux.org/alpine/edge/main:
15 http://dl-cdn.alpinelinux.org/alpine/edge/community:
16 http://dl-cdn.alpinelinux.org/alpine/edge/testing:
17 pkgs: &_version-edge-pkgs
18 <<: *_version-current-pkgs
19 # overrides (if any)
20 svcs: &_version-edge-svcs
21 <<: *_version-current-svcs
22 # overrides (if any)
23
diff --git a/scripts/resolve-profile.py.in b/scripts/resolve-profile.py.in
index 7312957..daae31f 100644
--- a/scripts/resolve-profile.py.in
+++ b/scripts/resolve-profile.py.in
@@ -1,19 +1,26 @@
1@PYTHON@ 1@PYTHON@
2 2
3import json, os, shutil, sys, time, yaml 3import json, os, shutil, sys, time
4from pyhocon import ConfigFactory
5
6script_dir = os.path.dirname(os.path.realpath(__file__))
4 7
5profile = sys.argv[1] 8profile = sys.argv[1]
6 9
10# path to the profile config file
11profile_conf = os.path.join(script_dir, '..', 'profiles', profile + '.conf')
12
7# where we store profile's builds 13# where we store profile's builds
8profile_dir = os.path.join( os.path.dirname(os.path.realpath(__file__)), 'profile') 14profile_dir = os.path.join(script_dir, 'profile')
9 15
16# TODO? make these dicts instead?
10# fold these list vars down to scalar 17# fold these list vars down to scalar
11fold_list_keys = [ 18fold_list_keys = [
12 'ami_access', 'ami_regions' 19 'ami_access', 'ami_regions'
13] 20]
14 21
15# parse stdin yaml and resolve refs 22# parse/resolve HOCON profile config, we need just the 'builds' portion
16builds = yaml.full_load(sys.stdin.read())['builds'] 23builds = ConfigFactory.parse_file(profile_conf)['builds']
17 24
18# clean out any old builds 25# clean out any old builds
19if os.path.exists(profile_dir): 26if os.path.exists(profile_dir):
@@ -46,9 +53,11 @@ for bk, b in builds.items():
46 # fold 'repos' hash to scalar 53 # fold 'repos' hash to scalar
47 repos = [] 54 repos = []
48 for repo, v in b['repos'].items(): 55 for repo, v in b['repos'].items():
49 if v == None: # repo without alias 56 if v == True:
57 # repo without alias
50 repos.append(repo) 58 repos.append(repo)
51 elif v != False: # repo with alias (False == skip repo) 59 elif not (v == False or v == None):
60 # repo with alias (skip repo when false/null)
52 v.lstrip('@') 61 v.lstrip('@')
53 repos.append(f"@{v} {repo}") 62 repos.append(f"@{v} {repo}")
54 b['repos'] = ','.join(str(x) for x in repos) 63 b['repos'] = ','.join(str(x) for x in repos)
@@ -56,9 +65,11 @@ for bk, b in builds.items():
56 # fold 'pkgs' hash to scalar 65 # fold 'pkgs' hash to scalar
57 pkgs = [] 66 pkgs = []
58 for pkg, v in b['pkgs'].items(): 67 for pkg, v in b['pkgs'].items():
59 if v == None: # unpinned package 68 if v == True:
69 # unpinned package
60 pkgs.append(pkg) 70 pkgs.append(pkg)
61 elif v != False: # repo-pinned package (False == skip package) 71 elif not (v == False or v == None):
72 # repo-pinned package (skip pkg when false/null)
62 v.lstrip('@') 73 v.lstrip('@')
63 pkgs.append(f'{pkg}@{v}') 74 pkgs.append(f'{pkg}@{v}')
64 b['pkgs'] = ','.join(str(x) for x in pkgs) 75 b['pkgs'] = ','.join(str(x) for x in pkgs)
@@ -71,9 +82,11 @@ for bk, b in builds.items():
71 'shutdown': [] 82 'shutdown': []
72 } 83 }
73 for svc, v in b['svcs'].items(): 84 for svc, v in b['svcs'].items():
74 if v == None: # service in default runlevel 85 if v == True:
86 # service in default runlevel
75 svcs['default'].append(svc) 87 svcs['default'].append(svc)
76 elif v != False: # service in specified runlevel (False == skip service) 88 elif not (v == False or v == None):
89 # service in specified runlevel (skip svc when false/null)
77 svcs[v].append(svc) 90 svcs[v].append(svc)
78 b['svcs'] = ':'.join(str(l) + '=' + ','.join(str(s) for s in ss) for l, ss in svcs.items()) 91 b['svcs'] = ':'.join(str(l) + '=' + ','.join(str(s) for s in ss) for l, ss in svcs.items())
79 92