Evenfire is an intelligence layer platform for running LLM agents that take real actions, on your infrastructure
TypeScript
build: guard local package Docker consumers
Alfredo Lopezd45b4e3ba2f1
diff --git a/.github/workflows/ci-public.yml b/.github/workflows/ci-public.ymlindex bbeaf50db..18daf933c 100644--- a/.github/workflows/ci-public.yml+++ b/.github/workflows/ci-public.yml@@ -420,6 +420,9 @@ jobs:- name: Test the ghcr render guardrun: bash scripts/tests/test-ghcr-render-guard.sh+ - name: Test Docker local-package COPY and materialization contract+ run: bash scripts/tests/test-dockerfile-local-packages.sh+- name: Test the minikube image pullerrun: bash scripts/tests/test-minikube-pull-images.shdiff --git a/control-api/Dockerfile.dockerignore b/control-api/Dockerfile.dockerignoreindex de5d78a72..fae00af40 100644--- a/control-api/Dockerfile.dockerignore+++ b/control-api/Dockerfile.dockerignore@@ -6,6 +6,14 @@!packages/image-policy/**!packages/display-field/!packages/display-field/**+!packages/llm-providers/+!packages/llm-providers/**+!packages/workflow-runtime-core/+!packages/workflow-runtime-core/package.json+!packages/workflow-runtime-core/package-lock.json+!packages/workflow-runtime-core/tsconfig.json+!packages/workflow-runtime-core/src/+!packages/workflow-runtime-core/src/**!control-api/!control-api/package.json!control-api/package-lock.jsondiff --git a/control-api/package-lock.json b/control-api/package-lock.jsonindex 4909e8d74..55d9289fc 100644--- a/control-api/package-lock.json+++ b/control-api/package-lock.json@@ -1,12 +1,12 @@{"name": "clerum-control-api",- "version": "0.1.453",+ "version": "0.1.454","lockfileVersion": 3,"requires": true,"packages": {"": {"name": "clerum-control-api",- "version": "0.1.453",+ "version": "0.1.454","dependencies": {"@clerum/display-field": "file:../packages/display-field","@clerum/image-policy": "file:../packages/image-policy",diff --git a/control-api/package.json b/control-api/package.jsonindex 8b1d19751..b93ab5c7c 100644--- a/control-api/package.json+++ b/control-api/package.json@@ -1,6 +1,6 @@{"name": "clerum-control-api",- "version": "0.1.453",+ "version": "0.1.454","description": "Internal Clerum control plane REST API + UI for managing CRDs and secrets","main": "dist/main.js","engines": {diff --git a/control-ui/Dockerfile.dockerignore b/control-ui/Dockerfile.dockerignoreindex 04c4c4036..34c0fc163 100644--- a/control-ui/Dockerfile.dockerignore+++ b/control-ui/Dockerfile.dockerignore@@ -4,6 +4,8 @@!packages/workflow-recipe-capability-policy/**!packages/display-field/!packages/display-field/**+!packages/llm-providers/+!packages/llm-providers/**!scripts/!scripts/qa-recorder/!scripts/qa-recorder/loadEnv.tsdiff --git a/control-ui/package-lock.json b/control-ui/package-lock.jsonindex c13f55af8..0661c711b 100644--- a/control-ui/package-lock.json+++ b/control-ui/package-lock.json@@ -1,12 +1,12 @@{"name": "clerum-control-ui",- "version": "0.1.429",+ "version": "0.1.430","lockfileVersion": 3,"requires": true,"packages": {"": {"name": "clerum-control-ui",- "version": "0.1.429",+ "version": "0.1.430","dependencies": {"@clerum/display-field": "file:../packages/display-field","@clerum/llm-providers": "file:../packages/llm-providers",diff --git a/control-ui/package.json b/control-ui/package.jsonindex 7d452ef69..ac5504573 100644--- a/control-ui/package.json+++ b/control-ui/package.json@@ -1,6 +1,6 @@{"name": "clerum-control-ui",- "version": "0.1.429",+ "version": "0.1.430","private": true,"scripts": {"dev": "NEXT_IGNORE_INCORRECT_LOCKFILE=1 next dev",diff --git a/scripts/tests/test-dockerfile-local-packages.sh b/scripts/tests/test-dockerfile-local-packages.shnew file mode 100755index 000000000..10f5e6e95--- /dev/null+++ b/scripts/tests/test-dockerfile-local-packages.sh@@ -0,0 +1,140 @@+#!/usr/bin/env bash+set -euo pipefail++# Contract for Docker builds that consume workspace packages through+# `file:../packages/*`. A package must be in the build context before the+# npm install that resolves it. Next.js builds additionally require a real+# node_modules copy because its bundler does not reliably follow workspace+# symlinks.++REPO_ROOT="$(cd "$(dirname "${BASH_SOURCE[0]}")/../.." && pwd)"+failures=0++fail() {+ echo "FAIL: $*" >&2+ failures=$((failures + 1))+}++line_of_first() {+ local file="$1"+ local pattern="$2"+ awk -v pattern="$pattern" 'index($0, pattern) { print NR; exit }' "$file"+}++line_of_last() {+ local file="$1"+ local pattern="$2"+ awk -v pattern="$pattern" 'index($0, pattern) { line=NR } END { if (line) print line }' "$file"+}++assert_copy_before_first_ci() {+ local file="$1"+ local package="$2"+ local copy_line ci_line+ copy_line="$(line_of_first "$REPO_ROOT/$file" "COPY packages/$package")"+ ci_line="$(line_of_first "$REPO_ROOT/$file" "RUN npm ci")"+ if [[ -z "$copy_line" || -z "$ci_line" || "$copy_line" -ge "$ci_line" ]]; then+ fail "$file must COPY packages/$package before its first npm ci"+ fi+}++assert_copy_before_every_ci() {+ local file="$1"+ local packages=(${@:2})+ local current_stage=0+ local copied=""+ local line_no=0+ local line package++ while IFS= read -r line; do+ line_no=$((line_no + 1))+ if [[ "$line" == FROM\ * ]]; then+ current_stage=$((current_stage + 1))+ copied=""+ continue+ fi+ for package in "${packages[@]}"; do+ if [[ "$line" == "COPY packages/$package"* ]]; then+ copied="$copied|$package|"+ fi+ done+ if [[ "$line" == "RUN npm ci"* ]]; then+ for package in "${packages[@]}"; do+ if [[ "$copied" != *"|$package|"* ]]; then+ fail "$file stage $current_stage must COPY packages/$package before npm ci at line $line_no"+ fi+ done+ fi+ done < "$REPO_ROOT/$file"+}++assert_copy_before_last_ci() {+ local file="$1"+ local package="$2"+ local copy_line ci_line+ copy_line="$(line_of_last "$REPO_ROOT/$file" "COPY packages/$package")"+ ci_line="$(line_of_last "$REPO_ROOT/$file" "RUN npm ci")"+ if [[ -z "$copy_line" || -z "$ci_line" || "$copy_line" -ge "$ci_line" ]]; then+ fail "$file must COPY packages/$package before its last npm ci"+ fi+}++assert_materialized() {+ local file="$1"+ local package="$2"+ local expected="cp -R ../packages/$package node_modules/@clerum/$package"+ if ! grep -Fq "$expected" "$REPO_ROOT/$file"; then+ fail "$file must materialize @clerum/$package in node_modules"+ fi+}++assert_dockerignore_allows() {+ local file="$1"+ local package="$2"+ local ignore="$REPO_ROOT/$file"+ if ! grep -Fq "!packages/$package/" "$ignore" || \+ ! grep -Fq "!packages/$package/**" "$ignore"; then+ fail "$file must explicitly allow packages/$package in its Docker context"+ fi+}++# Direct consumers. The first four are Node services; profile-ui and+# control-ui are Next.js consumers and therefore also require materialization.+assert_copy_before_every_ci control-api/Dockerfile \+ display-field image-policy llm-providers workflow-recipe-capability-policy workflow-runtime-core+assert_copy_before_every_ci control-ui/Dockerfile \+ display-field llm-providers workflow-recipe-capability-policy+assert_copy_before_every_ci profile-ui/Dockerfile desktop-app-links+assert_copy_before_every_ci host-context-controller/Dockerfile \+ image-policy llm-providers network-policy-core workflow-recipe-capability-policy+assert_copy_before_every_ci mcp-host/Dockerfile llm-providers+assert_copy_before_every_ci mcp-host/Dockerfile.desktop llm-providers+assert_copy_before_every_ci mcp-host/Dockerfile.full llm-providers+assert_copy_before_every_ci mcp-host/Dockerfile.slim llm-providers++# workflow-runtime-core is built in a separate stage before workflow-recipes;+# these are the packages needed by that stage, while the application install+# also needs the recipe and image policy packages in its final stage.+assert_copy_before_every_ci workflow-recipes/Dockerfile llm-providers network-policy-core workflow-runtime-core+assert_copy_before_every_ci workflow-recipes/Dockerfile.coordinator llm-providers network-policy-core workflow-runtime-core+assert_copy_before_last_ci workflow-recipes/Dockerfile workflow-recipe-capability-policy+assert_copy_before_last_ci workflow-recipes/Dockerfile image-policy+assert_copy_before_last_ci workflow-recipes/Dockerfile.coordinator workflow-recipe-capability-policy+assert_copy_before_last_ci workflow-recipes/Dockerfile.coordinator image-policy++assert_materialized control-ui/Dockerfile display-field+assert_materialized control-ui/Dockerfile llm-providers+assert_materialized control-ui/Dockerfile workflow-recipe-capability-policy+assert_materialized profile-ui/Dockerfile desktop-app-links++assert_dockerignore_allows control-api/Dockerfile.dockerignore display-field+assert_dockerignore_allows control-api/Dockerfile.dockerignore llm-providers+assert_dockerignore_allows control-ui/Dockerfile.dockerignore display-field+assert_dockerignore_allows control-ui/Dockerfile.dockerignore llm-providers++if (( failures > 0 )); then+ echo "$failures Docker local-package contract failure(s)" >&2+ exit 1+fi++echo "PASS: Docker local-package COPY/npm ci/materialization contract"