From 214a84994c16de0f4eff9ae10f0799aecb5bde0d Mon Sep 17 00:00:00 2001 From: Philippe Caseiro Date: Wed, 28 Dec 2022 09:51:38 +0100 Subject: [PATCH] feat(recipe): adding alpine 3.17 version --- recipes/alpine/3.17.pkrvars.hcl | 6 ++++ recipes/alpine/kubernetes.pkr.hcl | 2 +- recipes/alpine/locals.matchbox.pkr.hcl | 2 +- recipes/alpine/matchbox.pkr.hcl | 8 ++++- .../provisionning/alpine-3.16-install.sh | 5 ++- .../provisionning/alpine-3.17-install.sh | 1 + .../provisionning/alpine-3.17-postinstall.sh | 1 + .../conf/matchbox/initmatchbox.start | 19 ++++++++++++ recipes/alpine/provisionning/matchbox.sh | 31 ++----------------- .../alpine/provisionning/templater-install.sh | 2 ++ tools/.asgard.conf | 6 ---- tools/.eole-one.conf | 6 ---- tools/.midgard-dev.conf | 6 ---- tools/.midgard-staging.conf | 6 ---- tools/.midgard.conf | 6 ---- tools/.one-templates.conf | 7 ----- tools/.yggy.conf | 6 ---- 17 files changed, 45 insertions(+), 75 deletions(-) create mode 100644 recipes/alpine/3.17.pkrvars.hcl create mode 120000 recipes/alpine/provisionning/alpine-3.17-install.sh create mode 120000 recipes/alpine/provisionning/alpine-3.17-postinstall.sh create mode 100644 recipes/alpine/provisionning/conf/matchbox/initmatchbox.start delete mode 100644 tools/.asgard.conf delete mode 100644 tools/.eole-one.conf delete mode 100644 tools/.midgard-dev.conf delete mode 100644 tools/.midgard-staging.conf delete mode 100644 tools/.midgard.conf delete mode 100644 tools/.one-templates.conf delete mode 100644 tools/.yggy.conf diff --git a/recipes/alpine/3.17.pkrvars.hcl b/recipes/alpine/3.17.pkrvars.hcl new file mode 100644 index 0000000..20169c1 --- /dev/null +++ b/recipes/alpine/3.17.pkrvars.hcl @@ -0,0 +1,6 @@ +name = "alpine" +version = "3.17.0" +short_version = "3.17" +arch = "x86_64" +source_url = "https://dl-cdn.alpinelinux.org/alpine" +iso_cd_checksum = "8d4d53bd34b2045e1e219b87887b0de8d217b6cd4a8b476a077429845a5582ba" \ No newline at end of file diff --git a/recipes/alpine/kubernetes.pkr.hcl b/recipes/alpine/kubernetes.pkr.hcl index c975189..e9ba131 100644 --- a/recipes/alpine/kubernetes.pkr.hcl +++ b/recipes/alpine/kubernetes.pkr.hcl @@ -42,7 +42,7 @@ EOF content = "${jsonencode(local.Kubernetes)}" } - // Copy habor OpenRC init script to the image + // Copy Sharemetrics script provisioner "file" { destination = "/etc/local.d/sharemetrics.start" source = "${local.locations.provisionning}/conf/${build.name}/sharemetrics.start" diff --git a/recipes/alpine/locals.matchbox.pkr.hcl b/recipes/alpine/locals.matchbox.pkr.hcl index 683bebe..b2b61d5 100644 --- a/recipes/alpine/locals.matchbox.pkr.hcl +++ b/recipes/alpine/locals.matchbox.pkr.hcl @@ -28,7 +28,7 @@ locals { AlpineEdgeTesting = { type = "apk" name = "testing" - url = "http://mirror.serverion.com/alpine/edge/testing" + url = "http://mirrors.ircam.fr/pub/alpine/edge/testing" enabled = true } } diff --git a/recipes/alpine/matchbox.pkr.hcl b/recipes/alpine/matchbox.pkr.hcl index 4a8ff01..73fc430 100644 --- a/recipes/alpine/matchbox.pkr.hcl +++ b/recipes/alpine/matchbox.pkr.hcl @@ -42,6 +42,12 @@ EOF content = "${jsonencode(local.MatchBox)}" } + // Copy matchbox boot provisionning script + provisioner "file" { + destination = "/etc/local.d/initmatchbox.start" + source = "${local.locations.provisionning}/conf/${build.name}/initmatchbox.start" + } + // Generate default configuration for kubernetes provisioner "shell" { max_retries = 3 @@ -77,7 +83,7 @@ EOF post-processor "shell-local" { inline = [ "/bin/sh ${path.cwd}/post-processors/sparsify.sh ${var.output_dir}/${var.version}/provisionned/matchbox ${var.image_version}", - "ruby ${local.dirs.tools}/one-templates -t image -m 640 -T ${local.dirs.templates}/one/image/common.tpl -n ${local.output_name}-${var.version}-matchbox -c 'matchbox base image' --image-file ${var.output_dir}/${var.version}/provisionned/matchbox/${local.output_name}-${var.version}-matchbox.img", + "ruby ${local.dirs.tools}/one-templates -t image -m 640 -T ${local.dirs.templates}/one/image/common.tpl -n ${local.output_name}-${var.version}-matchbox -c 'Matchbox base image' --image-file ${var.output_dir}/${var.version}/provisionned/matchbox/${local.output_name}-${var.version}-matchbox.img", "ruby ${local.dirs.tools}/one-templates -t vm -m 640 -T ${local.dirs.templates}/one/vm/matchbox.xml -n ${local.output_name}-${var.version}-matchbox --image-name ${local.output_name}-${var.version}-matchbox" ] } diff --git a/recipes/alpine/provisionning/alpine-3.16-install.sh b/recipes/alpine/provisionning/alpine-3.16-install.sh index 116b0e3..d2a0bd2 100644 --- a/recipes/alpine/provisionning/alpine-3.16-install.sh +++ b/recipes/alpine/provisionning/alpine-3.16-install.sh @@ -2,7 +2,7 @@ set -xeo pipefail # Run the installer -echo "y" | setup-alpine -e -f install.conf +yes | setup-alpine -e -f install.conf # Copy ssh keys echo "Copy packer ssh key" @@ -11,5 +11,8 @@ cp -rp .ssh /mnt/root/ sync umount /mnt +apk update +apk add curl + echo "Rebooting the host after install" reboot diff --git a/recipes/alpine/provisionning/alpine-3.17-install.sh b/recipes/alpine/provisionning/alpine-3.17-install.sh new file mode 120000 index 0000000..2d4ac84 --- /dev/null +++ b/recipes/alpine/provisionning/alpine-3.17-install.sh @@ -0,0 +1 @@ +alpine-3.16-install.sh \ No newline at end of file diff --git a/recipes/alpine/provisionning/alpine-3.17-postinstall.sh b/recipes/alpine/provisionning/alpine-3.17-postinstall.sh new file mode 120000 index 0000000..db37049 --- /dev/null +++ b/recipes/alpine/provisionning/alpine-3.17-postinstall.sh @@ -0,0 +1 @@ +alpine-3.16-postinstall.sh \ No newline at end of file diff --git a/recipes/alpine/provisionning/conf/matchbox/initmatchbox.start b/recipes/alpine/provisionning/conf/matchbox/initmatchbox.start new file mode 100644 index 0000000..e7feaf7 --- /dev/null +++ b/recipes/alpine/provisionning/conf/matchbox/initmatchbox.start @@ -0,0 +1,19 @@ +#!/bin/sh + +FL_VERSIONS="current 3374.2.0" +MATCHBOX_DIR="/var/lib/matchbox" +ASSETS_DIR="${MATCHBOX_DIR}/assets/" + +echo "Provisionning matchbox with flatcar images" +echo " * Current stable image (try 1)" +for version in ${FL_VERSIONS}; do + while ! bash -x /usr/local/bin/get-flatcar stable ${version} ${ASSETS_DIR}; do + sleep 1 + echo " * ${version} stable image (try ${item})" + if [ "${tout}" -eq "${item}" ]; then + break + exit 1 + fi + item=$((item+1)) + done +done \ No newline at end of file diff --git a/recipes/alpine/provisionning/matchbox.sh b/recipes/alpine/provisionning/matchbox.sh index 357f763..f7182e7 100644 --- a/recipes/alpine/provisionning/matchbox.sh +++ b/recipes/alpine/provisionning/matchbox.sh @@ -10,6 +10,8 @@ ASSETS_DIR="${MATCHBOX_DIR}/assets/" MATCHBOX_USER="matchbox" FL_VERSIONS="current 3374.2.0" +apk add wget + echo "Downloading matchbox" cd /tmp wget -q --show-progress "${URL}" @@ -28,33 +30,6 @@ mkdir -p "${ASSETS_DIR}" chown -R "${MATCHBOX_USER}:${MATCHBOX_USER}" "${MATCHBOX_DIR}" chown -R "${MATCHBOX_USER}:${MATCHBOX_USER}" "${ASSETS_DIR}" -tout=30 -item=1 -echo "Provisionning matchbox with flatcar images" -echo " * Current stable image (try 1)" -for version in ${FL_VERSIONS}; do - while ! bash -x /usr/local/bin/get-flatcar stable ${version} ${ASSETS_DIR}; do - sleep 1 - echo " * ${version} stable image (try ${item})" - if [ "${tout}" -eq "${item}" ]; then - break - exit 1 - fi - item=$((item+1)) - done -done - -echo " * 3374.2.0 stable image (try 1)" -get-flatcar stable 3374.2.0 "${ASSETS_DIR}" -if [ "${?}" -ne 0 ]; then - sleep 3 - echo " * 3374.2.0 stable image (try 2)" - get-flatcar stable 3374.2.0 "${ASSETS_DIR}" -fi - -chown -R "${MATCHBOX_USER}:${MATCHBOX_USER}" "${ASSETS_DIR}" -ls -lhaR ${ASSETS_DIR} - -cp -rp ./scripts/tls /root +cp -rp ./scripts/tls /root/.secrets exit "${?}" \ No newline at end of file diff --git a/recipes/alpine/provisionning/templater-install.sh b/recipes/alpine/provisionning/templater-install.sh index 2e83f0a..8c9ca96 100644 --- a/recipes/alpine/provisionning/templater-install.sh +++ b/recipes/alpine/provisionning/templater-install.sh @@ -15,6 +15,8 @@ installTool() { chmod +x ${TOOL_DIR}/${NAME} } +apk add curl + # Install templater installTool "tpr" "https://forge.cadoles.com/attachments/bbe5e07f-433c-4f57-ba88-4f86e2780ca7" diff --git a/tools/.asgard.conf b/tools/.asgard.conf deleted file mode 100644 index d972bd1..0000000 --- a/tools/.asgard.conf +++ /dev/null @@ -1,6 +0,0 @@ -user: pcaseiro -token: 3b4ee45f23eda94727745940d85daa173430d3d4 -builder_addr: 192.168.10.177 -endpoint: https://asgard.cadoles.com -flow_endpoint: https://asgard.cadoles.com/oneflow -datastore_id: 101 diff --git a/tools/.eole-one.conf b/tools/.eole-one.conf deleted file mode 100644 index c1aca30..0000000 --- a/tools/.eole-one.conf +++ /dev/null @@ -1,6 +0,0 @@ -user: pcaseiro -token: feb09a5d34ba6beae09e77ade13bfcefb1fb75c1088ac0e041061911ddb89875 -builder_addr: 192.168.230.192 -endpoint: http://one.eole.lan -flow_endpoint: http://one.eole.lan/oneflow -datastore_id: 101 diff --git a/tools/.midgard-dev.conf b/tools/.midgard-dev.conf deleted file mode 100644 index b070ea6..0000000 --- a/tools/.midgard-dev.conf +++ /dev/null @@ -1,6 +0,0 @@ -user: terra -token: c4e249fdae281ce6f8e1c7cc4326996fca4b4c7b -builder_addr: 192.168.10.177 -endpoint: https://midgard.cadoles.com -flow_endpoint: https://midgard.cadoles.com/oneflow -datastore_id: 103 diff --git a/tools/.midgard-staging.conf b/tools/.midgard-staging.conf deleted file mode 100644 index 5a46593..0000000 --- a/tools/.midgard-staging.conf +++ /dev/null @@ -1,6 +0,0 @@ -user: terra -token: 1cfe1c2b27216b666cf7d7af760e63ccd1630840 -builder_addr: 192.168.10.177 -endpoint: https://midgard.cadoles.com -flow_endpoint: https://midgard.cadoles.com/oneflow -datastore_id: 103 diff --git a/tools/.midgard.conf b/tools/.midgard.conf deleted file mode 100644 index 39fbe0b..0000000 --- a/tools/.midgard.conf +++ /dev/null @@ -1,6 +0,0 @@ -user: terra -token: a48f776f7bfe1f264d9bc4cbba6babee33c5eca2 -builder_addr: 192.168.10.177 -endpoint: https://midgard.cadoles.com -flow_endpoint: https://midgard.cadoles.com/oneflow -datastore_id: 103 diff --git a/tools/.one-templates.conf b/tools/.one-templates.conf deleted file mode 100644 index 10355c1..0000000 --- a/tools/.one-templates.conf +++ /dev/null @@ -1,7 +0,0 @@ -user: pcaseiro -token: b37911f5ec06589fcf9411958d1ec1bc5fa7f46d5aafb9b1100a9446b1140299 -builder_addr: 192.168.10.177 -external_url: http://192.168.230.58/images -endpoint: http://one.eole.lan -flow_endpoint: http://one.eole.lan/oneflow -datastore_id: 101 diff --git a/tools/.yggy.conf b/tools/.yggy.conf deleted file mode 100644 index 0a32b20..0000000 --- a/tools/.yggy.conf +++ /dev/null @@ -1,6 +0,0 @@ -user: eoleone -token: 9a00930f231b58f51e6f42c9faaddb100036897e35f32206b5c1264295c8dc6d -builder_addr: 192.168.10.177 -endpoint: https://yggy.cadoles.com -flow_endpoint: https://yggy.cadoles.com/oneflow -datastore_id: 101