aboutsummaryrefslogtreecommitdiff
path: root/grenade-brothers
diff options
context:
space:
mode:
authorJulien Dessaux2022-10-20 00:13:45 +0200
committerJulien Dessaux2022-10-20 00:13:45 +0200
commitb88441c2aa3a2cb443112960e8698453e32ac3b6 (patch)
tree7e174dfb9c0895575d69edd8e06c61b523aec429 /grenade-brothers
parentAdded simple system upgrade scripts (diff)
downloadev-scripts-b88441c2aa3a2cb443112960e8698453e32ac3b6.tar.gz
ev-scripts-b88441c2aa3a2cb443112960e8698453e32ac3b6.tar.bz2
ev-scripts-b88441c2aa3a2cb443112960e8698453e32ac3b6.zip
Added grenade-brothers scripts and jobs
Diffstat (limited to 'grenade-brothers')
-rwxr-xr-xgrenade-brothers/build-image.sh67
-rw-r--r--grenade-brothers/build.yaml29
-rw-r--r--grenade-brothers/deploy.yaml21
3 files changed, 117 insertions, 0 deletions
diff --git a/grenade-brothers/build-image.sh b/grenade-brothers/build-image.sh
new file mode 100755
index 0000000..a5398a6
--- /dev/null
+++ b/grenade-brothers/build-image.sh
@@ -0,0 +1,67 @@
+#!/usr/bin/env bash
+set -euo pipefail
+
+WORKDIR="/tmp/${EVENTLINE_JOB_NAME}"
+
+cleanup() {
+ rm -rf "${WORKDIR}"
+}
+
+trap cleanup EXIT
+
+ret=0; buildah images adyxax/alpine &>/dev/null || ret=$?
+if [[ "${ret}" != 0 ]]; then
+ buildah rmi --all
+ ALPINE_LATEST=$(curl --silent https://dl-cdn.alpinelinux.org/alpine/latest-stable/releases/x86_64/ |
+ perl -lane '$latest = $1 if $_ =~ /^<a href="(alpine-minirootfs-\d+\.\d+\.\d+-x86_64\.tar\.gz)">/; END {print $latest}'
+ )
+ if [ ! -e "./${ALPINE_LATEST}" ]; then
+ echo "Fetching ${ALPINE_LATEST}..."
+ curl --silent "https://dl-cdn.alpinelinux.org/alpine/latest-stable/releases/x86_64/${ALPINE_LATEST}" \
+ --output "./${ALPINE_LATEST}"
+ fi
+
+ ctr=$(buildah from scratch)
+ buildah add "${ctr}" "${ALPINE_LATEST}" /
+ buildah run "${ctr}" /bin/sh -c 'apk upgrade --no-cache'
+ buildah run "${ctr}" /bin/sh -c 'apk add --no-cache pcre sqlite-libs'
+ buildah commit "${ctr}" adyxax/alpine
+ buildah rm "${ctr}"
+fi
+
+ret=0; buildah images adyxax/zig &>/dev/null || ret=$?
+if [[ "${ret}" != 0 ]]; then
+ zig=$(buildah from adyxax/alpine)
+ buildah run "${zig}" /bin/sh -c 'echo "http://dl-cdn.alpinelinux.org/alpine/edge/testing" >> /etc/apk/repositories'
+ buildah run "${zig}" /bin/sh -c 'apk upgrade --no-cache'
+ buildah run "${zig}" /bin/sh -c 'apk add --no-cache zig'
+ buildah commit "${zig}" adyxax/zig
+else
+ zig=$(buildah from adyxax/zig)
+fi
+
+buildah run -v "${WORKDIR}":/gb "${zig}" /bin/sh -c 'cd /gb; zig build -Drelease-small=true'
+buildah rm "${zig}"
+
+ret=0; buildah images adyxax/wasm4 &>/dev/null || ret=$?
+if [[ "${ret}" != 0 ]]; then
+ wasm4=$(buildah from adyxax/alpine)
+ buildah run "${wasm4}" /bin/sh -c 'apk add --no-cache nodejs-current npm'
+ buildah run "${wasm4}" /bin/sh -c 'npm install -g wasm4'
+ buildah commit "${wasm4}" adyxax/wasm4
+else
+ wasm4=$(buildah from adyxax/wasm4)
+fi
+
+buildah copy "${wasm4}" "${WORKDIR}/zig-out/lib/cart.wasm" /
+
+buildah config \
+ --author 'Julien Dessaux' \
+ --cmd "w4 run --port 80 --no-open --no-qr /cart.wasm" \
+ --port 80 \
+ "${wasm4}"
+
+buildah commit "${wasm4}" adyxax/grenade-brothers
+buildah rm "${wasm4}"
+
+trap - EXIT
diff --git a/grenade-brothers/build.yaml b/grenade-brothers/build.yaml
new file mode 100644
index 0000000..37ee8c3
--- /dev/null
+++ b/grenade-brothers/build.yaml
@@ -0,0 +1,29 @@
+name: "grenade-brothers-build"
+steps:
+ - label: buildah login
+ script:
+ path: "../common/buildah-login.sh"
+ - label: git clone
+ script:
+ path: "../common/git-clone.sh"
+ arguments:
+ - "https://git.adyxax.org/adyxax/grenade-brothers"
+ - label: build image
+ script:
+ path: "build-image.sh"
+ - label: make push
+ script:
+ path: "../common/make.sh"
+ arguments:
+ - "push"
+ - label: clean
+ script:
+ path: "../common/clean.sh"
+identities:
+ - quay-io
+runner:
+ identity: "ssh-myth"
+ name: "ssh"
+ parameters:
+ host: "myth.adyxax.org"
+ user: "root"
diff --git a/grenade-brothers/deploy.yaml b/grenade-brothers/deploy.yaml
new file mode 100644
index 0000000..8a5c62d
--- /dev/null
+++ b/grenade-brothers/deploy.yaml
@@ -0,0 +1,21 @@
+name: "grenade-brothers-deploy"
+steps:
+ - label: git clone
+ script:
+ path: "../common/git-clone.sh"
+ arguments:
+ - "https://git.adyxax.org/adyxax/grenade-brothers"
+ - label: make deploy
+ script:
+ path: "../common/make.sh"
+ arguments:
+ - "deploy"
+ - label: clean
+ script:
+ path: "../common/clean.sh"
+runner:
+ identity: "ssh-myth"
+ name: "ssh"
+ parameters:
+ host: "myth.adyxax.org"
+ user: "root"