Unverified Commit 65c6cb9a authored by Jan Orel's avatar Jan Orel Committed by Jan Orel
Browse files

Build supported images using Packer

parent c7918659
Loading
Loading
Loading
Loading
+7 −0
Original line number Diff line number Diff line
build/
export/
Makefile.local
version
packer/*/*-cloud-init.iso
packer/*/*-context.iso
packer/*/context/
context-windows/out/
context-windows/*.msi
context-windows/rhsrvany.exe

Makefile

0 → 100644
+70 −0
Original line number Diff line number Diff line
# load variables and makefile config
include Makefile.config

# load possible overrides or non-free definitions
-include Makefile.local

# all, aliases
all: $(patsubst %, packer-%, $(DISTROS)) $(patsubst %, packer-%, $(SERVICES))
distros: $(patsubst %, packer-%, $(DISTROS))
services: $(patsubst %, packer-%, $(SERVICES))

# allow individual distribution targets (e.g., "make debian11")
$(DISTROS) $(SERVICES):  %: packer-% ;

# aliases + dependency
packer-%: context-linux ${DIR_EXPORT}/%.qcow2
	@${INFO} "Packer ${*} done"

packer-service_vnf: packer-alpine318 ${DIR_EXPORT}/service_vnf.qcow2
	@${INFO} "Packer service_vnf done"

packer-service_wordpress: packer-alma8 ${DIR_EXPORT}/service_wordpress.qcow2
	@${INFO} "Packer service_wordpress done"

packer-service_OneKE: packer-ubuntu2204 ${DIR_EXPORT}/service_OneKE.qcow2
	@${INFO} "Packer service_OneKE done"

# run packer build for given distro or service
${DIR_EXPORT}/%.qcow2:
	$(eval DISTRO_NAME := $(shell echo ${*} | sed 's/[0-9].*//'))
	$(eval DISTRO_VER  := $(shell echo ${*} | sed 's/^.[^0-9]*\(.*\)/\1/'))
	packer/build.sh "${DISTRO_NAME}" "${DISTRO_VER}" ${@}

# context packages
context-linux: $(patsubst %, context-linux/out/%, $(LINUX_CONTEXT_PACKAGES))
	@${INFO} "Generate context-linux done"

context-linux/out/%:
	cd context-linux; ./generate-all.sh

context-windows: $(patsubst %, context-windows/out/%, $(WINDOWS_CONTEXT_PACKAGES))
	@${INFO} "Generate context-windows done"

context-windows/out/%:
	cd context-windows; ./generate-all.sh

clean:
	-rm -rf ${DIR_EXPORT}/*

help:
	@echo 'Usage examples:'
	@echo '    make <distro>          -- build just one distro'
	@echo '    make <service>         -- build just one service'
	@echo
	@echo '    make all               -- build all distros and services'
	@echo '    make distros           -- build all distros'
	@echo '    make services          -- build all services'
	@echo
	@echo '    make context-linux     -- build context linux packages'
	@echo '    make context-windows   -- build windows linux packages'
	@echo
	@echo 'Available distros:'
	@echo "$(shell echo "${DISTROS}" | fmt -w 65 | tr '\n' '\1' )" \
		           | tr '\1' '\n' | sed 's/^/    /'
	@echo 'Available services:'
	@echo '    $(SERVICES)'
	@echo

version:
	@echo $(VERSION)-$(RELEASE) > version

Makefile.config

0 → 100644
+63 −0
Original line number Diff line number Diff line
# context version definition
VERSION := 6.6.1
RELEASE := 1

# log
VERBOSE            := 1
PACKER_LOG         := 0
PACKER_HEADLESS    := true

DISTROS := alma8 alma9 \
           alpine316 alpine317 alpine318\
           alt9 alt10 \
           amazon2 \
           centos7 centos8stream \
           debian10 debian11 debian12 \
           devuan3 devuan4\
           fedora37 fedora38 \
           freebsd12 freebsd13 \
           ol8 ol9 \
           opensuse15 \
           rocky8 rocky9 \
           ubuntu2004 ubuntu2004min ubuntu2204 ubuntu2204min

SERVICES := service_vnf service_wordpress service_OneKE

.DEFAULT_GOAL := help

# default directories
DIR_BUILD  := build
DIR_EXPORT := export
$(shell mkdir -p ${DIR_BUILD} ${DIR_EXPORT})

# don't delete exported
.SECONDARY: $(patsubst %, $(DIR_EXPORT)/%.qcow2, $(DISTROS)) $(patsubst %, $(DIR_EXPORT)/%.qcow2, $(SERVICES))

.PHONY: context-linux context-windows help

# this needs to match context-linux/generate-all.sh products
LINUX_CONTEXT_PACKAGES := one-context_${VERSION}-${RELEASE}.deb \
    one-context-${VERSION}-${RELEASE}.el6.noarch.rpm \
    one-context-${VERSION}-${RELEASE}.el7.noarch.rpm \
    one-context-${VERSION}-${RELEASE}.el8.noarch.rpm \
    one-context-${VERSION}-${RELEASE}.el9.noarch.rpm \
    one-context-${VERSION}-${RELEASE}.suse.noarch.rpm \
    one-context-${VERSION}_${RELEASE}.txz \
    one-context-${VERSION}-alt${RELEASE}.noarch.rpm \
    one-context-${VERSION}-r${RELEASE}.apk \
    one-context-linux-${VERSION}-${RELEASE}.iso

LINUX_CONTEXT_PACKAGES_FULL := $(patsubst %, context-linux/out/%, $(LINUX_CONTEXT_PACKAGES))

# this needs to match context-windows/generate-all.sh products
WINDOWS_CONTEXT_PACKAGES := one-context-${VERSION}.msi \
    one-context-${VERSION}.iso

WINDOWS_CONTEXT_PACKAGES_FULL := $(patsubst %, context-windows/out/%, $(WINDOWS_CONTEXT_PACKAGES))


# logging func
INFO=sh -c 'if [ $(VERBOSE) = 1 ]; then  echo [INFO] $$1; fi' INFO

# export all variables
export

README.md

0 → 100644
+10 −0
Original line number Diff line number Diff line
# one-apps
Toolchain to build OpenNebula appliances

Requirements:
- make
- Packer
- Qemu Packer Plugin
- cloud-utils
- guestfs-tools
- qemu-img
+11 −0
Original line number Diff line number Diff line
#!/usr/bin/env bash

service_bootstrap() { ruby -- "${BASH_SOURCE%.*}/appliance.rb" bootstrap; }

service_cleanup() { ruby -- "${BASH_SOURCE%.*}/appliance.rb" cleanup; }

service_configure() { ruby -- "${BASH_SOURCE%.*}/appliance.rb" configure; }

service_install() { ruby -- "${BASH_SOURCE%.*}/appliance.rb" install; }

return
Loading