From 166100e5f3d70557a9ee1e85f39386cfa7b63b6c Mon Sep 17 00:00:00 2001 From: Eric P Date: Tue, 24 Dec 2024 10:25:03 -0600 Subject: [PATCH] Copy tooling changes from hello-world-startos --- .github/workflows/buildService.yml | 1 + .github/workflows/releaseService.yml | 1 + Makefile | 37 +++++++++++----------------- scripts/embassy.ts | 4 +-- scripts/procedures/healthChecks.ts | 6 +++-- scripts/procedures/migrations.ts | 5 ++-- scripts/procedures/setConfig.ts | 2 ++ 7 files changed, 27 insertions(+), 29 deletions(-) diff --git a/.github/workflows/buildService.yml b/.github/workflows/buildService.yml index 299c90c..ab6e729 100644 --- a/.github/workflows/buildService.yml +++ b/.github/workflows/buildService.yml @@ -27,6 +27,7 @@ jobs: make PACKAGE_ID=$(yq -oy ".id" manifest.*) echo "package_id=$PACKAGE_ID" >> $GITHUB_ENV + printf "\n SHA256SUM: $(sha256sum ${PACKAGE_ID}.s9pk) \n" shell: bash - name: Upload .s9pk diff --git a/.github/workflows/releaseService.yml b/.github/workflows/releaseService.yml index f1eebb4..6cf91f2 100644 --- a/.github/workflows/releaseService.yml +++ b/.github/workflows/releaseService.yml @@ -33,6 +33,7 @@ jobs: - name: Generate sha256 checksum run: | PACKAGE_ID=${{ env.package_id }} + printf "\n SHA256SUM: $(sha256sum ${PACKAGE_ID}.s9pk) \n" sha256sum ${PACKAGE_ID}.s9pk > ${PACKAGE_ID}.s9pk.sha256 shell: bash diff --git a/Makefile b/Makefile index 5012dba..1beeb44 100644 --- a/Makefile +++ b/Makefile @@ -1,11 +1,11 @@ -PKG_ID := $(shell yq e ".id" manifest.yaml) -PKG_VERSION := $(shell yq e ".version" manifest.yaml) +PKG_ID := $(shell yq e ".id" < manifest.yaml) +PKG_VERSION := $(shell yq e ".version" < manifest.yaml) TS_FILES := $(shell find ./ -name \*.ts) # delete the target of a rule if it has changed and its recipe exits with a nonzero exit status .DELETE_ON_ERROR: -all: submodule-update verify +all: verify verify: $(PKG_ID).s9pk @start-sdk verify s9pk $(PKG_ID).s9pk @@ -13,50 +13,43 @@ verify: $(PKG_ID).s9pk @echo " Filesize: $(shell du -h $(PKG_ID).s9pk) is ready" install: -ifeq (,$(wildcard ~/.embassy/config.yaml)) - @echo; echo "You must define \"host: http://server-name.local\" in ~/.embassy/config.yaml config file first"; echo -else - start-cli package install $(PKG_ID).s9pk -endif + @if [ ! -f ~/.embassy/config.yaml ]; then echo "You must define \"host: http://server-name.local\" in ~/.embassy/config.yaml config file first."; exit 1; fi + @echo "\nInstalling to $$(grep -v '^#' ~/.embassy/config.yaml | cut -d'/' -f3) ...\n" + @[ -f $(PKG_ID).s9pk ] || ( $(MAKE) && echo "\nInstalling to $$(grep -v '^#' ~/.embassy/config.yaml | cut -d'/' -f3) ...\n" ) + @start-cli package install $(PKG_ID).s9pk clean: rm -rf docker-images rm -f $(PKG_ID).s9pk rm -f scripts/*.js -submodule-update: - @if [ -z "$(shell git submodule status | egrep -v '^ '|awk '{print $$2}')" ]; then \ - echo "Submodules are up to date."; \ - else \ - echo "\nUpdating submodules...\n"; \ - git submodule update --init --progress; \ - fi +clean-manifest: + @sed -i '' '/^[[:blank:]]*#/d' manifest.yaml + @echo; echo "Comments successfully removed from manifest.yaml file."; echo scripts/embassy.js: $(TS_FILES) - deno bundle scripts/embassy.ts scripts/embassy.js + deno run --allow-read --allow-write --allow-env --allow-net scripts/bundle.ts -# for rebuilding just the arm image. will include docker-images/x86_64.tar into the s9pk if it exists arm: @rm -f docker-images/x86_64.tar ARCH=aarch64 $(MAKE) -# for rebuilding just the x86 image. will include docker-images/aarch64.tar into the s9pk if it exists x86: @rm -f docker-images/aarch64.tar ARCH=x86_64 $(MAKE) -docker-images/x86_64.tar: Dockerfile docker_entrypoint.sh +docker-images/aarch64.tar: Dockerfile docker_entrypoint.sh ifeq ($(ARCH),aarch64) else mkdir -p docker-images - docker buildx build --tag start9/$(PKG_ID)/main:$(PKG_VERSION) --platform=linux/amd64 --build-arg PLATFORM=amd64 -o type=docker,dest=docker-images/x86_64.tar . + docker buildx build --tag start9/$(PKG_ID)/main:$(PKG_VERSION) --build-arg ARCH=aarch64 --platform=linux/arm64 -o type=docker,dest=docker-images/aarch64.tar . endif -docker-images/aarch64.tar: Dockerfile docker_entrypoint.sh +docker-images/x86_64.tar: Dockerfile docker_entrypoint.sh ifeq ($(ARCH),x86_64) else mkdir -p docker-images - docker buildx build --tag start9/$(PKG_ID)/main:$(PKG_VERSION) --platform=linux/arm64 --build-arg PLATFORM=arm64 -o type=docker,dest=docker-images/aarch64.tar . + docker buildx build --tag start9/$(PKG_ID)/main:$(PKG_VERSION) --build-arg ARCH=x86_64 --platform=linux/amd64 -o type=docker,dest=docker-images/x86_64.tar . endif $(PKG_ID).s9pk: manifest.yaml instructions.md LICENSE helipad.png scripts/embassy.js docker-images/aarch64.tar docker-images/x86_64.tar diff --git a/scripts/embassy.ts b/scripts/embassy.ts index d0e6327..8d2f468 100644 --- a/scripts/embassy.ts +++ b/scripts/embassy.ts @@ -1,5 +1,5 @@ -export { getConfig } from "./procedures/getConfig.ts"; export { setConfig } from "./procedures/setConfig.ts"; +export { getConfig } from "./procedures/getConfig.ts"; export { properties } from "./procedures/properties.ts"; -export { health } from "./procedures/healthChecks.ts"; export { migration } from "./procedures/migrations.ts"; +export { health } from "./procedures/healthChecks.ts"; diff --git a/scripts/procedures/healthChecks.ts b/scripts/procedures/healthChecks.ts index 33f0157..8d40a5d 100644 --- a/scripts/procedures/healthChecks.ts +++ b/scripts/procedures/healthChecks.ts @@ -1,5 +1,7 @@ import { types as T, healthUtil } from "../deps.ts"; export const health: T.ExpectedExports.health = { - "web-ui": healthUtil.checkWebUrl("http://helipad.embassy:2112") -} + async "web-ui"(effects, duration) { + return healthUtil.checkWebUrl("http://helipad.embassy:2112")(effects, duration).catch(healthUtil.catchError(effects)) + }, +}; diff --git a/scripts/procedures/migrations.ts b/scripts/procedures/migrations.ts index 702bd2d..1d28a02 100644 --- a/scripts/procedures/migrations.ts +++ b/scripts/procedures/migrations.ts @@ -1,5 +1,4 @@ import { compat, types as T } from "../deps.ts"; -export const migration: T.ExpectedExports.migration = - compat.migrations.fromMapping({}, "0.2.1"); - +export const migration: T.ExpectedExports.migration = compat.migrations + .fromMapping({}, "0.2.1" ); diff --git a/scripts/procedures/setConfig.ts b/scripts/procedures/setConfig.ts index aeee211..43d308f 100644 --- a/scripts/procedures/setConfig.ts +++ b/scripts/procedures/setConfig.ts @@ -1,3 +1,5 @@ +// This is where any configuration rules related to the configuration would go. These ensure that the user can only create a valid config. + import { compat, } from "../deps.ts"; export const setConfig = compat.setConfig;