interplane.Get Omega
Read in your language

omnet

aien-dev/omnet

Brought by drakestapleton

branch main Branches Tags History

omnet / integration / e2e / build-clients.sh

44 lines · 2001 bytes Raw Blame History
1#!/bin/sh
2# Test-only dependency acquisition. Run from any directory:
3# GO=/path/to/go GOTOOLCHAIN=auto sh integration/e2e/build-clients.sh
4# Builds unmodified tailscale.com v1.102.0 from the checksum-verified Go module.
5# The module proxy/checksum database and Go toolchain download require network;
6# the lifecycle runner creates an isolated network namespace without egress.
7set -eu
8ROOT=$(CDPATH= cd -- "$(dirname -- "$0")/../.." && pwd)
9GO=${GO:-go}
10OUT=${E2E_BIN_DIR:-"$ROOT/build/e2e"}
11mkdir -p "$OUT"
12OUT=$(CDPATH= cd -- "$OUT" && pwd)
13export GOTOOLCHAIN=${GOTOOLCHAIN:-auto}
14export GO111MODULE=on
15"$GO" mod download -json tailscale.com@v1.102.0 > "$OUT/tailscale-module.json"
16SRC=$(python3 - "$OUT/tailscale-module.json" <<'PY'
17import json, sys
18m = json.load(open(sys.argv[1]))
19if m.get('Error') or m.get('Version') != 'v1.102.0' or not m.get('Sum'):
20 raise SystemExit('pinned Tailscale module acquisition failed')
21origin = m.get('Origin', {})
22if origin and origin.get('Hash') != '35283c95445fb198af1ce708dac05714bdfaa037':
23 raise SystemExit('unexpected Tailscale v1.102.0 source revision')
24print(m['Dir'])
25PY
26)
27(cd "$SRC" && "$GO" build -trimpath -buildvcs=false -o "$OUT/tailscale" ./cmd/tailscale)
28(cd "$SRC" && "$GO" build -trimpath -buildvcs=false -o "$OUT/tailscaled" ./cmd/tailscaled)
29"$GO" version -m "$OUT/tailscale" > "$OUT/tailscale.buildinfo"
30"$GO" version -m "$OUT/tailscaled" > "$OUT/tailscaled.buildinfo"
31python3 - "$OUT" <<'PY'
32import hashlib, json, pathlib, sys
33out = pathlib.Path(sys.argv[1])
34module = json.loads((out / 'tailscale-module.json').read_text())
35manifest = {
36 'version': 'v1.102.0',
37 'source_revision': '35283c95445fb198af1ce708dac05714bdfaa037',
38 'module_sum': module['Sum'],
39 'sha256': {name: hashlib.sha256((out / name).read_bytes()).hexdigest()
40 for name in ('tailscale', 'tailscaled')},
41}
42(out / 'stock-client.json').write_text(json.dumps(manifest, indent=2) + '\n')
43PY
44printf 'Built stock v1.102.0 clients in %s\n' "$OUT"