Last active
April 25, 2025 14:02
-
-
Save marvingreenberg/7a8ff8997e32d8e1a1f5a9450d3ea487 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
name=${ARTIFACTORY_USER:-$(whoami)} | |
OUTFILE="${name}.docker.sysinfo" | |
info() { printf "$*\n" >> "$OUTFILE"; } | |
err() { printf "$*\n" >&2; exit 1; } | |
[[ "tws-stack-deployment" != "$(basename "$(pwd)")" ]] && err "Run from tws-stack-deployment dir" | |
true >"$OUTFILE" | |
arch="$(uname -m)" | |
echo "Collecting system info" | |
info "=== System Information ===" | |
if [[ "$(uname -s)" = "Darwin" ]]; then | |
info "macOS Version: $(sw_vers -productVersion)" | |
info "macOS Name: $(sw_vers -productName)" | |
info "Architecture: $arch" | |
memory_gb=$(sysctl -n hw.memsize | awk '{print $1/1024/1024/1024}') | |
info "Total Memory: ${memory_gb} GB" | |
info "CPU Cores: $(sysctl -n hw.ncpu)" | |
total_disk=$(diskutil info / | grep "Container Total Space" | awk '{print $4, $5}') | |
[[ -z "$total_disk" ]] && total_disk=$(diskutil info / | grep "Total Size" | awk '{print $3, $4}') | |
info "Total Disk: $total_disk" | |
if [[ "$arch" = "arm64" ]]; then | |
rosetta_version=$(pkgutil --pkg-info com.apple.pkg.RosettaUpdateAuto 2>/dev/null | grep version | cut -d: -f2 | tr -d ' ') | |
info "Rosetta Version: ${rosetta_version:-Not Installed}" | |
# Check if rosetta enabled for containers | |
docker run --rm --platform linux/amd64 busybox uname -m 2>/dev/null | grep -q 'x86_64' & \ | |
info "Rosetta: enabled" || info "Rosetta: disabled for Docker" | |
fi | |
else | |
info "OS: $(uname -s)" | |
info "Architecture: $(uname -m)" | |
info "Memory: $(free -h | awk '/^Mem:/ {print $2}')" | |
info "CPU Cores: $(nproc)" | |
info "Disk: $(df -h / | awk 'NR==2 {print $2}')" | |
fi | |
info "\n=== Docker Desktop Information ===" | |
info "$(docker version --format '{{.Server.Platform.Name }}')" | |
info "Docker Engine: $(docker version --format '{{ .Server.Version }}')" | |
memory_b="$(docker info --format '{{ .MemTotal }}')" | |
info "Docker Memory: $(echo "$memory_b/1000/1000/1000" | bc) GB" | |
info "Docker CPUs: $(docker info --format '{{ .NCPU }}')" | |
sleep 1 | |
echo "Setting up for tests" | |
(exec >/dev/null 2>&1; kubectl config use docker-desktop; git stash; git co develop) | |
echo "Running tws-stack-deployment mail tests" | |
(exec >/dev/null 2>&1; killall kubectl; make -C deploy/mailman stop start ); sleep 20; | |
(exec >> $OUTFILE 2>&1; make -C deploy/mailman test stop ) | |
(exec >/dev/null 2>&1; git co '@{-1}'; git stash pop) | |
echo "Created $OUTFILE" >&2 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment