Move source to packer, add board spec.
This commit is contained in:
parent
fa9f06cb9a
commit
262f82aa64
|
@ -1,18 +1,18 @@
|
||||||
load("@io_bazel_rules_go//go:def.bzl", "go_binary", "go_library")
|
load("@io_bazel_rules_go//go:def.bzl", "go_binary", "go_library")
|
||||||
|
|
||||||
go_library(
|
go_library(
|
||||||
name = "ubuntu-board-gen_lib",
|
name = "packer_lib",
|
||||||
srcs = ["main.go"],
|
srcs = ["ubuntu-board-gen.go"],
|
||||||
importpath = "git.wntrmute.dev/kyle/bladerunner/src/cmd/ubuntu-board-gen",
|
importpath = "git.wntrmute.dev/kyle/bladerunner/packer",
|
||||||
visibility = ["//visibility:private"],
|
visibility = ["//visibility:private"],
|
||||||
deps = [
|
deps = [
|
||||||
"//src/packer",
|
"//packer/packerlib",
|
||||||
"@ht_sr_git_kisom_goutils//die",
|
"@ht_sr_git_kisom_goutils//die",
|
||||||
],
|
],
|
||||||
)
|
)
|
||||||
|
|
||||||
go_binary(
|
go_binary(
|
||||||
name = "ubuntu-board-gen",
|
name = "ubuntu-board-gen",
|
||||||
embed = [":ubuntu-board-gen_lib"],
|
embed = [":packer_lib"],
|
||||||
visibility = ["//visibility:public"],
|
visibility = ["//visibility:public"],
|
||||||
)
|
)
|
|
@ -0,0 +1,54 @@
|
||||||
|
{
|
||||||
|
"variables": {},
|
||||||
|
"builders": [
|
||||||
|
{
|
||||||
|
"type": "arm",
|
||||||
|
"file_urls": [
|
||||||
|
"build/ubuntu-22.04.2-preinstalled-server-arm64+raspi.img.xz",
|
||||||
|
"https://cdimage.ubuntu.com/releases/22.04.2/release/ubuntu-22.04.2-preinstalled-server-arm64+raspi.img.xz"
|
||||||
|
],
|
||||||
|
"file_checksum_url": "http://cdimage.ubuntu.com/releases/22.04.2/release/SHA256SUMS",
|
||||||
|
"file_checksum_type": "sha256",
|
||||||
|
"file_target_extension": "xz",
|
||||||
|
"file_unarchive_cmd": [
|
||||||
|
"xz",
|
||||||
|
"--decompress",
|
||||||
|
"$ARCHIVE_PATH"
|
||||||
|
],
|
||||||
|
"image_build_method": "reuse",
|
||||||
|
"image_path": "build/cm4-cluster-ubuntu-22.04.2.img",
|
||||||
|
"image_size": "32G",
|
||||||
|
"image_type": "dos",
|
||||||
|
"image_partitions": [
|
||||||
|
{
|
||||||
|
"name": "boot",
|
||||||
|
"type": "c",
|
||||||
|
"start_sector": 2048,
|
||||||
|
"size": "256M",
|
||||||
|
"mountpoint": "/boot/firmware"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "root",
|
||||||
|
"type": "83",
|
||||||
|
"start_sector": 526336,
|
||||||
|
"size": "31.7G",
|
||||||
|
"mountpoint": "/"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"image_chroot_env": [
|
||||||
|
"PATH=/usr/local/bin:/usr/local/sbin:/usr/bin:/usr/sbin:/bin:/sbin"
|
||||||
|
],
|
||||||
|
"qemu_binary_source_path": "/usr/bin/qemu-aarch64-static",
|
||||||
|
"qemu_binary_destination_path": "/usr/bin/qemu-aarch64-static"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"provisioners": [
|
||||||
|
{
|
||||||
|
"scripts": [
|
||||||
|
"scripts/install-base.sh"
|
||||||
|
],
|
||||||
|
"type": "shell"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"post-processors": null
|
||||||
|
}
|
|
@ -11,7 +11,7 @@ errmsg () {
|
||||||
|
|
||||||
preflight () {
|
preflight () {
|
||||||
case "${IMAGE_TYPE}" in
|
case "${IMAGE_TYPE}" in
|
||||||
ubuntu) PACKER_BUILD_FILE="boards/pi-cm4-ubuntu-22.04.2.json" ;;
|
ubuntu) PACKER_BUILD_FILE="boards/cm4-cluster-ubuntu-22.04.2.json" ;;
|
||||||
raspbian) PACKER_BUILD_FILE="boards/raspberry-pi/raspios-lite-arm.json" ;;
|
raspbian) PACKER_BUILD_FILE="boards/raspberry-pi/raspios-lite-arm.json" ;;
|
||||||
custom)
|
custom)
|
||||||
if [ -z "${PACKER_BUILD_FILE}" ]
|
if [ -z "${PACKER_BUILD_FILE}" ]
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
load("@io_bazel_rules_go//go:def.bzl", "go_library")
|
load("@io_bazel_rules_go//go:def.bzl", "go_library")
|
||||||
|
|
||||||
go_library(
|
go_library(
|
||||||
name = "packer",
|
name = "packerlib",
|
||||||
srcs = [
|
srcs = [
|
||||||
"board.go",
|
"board.go",
|
||||||
"builder.go",
|
"builder.go",
|
||||||
|
@ -9,7 +9,7 @@ go_library(
|
||||||
"provisioner.go",
|
"provisioner.go",
|
||||||
"ubuntu.go",
|
"ubuntu.go",
|
||||||
],
|
],
|
||||||
importpath = "git.wntrmute.dev/kyle/bladerunner/src/packer",
|
importpath = "git.wntrmute.dev/kyle/bladerunner/packer/packerlib",
|
||||||
visibility = ["//visibility:public"],
|
visibility = ["//visibility:public"],
|
||||||
deps = ["@in_gopkg_yaml_v2//:yaml_v2"],
|
deps = ["@in_gopkg_yaml_v2//:yaml_v2"],
|
||||||
)
|
)
|
|
@ -1,4 +1,4 @@
|
||||||
package packer
|
package packerlib
|
||||||
|
|
||||||
type Board struct {
|
type Board struct {
|
||||||
Variables map[string]string `json:"variables"`
|
Variables map[string]string `json:"variables"`
|
|
@ -1,4 +1,4 @@
|
||||||
package packer
|
package packerlib
|
||||||
|
|
||||||
// RootPartitionSizes describes how big a single root partition should
|
// RootPartitionSizes describes how big a single root partition should
|
||||||
// be given a standard 256M boot partition. This should cover standard
|
// be given a standard 256M boot partition. This should cover standard
|
|
@ -0,0 +1,3 @@
|
||||||
|
// Package packerlib contains utilities for interacting with Packer
|
||||||
|
// in the context of building images for the computeblade cluster.
|
||||||
|
package packerlib
|
|
@ -1,4 +1,4 @@
|
||||||
package packer
|
package packerlib
|
||||||
|
|
||||||
type Provisioner map[string]interface{}
|
type Provisioner map[string]interface{}
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
package packer
|
package packerlib
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"bytes"
|
"bytes"
|
||||||
|
@ -96,7 +96,7 @@ func (spec UbuntuBoardSpec) Board() Board {
|
||||||
}
|
}
|
||||||
|
|
||||||
func LoadUbuntuSpecs(path string) (specFile UbuntuBoardSpecFile, err error) {
|
func LoadUbuntuSpecs(path string) (specFile UbuntuBoardSpecFile, err error) {
|
||||||
log.Println("loading from", specFile)
|
log.Println("loading from", path)
|
||||||
data, err := ioutil.ReadFile(path)
|
data, err := ioutil.ReadFile(path)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return
|
return
|
|
@ -3,6 +3,7 @@
|
||||||
set -euxo pipefail
|
set -euxo pipefail
|
||||||
|
|
||||||
echo "==> Setting nameserver"
|
echo "==> Setting nameserver"
|
||||||
|
rm /etc/resolv.conf
|
||||||
echo 'nameserver 8.8.8.8' > /etc/resolv.conf
|
echo 'nameserver 8.8.8.8' > /etc/resolv.conf
|
||||||
|
|
||||||
echo "==> installing base updates"
|
echo "==> installing base updates"
|
||||||
|
|
|
@ -4,7 +4,7 @@ import (
|
||||||
"flag"
|
"flag"
|
||||||
|
|
||||||
"git.sr.ht/~kisom/goutils/die"
|
"git.sr.ht/~kisom/goutils/die"
|
||||||
"git.wntrmute.dev/kyle/bladerunner/src/packer"
|
packer "git.wntrmute.dev/kyle/bladerunner/packer/packerlib"
|
||||||
)
|
)
|
||||||
|
|
||||||
func main() {
|
func main() {
|
|
@ -1,3 +0,0 @@
|
||||||
// Package packer contains utilities for interacting with Packer
|
|
||||||
// in the context of building images for the computeblade cluster.
|
|
||||||
package packer
|
|
Loading…
Reference in New Issue