Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions .github/workflows/ci.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -50,8 +50,8 @@ jobs:

- name: Assert committed inlined yamls match templates + scripts
run: |
make inlined-yaml-files
make inline
if ! git diff --exit-code inlined/; then
echo "::error::inlined/*.yaml is stale -- run 'make inlined-yaml-files' and commit the result"
echo "::error::inlined/*.yaml is stale -- run 'make inline' and commit the result"
exit 1
fi
2 changes: 1 addition & 1 deletion .github/workflows/release.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ jobs:
uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1

- name: Regenerate inlined yamls
run: make inlined-yaml-files
run: make inline

- name: Restore cached binaries
uses: actions/download-artifact@3e5f45b2cfb9172054b4087a40e8e0b5a5461e7c # v8.0.1
Expand Down
9 changes: 1 addition & 8 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -55,13 +55,6 @@ BREAD_NET=publish spread # force port-publishing (e.g. to test the macOS path
BREAD_NET=bridge spread # force bridge IPs
```

one more macOS gotcha: spread packs the project with the host `tar`, and macOS `tar` injects `._*` AppleDouble sidecar files (resource-fork metadata) into the archive. they unpack as real files in the container and can break tools that scan for `*.yaml` etc. export `COPYFILE_DISABLE=1` so macOS `tar` skips them:

```
export COPYFILE_DISABLE=1
spread
```

## install spread

prefer a precompiled spread CLI over `go install`? same release ships statically-linked binaries for linux amd64 / arm64 / s390x / ppc64le:
Expand Down Expand Up @@ -137,7 +130,7 @@ make build-bread-chisel-releases ARCH=arm64
regenerate distribution yamls (already committed under `inlined/`, but regenerate after script edits):

```
make inlined-yaml-files
make inline
```

run the demo (LTS systems only -- 24.04 + 26.04 x amd64 / arm64). builds the required `bread` images first if missing:
Expand Down
13 changes: 13 additions & 0 deletions demo/spread.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,19 @@ exclude:
- .git
- .github

# macOS tar packs an AppleDouble `._*` sidecar next to every file; they unpack as
# real files on the remote. `exclude:` can't drop them (tar synthesises them below
# its glob filter), so extract and repack with COPYFILE_DISABLE=1.
repack: |
if [ "$(uname -s)" = Darwin ]; then
tmp=$(mktemp -d)
trap 'rm -rf "$tmp"' EXIT
tar -xf - -C "$tmp" <&3
( cd "$tmp" && shopt -s dotglob && COPYFILE_DISABLE=1 tar -cf - -- * ) >&4
else
cat <&3 >&4
fi

backends:
docker:
type: adhoc
Expand Down
7 changes: 3 additions & 4 deletions hack/inline_scripts.rb
Original file line number Diff line number Diff line change
@@ -1,13 +1,12 @@
#!/usr/bin/env ruby
# Inline `source scripts/<name>.sh` references inside spread yaml templates.
#
# For each line matching `allocate: source scripts/<name>.sh` or
# `discard: source scripts/<name>.sh`, substitute the script's content as a
# yaml block scalar under the matching key.
# For each line matching `<key>: source scripts/<name>.sh`, substitute the
# script's content as a yaml block scalar under the matching key.

require "fileutils"

LINE_RE = /\A(?<indent>\s*)(?<key>allocate|discard):\s*source\s+(?<path>scripts\/[\w.-]+\.sh)\s*\z/
LINE_RE = /\A(?<indent>\s*)(?<key>allocate|discard|repack):\s*source\s+(?<path>scripts\/[\w.-]+\.sh)\s*\z/

def inline_scripts(content, yaml_indent: 2)
out = []
Expand Down
12 changes: 12 additions & 0 deletions inlined/bread-22.04.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,18 @@ exclude:
- .git
- .github

repack: |
# macOS tar packs an AppleDouble ._* sidecar next to every file; they unpack as
# real files on the remote. Repack to remove them.
if [ "$(uname -s)" = Darwin ]; then
tmp=$(mktemp -d)
trap 'rm -rf "$tmp"' EXIT
tar -xf - -C "$tmp" <&3
( cd "$tmp" && shopt -s dotglob && COPYFILE_DISABLE=1 tar -cf - -- * ) >&4
else
cat <&3 >&4
fi

backends:
docker:
type: adhoc
Expand Down
12 changes: 12 additions & 0 deletions inlined/bread-24.04.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,18 @@ exclude:
- .git
- .github

repack: |
# macOS tar packs an AppleDouble ._* sidecar next to every file; they unpack as
# real files on the remote. Repack to remove them.
if [ "$(uname -s)" = Darwin ]; then
tmp=$(mktemp -d)
trap 'rm -rf "$tmp"' EXIT
tar -xf - -C "$tmp" <&3
( cd "$tmp" && shopt -s dotglob && COPYFILE_DISABLE=1 tar -cf - -- * ) >&4
else
cat <&3 >&4
fi

backends:
docker:
type: adhoc
Expand Down
12 changes: 12 additions & 0 deletions inlined/bread-25.10.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,18 @@ exclude:
- .git
- .github

repack: |
# macOS tar packs an AppleDouble ._* sidecar next to every file; they unpack as
# real files on the remote. Repack to remove them.
if [ "$(uname -s)" = Darwin ]; then
tmp=$(mktemp -d)
trap 'rm -rf "$tmp"' EXIT
tar -xf - -C "$tmp" <&3
( cd "$tmp" && shopt -s dotglob && COPYFILE_DISABLE=1 tar -cf - -- * ) >&4
else
cat <&3 >&4
fi

backends:
docker:
type: adhoc
Expand Down
12 changes: 12 additions & 0 deletions inlined/bread-26.04.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,18 @@ exclude:
- .git
- .github

repack: |
# macOS tar packs an AppleDouble ._* sidecar next to every file; they unpack as
# real files on the remote. Repack to remove them.
if [ "$(uname -s)" = Darwin ]; then
tmp=$(mktemp -d)
trap 'rm -rf "$tmp"' EXIT
tar -xf - -C "$tmp" <&3
( cd "$tmp" && shopt -s dotglob && COPYFILE_DISABLE=1 tar -cf - -- * ) >&4
else
cat <&3 >&4
fi

backends:
docker:
type: adhoc
Expand Down
12 changes: 12 additions & 0 deletions inlined/bread-26.10.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,18 @@ exclude:
- .git
- .github

repack: |
# macOS tar packs an AppleDouble ._* sidecar next to every file; they unpack as
# real files on the remote. Repack to remove them.
if [ "$(uname -s)" = Darwin ]; then
tmp=$(mktemp -d)
trap 'rm -rf "$tmp"' EXIT
tar -xf - -C "$tmp" <&3
( cd "$tmp" && shopt -s dotglob && COPYFILE_DISABLE=1 tar -cf - -- * ) >&4
else
cat <&3 >&4
fi

backends:
docker:
type: adhoc
Expand Down
12 changes: 12 additions & 0 deletions inlined/bread-chisel-releases-22.04.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,18 @@ exclude:
- work
- rootfs

repack: |
# macOS tar packs an AppleDouble ._* sidecar next to every file; they unpack as
# real files on the remote. Repack to remove them.
if [ "$(uname -s)" = Darwin ]; then
tmp=$(mktemp -d)
trap 'rm -rf "$tmp"' EXIT
tar -xf - -C "$tmp" <&3
( cd "$tmp" && shopt -s dotglob && COPYFILE_DISABLE=1 tar -cf - -- * ) >&4
else
cat <&3 >&4
fi

backends:
docker:
type: adhoc
Expand Down
12 changes: 12 additions & 0 deletions inlined/bread-chisel-releases-24.04.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,18 @@ exclude:
- work
- rootfs

repack: |
# macOS tar packs an AppleDouble ._* sidecar next to every file; they unpack as
# real files on the remote. Repack to remove them.
if [ "$(uname -s)" = Darwin ]; then
tmp=$(mktemp -d)
trap 'rm -rf "$tmp"' EXIT
tar -xf - -C "$tmp" <&3
( cd "$tmp" && shopt -s dotglob && COPYFILE_DISABLE=1 tar -cf - -- * ) >&4
else
cat <&3 >&4
fi

backends:
docker:
type: adhoc
Expand Down
12 changes: 12 additions & 0 deletions inlined/bread-chisel-releases-25.10.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,18 @@ exclude:
- work
- rootfs

repack: |
# macOS tar packs an AppleDouble ._* sidecar next to every file; they unpack as
# real files on the remote. Repack to remove them.
if [ "$(uname -s)" = Darwin ]; then
tmp=$(mktemp -d)
trap 'rm -rf "$tmp"' EXIT
tar -xf - -C "$tmp" <&3
( cd "$tmp" && shopt -s dotglob && COPYFILE_DISABLE=1 tar -cf - -- * ) >&4
else
cat <&3 >&4
fi

backends:
docker:
type: adhoc
Expand Down
12 changes: 12 additions & 0 deletions inlined/bread-chisel-releases-26.04.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,18 @@ exclude:
- work
- rootfs

repack: |
# macOS tar packs an AppleDouble ._* sidecar next to every file; they unpack as
# real files on the remote. Repack to remove them.
if [ "$(uname -s)" = Darwin ]; then
tmp=$(mktemp -d)
trap 'rm -rf "$tmp"' EXIT
tar -xf - -C "$tmp" <&3
( cd "$tmp" && shopt -s dotglob && COPYFILE_DISABLE=1 tar -cf - -- * ) >&4
else
cat <&3 >&4
fi

backends:
docker:
type: adhoc
Expand Down
12 changes: 12 additions & 0 deletions inlined/bread-chisel-releases-26.10.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,18 @@ exclude:
- work
- rootfs

repack: |
# macOS tar packs an AppleDouble ._* sidecar next to every file; they unpack as
# real files on the remote. Repack to remove them.
if [ "$(uname -s)" = Darwin ]; then
tmp=$(mktemp -d)
trap 'rm -rf "$tmp"' EXIT
tar -xf - -C "$tmp" <&3
( cd "$tmp" && shopt -s dotglob && COPYFILE_DISABLE=1 tar -cf - -- * ) >&4
else
cat <&3 >&4
fi

backends:
docker:
type: adhoc
Expand Down
8 changes: 4 additions & 4 deletions makefile
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ help: ## Show this help
awk 'BEGIN {FS = ":.*?## "}; {printf "\033[36m%-40s\033[0m %s\n", $$1, $$2}'

.PHONY: all
all: build-all inlined-yaml-files ## Build all images + generate inlined yamls
all: build-all inline ## Build all images + generate inlined yamls

.PHONY: build-all
build-all: build-bread build-bread-chisel-releases ## Build all images (narrow via VER=... ARCH=...)
Expand Down Expand Up @@ -84,7 +84,7 @@ SPREAD_ARGS ?=
TEST_STAMPS := .stamp/bread-test-26.04-$(SELECTED_ARCH) \
$(foreach v,$(VERSIONS),.stamp/bread-$(v)-$(SELECTED_ARCH) .stamp/bread-chisel-releases-$(v)-$(SELECTED_ARCH))
.PHONY: test
test: $(TEST_STAMPS) inlined-yaml-files ## Run the spread test suite (host arch; ARCH=... to override, SPREAD_ARGS=... for flags)
test: $(TEST_STAMPS) inline ## Run the spread test suite (host arch; ARCH=... to override, SPREAD_ARGS=... for flags)
cd tests && spread $(SPREAD_ARGS) outer:ubuntu-26.04-$(SELECTED_ARCH)

.PHONY: check-base
Expand All @@ -102,8 +102,8 @@ DEMO_STAMPS := $(foreach a,$(NATIVE_ARCHES),.stamp/bread-24.04-$(a) .stamp/bread
demo: $(DEMO_STAMPS) ## Run the spread demo on LTS systems (24.04 + 26.04, native arches)
$(MAKE) -C demo run

.PHONY: inlined-yaml-files
inlined-yaml-files: $(INLINED) ## Generate inlined/*.yaml from templates/*.yaml.in
.PHONY: inline
inline: $(INLINED) ## Generate inlined/*.yaml from templates/*.yaml.in

# Hash-stamp pattern: stamp file contents = hash of all inputs that affect
# this image. FORCE-dep makes us recompute hash each run; stamp content only
Expand Down
10 changes: 10 additions & 0 deletions scripts/spread_repack_bread.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
# macOS tar packs an AppleDouble ._* sidecar next to every file; they unpack as
# real files on the remote. Repack to remove them.
if [ "$(uname -s)" = Darwin ]; then
tmp=$(mktemp -d)
trap 'rm -rf "$tmp"' EXIT
tar -xf - -C "$tmp" <&3
( cd "$tmp" && shopt -s dotglob && COPYFILE_DISABLE=1 tar -cf - -- * ) >&4
else
cat <&3 >&4
fi
2 changes: 2 additions & 0 deletions templates/bread-22.04.yaml.in
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,8 @@ exclude:
- .git
- .github

repack: source scripts/spread_repack_bread.sh

backends:
docker:
type: adhoc
Expand Down
2 changes: 2 additions & 0 deletions templates/bread-24.04.yaml.in
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,8 @@ exclude:
- .git
- .github

repack: source scripts/spread_repack_bread.sh

backends:
docker:
type: adhoc
Expand Down
2 changes: 2 additions & 0 deletions templates/bread-25.10.yaml.in
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,8 @@ exclude:
- .git
- .github

repack: source scripts/spread_repack_bread.sh

backends:
docker:
type: adhoc
Expand Down
2 changes: 2 additions & 0 deletions templates/bread-26.04.yaml.in
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,8 @@ exclude:
- .git
- .github

repack: source scripts/spread_repack_bread.sh

backends:
docker:
type: adhoc
Expand Down
2 changes: 2 additions & 0 deletions templates/bread-26.10.yaml.in
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,8 @@ exclude:
- .git
- .github

repack: source scripts/spread_repack_bread.sh

backends:
docker:
type: adhoc
Expand Down
2 changes: 2 additions & 0 deletions templates/bread-chisel-releases-22.04.yaml.in
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,8 @@ exclude:
- work
- rootfs

repack: source scripts/spread_repack_bread.sh

backends:
docker:
type: adhoc
Expand Down
2 changes: 2 additions & 0 deletions templates/bread-chisel-releases-24.04.yaml.in
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,8 @@ exclude:
- work
- rootfs

repack: source scripts/spread_repack_bread.sh

backends:
docker:
type: adhoc
Expand Down
2 changes: 2 additions & 0 deletions templates/bread-chisel-releases-25.10.yaml.in
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,8 @@ exclude:
- work
- rootfs

repack: source scripts/spread_repack_bread.sh

backends:
docker:
type: adhoc
Expand Down
2 changes: 2 additions & 0 deletions templates/bread-chisel-releases-26.04.yaml.in
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,8 @@ exclude:
- work
- rootfs

repack: source scripts/spread_repack_bread.sh

backends:
docker:
type: adhoc
Expand Down
2 changes: 2 additions & 0 deletions templates/bread-chisel-releases-26.10.yaml.in
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,8 @@ exclude:
- work
- rootfs

repack: source scripts/spread_repack_bread.sh

backends:
docker:
type: adhoc
Expand Down
Loading