Portal 1.0 (rc.11): linten med iris, og nytt innhold lastes med Load
Nettstedet holder alt i én fil i enhetens StateDirectory og starter med en tom lagring, uten NATS. lint-and-reload sjekker med iris fra 1.0-utgaven, også på pull requests, og ber nettstedet laste hver commit på main (POST /dhd/1/load med LOAD_TOKEN) i stedet for å rope over NATS. deploy.yml peker på v1.0.0-rc.11. Før dette flettes: deploy-portal-instance på kasse må kunne 1.0 (StateDirectory-innslaget og DHD_TOKENS med hashen av LOAD_TOKEN), og hemmeligheten LOAD_TOKEN må finnes her. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01L5fbDjRr9xfrtcDzcdJNr2
This commit is contained in:
2 files changed
+48
-12
No files matched your search
@@ -5,8 +5,10 @@ name: Deploy instance
|
|||||||
# PORTAL_RELEASE below pins the one this site runs, so every rollout is
|
# PORTAL_RELEASE below pins the one this site runs, so every rollout is
|
||||||
# a commit - auditable, and revertable by reverting it.
|
# a commit - auditable, and revertable by reverting it.
|
||||||
#
|
#
|
||||||
# Content-only changes never come through here: lint-and-reload
|
# Content-only changes never come through here: lint-and-reload asks
|
||||||
# hot-swaps those into the running instance over NATS.
|
# the running site to load them (POST /dhd/1/load). Portal 1.0 keeps
|
||||||
|
# everything the site has in one file of its own, in the unit's
|
||||||
|
# StateDirectory, and starts with an empty store: no NATS.
|
||||||
#
|
#
|
||||||
# Runs on the host runner, because a deploy has to touch this host's
|
# Runs on the host runner, because a deploy has to touch this host's
|
||||||
# filesystem and its units. It is allowed exactly one root action:
|
# filesystem and its units. It is allowed exactly one root action:
|
||||||
@@ -24,7 +26,7 @@ on:
|
|||||||
- .gitea/workflows/deploy.yml
|
- .gitea/workflows/deploy.yml
|
||||||
|
|
||||||
env:
|
env:
|
||||||
PORTAL_RELEASE: v0.13.0
|
PORTAL_RELEASE: v1.0.0-rc.11
|
||||||
INSTANCE: klingenberg-portal
|
INSTANCE: klingenberg-portal
|
||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
|
|||||||
@@ -1,21 +1,55 @@
|
|||||||
|
# Lint on the kasse host runner with the portal release this site runs,
|
||||||
|
# then ask the running site to load the commit that passed (POST
|
||||||
|
# /dhd/1/load, with the token the site knows the hash of).
|
||||||
|
#
|
||||||
|
# Needs, in Settings -> Actions: secret LOAD_TOKEN, and its SHA-256 in
|
||||||
|
# the site's DHD_TOKENS as `<sha256>=load` (the instance's env on kasse).
|
||||||
name: lint-and-reload
|
name: lint-and-reload
|
||||||
on:
|
on:
|
||||||
push:
|
push:
|
||||||
branches: [main]
|
branches: [main]
|
||||||
|
pull_request:
|
||||||
|
|
||||||
|
env:
|
||||||
|
# The portal this site runs (PORTAL_RELEASE in deploy.yml).
|
||||||
|
PORTAL_RELEASE: v1.0.0-rc.11
|
||||||
|
PUBLIC_URL: https://klingenbergbygg.no
|
||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
lint:
|
lint:
|
||||||
runs-on: fish
|
runs-on: fish
|
||||||
steps:
|
steps:
|
||||||
- name: checkout
|
- name: checkout
|
||||||
run: |
|
run: |
|
||||||
rm -rf checkout && git clone --depth 1 https://prosjekt.klingenbergbygg.no/klingenbergbygg/questions.git checkout
|
rm -rf checkout
|
||||||
# The lint is portal itself (`portal lint`), at the version this
|
git clone --depth 1 --branch "${{ github.head_ref || github.ref_name }}" https://prosjekt.klingenbergbygg.no/klingenbergbygg/questions.git checkout
|
||||||
# site runs (PORTAL_RELEASE in deploy.yml).
|
# iris is the lint alone, the same code as `portal lint` at a
|
||||||
|
# fifth the size, at the version this site runs: what passes here
|
||||||
|
# is what the running instance accepts.
|
||||||
- name: lint
|
- name: lint
|
||||||
env:
|
|
||||||
PORTAL_RELEASE: v0.13.0
|
|
||||||
run: |
|
run: |
|
||||||
curl -sfL "https://project.uhhm.no/uhhm/portal/releases/download/$PORTAL_RELEASE/portal-x86_64-linux" -o portal && chmod +x portal
|
curl -sfL "https://project.uhhm.no/uhhm/portal/releases/download/$PORTAL_RELEASE/portal-x86_64-linux-iris" -o iris && chmod +x iris
|
||||||
./portal lint --path checkout/questions
|
./iris check --path checkout/questions
|
||||||
- name: reload
|
|
||||||
run: nats --server nats://127.0.0.1:4222 pub portal.content.reload ""
|
reload:
|
||||||
|
runs-on: fish
|
||||||
|
needs: lint
|
||||||
|
if: github.event_name == 'push'
|
||||||
|
steps:
|
||||||
|
- name: Ask the site to load this commit
|
||||||
|
run: |
|
||||||
|
[ -n "${{ secrets.LOAD_TOKEN }}" ] || { echo "secret LOAD_TOKEN is not set yet: nothing to load"; exit 0; }
|
||||||
|
# The site says what it did, or why not, and that is printed.
|
||||||
|
# 422 is "never" (the content did not pass); anything else that
|
||||||
|
# is not 2xx is tried again for two minutes, since a push that
|
||||||
|
# also changes deploy.yml restarts the site on the way.
|
||||||
|
for try in 1 2 3 4 5 6 7 8 9 10 11 12; do
|
||||||
|
code=$(curl -sS -o reply.json -w "%{http_code}" -X POST "$PUBLIC_URL/dhd/1/load" \
|
||||||
|
-H "Authorization: Bearer ${{ secrets.LOAD_TOKEN }}" \
|
||||||
|
-H "Content-Type: application/json" \
|
||||||
|
-d '{"at": "${{ github.sha }}"}' || echo 000)
|
||||||
|
echo "$code $(cat reply.json 2>/dev/null)"
|
||||||
|
case "$code" in 2*) exit 0 ;; 422) exit 1 ;; esac
|
||||||
|
sleep 10
|
||||||
|
done
|
||||||
|
exit 1
|
||||||
Reference in new issue
Block a user