Skip to content

docs(ns8): install from :edge; :latest is still the unusable first build #76

docs(ns8): install from :edge; :latest is still the unusable first build

docs(ns8): install from :edge; :latest is still the unusable first build #76

Workflow file for this run

name: NS8 module publish
# Builds the ns8-calnode module image from packaging/ns8. The module is a thin
# wrapper: this image carries configuration scripts and the settings UI, while
# the Calnode app itself is pulled from its own registry at install time.
# * PR → validate + build only. Nothing is pushed.
# * push to dev → push `:dev`, running app `:dev`.
# * push to main → push `:edge`, running app `:edge` (`:latest` stays
# pinned to releases, mirroring docker-publish.yml).
# * push a `vX.Y.Z` tag → push `:X.Y.Z`, `:X.Y` and `:latest`, running app
# `:X.Y.Z`. Module and app tags move together, so a
# module release can never point at the wrong app.
on:
push:
branches: [main, dev]
tags: ['v*.*.*']
pull_request:
concurrency:
group: ns8-module-${{ github.ref }}
cancel-in-progress: true
jobs:
validate:
runs-on: ubuntu-latest
timeout-minutes: 10
permissions:
contents: read
steps:
- uses: actions/checkout@v7
- name: Validate action scripts and schemas
working-directory: packaging/ns8
run: |
python3 -m py_compile imageroot/actions/configure-module/20configure imageroot/actions/get-configuration/20read
python3 -c "import json, glob; [json.load(open(f)) for f in glob.glob('imageroot/actions/*/*.json') + glob.glob('ui/public/*.json') + ['ui/public/i18n/en/translation.json']]"
bash -n imageroot/actions/configure-module/80start_services
bash -n build-images.sh
bash -n push-manifest.sh
# Every buildah subcommand the scripts invoke must be a real one.
# A typo like "buildah image exists" (there is no singular form)
# only surfaces after a full two-arch build, minutes into a publish.
# This runner has buildah preinstalled, so check it here instead.
for sub in $(grep -ohE 'buildah [a-z]+' build-images.sh push-manifest.sh | awk '{print $2}' | sort -u); do
if ! buildah "$sub" --help >/dev/null 2>&1; then
echo "::error::buildah has no subcommand '$sub' used by the build scripts"
exit 1
fi
done
# No build-time placeholders may remain: the unit and configure read
# the app ref from ${CALNODE_IMAGE} at install time.
! grep -rn '__CALNODE_APP_IMAGE__' imageroot/
# Action scripts must be committed executable: the agent silently
# skips non-executable files, and fileMode=false checkouts do not
# record chmod, so assert the indexed modes, not just the worktree.
# The non-empty assertion matters: the awk below exits 0 on empty
# input, so a pathspec that stops matching would pass vacuously.
scripts=$(git ls-files -s -- imageroot/actions | grep -v 'validate-.*\.json$')
if [ -z "$scripts" ]; then
echo "::error::no action scripts matched, the exec-bit check below would pass vacuously"
exit 1
fi
echo "$scripts" | awk '$1!="100755" {print "not executable in index:", $4; bad=1} END{exit bad}'
build:
needs: validate
runs-on: ubuntu-latest
timeout-minutes: 45
permissions:
contents: read
packages: write
steps:
- uses: actions/checkout@v7
# Required to build the arm64 variant of the module image on an amd64
# runner. Without it the module image would be amd64-only and podman
# could not run it on an arm64 NS8 node.
- uses: docker/setup-qemu-action@v4
with:
platforms: all
# The UI build is the slow part; cache the dependency tree the way the
# upstream NS8 publish workflow does, so branch and PR runs do not
# re-download the whole Vue/Carbon tree every time.
- uses: actions/cache@v4
with:
path: packaging/ns8/ui/node_modules
key: "yarn-${{ hashFiles('packaging/ns8/ui/yarn.lock') }}"
# Mirror the app tagging in docker-publish.yml: release tags pin both
# images to the same version, branches track the moving app tags.
- name: Resolve tags
id: tags
env:
REF: ${{ github.ref }}
REF_NAME: ${{ github.ref_name }}
run: |
if [[ "${REF}" == refs/tags/v* ]]; then
version="${REF_NAME#v}"
echo "module_tags=${version} ${version%.*} latest" >> "$GITHUB_OUTPUT"
echo "app_image=ghcr.io/calnode/calnode:${version}" >> "$GITHUB_OUTPUT"
elif [[ "${REF}" == refs/heads/main ]]; then
echo "module_tags=edge" >> "$GITHUB_OUTPUT"
echo "app_image=ghcr.io/calnode/calnode:edge" >> "$GITHUB_OUTPUT"
elif [[ "${REF}" == refs/heads/dev ]]; then
echo "module_tags=dev" >> "$GITHUB_OUTPUT"
echo "app_image=ghcr.io/calnode/calnode:dev" >> "$GITHUB_OUTPUT"
else
echo "module_tags=build" >> "$GITHUB_OUTPUT"
echo "app_image=ghcr.io/calnode/calnode:edge" >> "$GITHUB_OUTPUT"
fi
- name: Log in to GHCR
if: github.event_name != 'pull_request'
uses: docker/login-action@v3
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
# buildah is preinstalled on the ubuntu runners, same as the upstream
# NS8 publish workflow assumes.
- name: Build each architecture
working-directory: packaging/ns8
env:
EVENT_NAME: ${{ github.event_name }}
ACTOR: ${{ github.actor }}
GHCR_TOKEN: ${{ secrets.GITHUB_TOKEN }}
REPOBASE: ghcr.io/${{ github.repository_owner }}
APP_IMAGE: ${{ steps.tags.outputs.app_image }}
IMAGETAGS: ${{ steps.tags.outputs.module_tags }}
run: |
push=0
if [ "$EVENT_NAME" != "pull_request" ]; then
push=1
buildah login -u "$ACTOR" --password-stdin ghcr.io <<<"$GHCR_TOKEN"
fi
# PUSH=1 publishes only the per-arch :build-<arch> tags. The public
# tags are assembled from them by the manifest step below.
for arch in amd64 arm64; do
PUSH="$push" TARGETARCH="$arch" bash build-images.sh
done
- name: Assemble and push the multi-arch manifest
if: github.event_name != 'pull_request'
working-directory: packaging/ns8
env:
REPOBASE: ghcr.io/${{ github.repository_owner }}
TARGETARCHES: "amd64 arm64"
IMAGETAGS: ${{ steps.tags.outputs.module_tags }}
run: bash push-manifest.sh