ci/release: More fixes
This commit is contained in:
parent
0cf7f7ee9c
commit
d13f4a8935
3 changed files with 121 additions and 14 deletions
|
|
@ -115,18 +115,30 @@ build() {
|
||||||
fi
|
fi
|
||||||
|
|
||||||
case $OS in
|
case $OS in
|
||||||
# macos)
|
macos)
|
||||||
# ;;
|
case $ARCH in
|
||||||
|
amd64)
|
||||||
|
RHOST=$TSTRUCT_MACOS_AMD64_BUILDER build_rhost_macos
|
||||||
|
;;
|
||||||
|
arm64)
|
||||||
|
RHOST=$TSTRUCT_MACOS_ARM64_BUILDER build_rhost_macos
|
||||||
|
;;
|
||||||
|
*)
|
||||||
|
warn "no builder for OS=$OS ARCH=$ARCH, building locally..."
|
||||||
|
build_local
|
||||||
|
;;
|
||||||
|
esac
|
||||||
|
;;
|
||||||
linux)
|
linux)
|
||||||
case $ARCH in
|
case $ARCH in
|
||||||
amd64)
|
amd64)
|
||||||
RHOST=$TSTRUCT_LINUX_AMD64_BUILDER build_rhost
|
RHOST=$TSTRUCT_LINUX_AMD64_BUILDER build_rhost_linux
|
||||||
;;
|
;;
|
||||||
arm64)
|
arm64)
|
||||||
RHOST=$TSTRUCT_LINUX_ARM64_BUILDER build_rhost
|
RHOST=$TSTRUCT_LINUX_ARM64_BUILDER build_rhost_linux
|
||||||
;;
|
;;
|
||||||
*)
|
*)
|
||||||
warn "no builder for OS=$OS, building locally..."
|
warn "no builder for OS=$OS ARCH=$ARCH, building locally..."
|
||||||
build_local
|
build_local
|
||||||
;;
|
;;
|
||||||
esac
|
esac
|
||||||
|
|
@ -148,7 +160,21 @@ build_local() {
|
||||||
sh_c ./ci/release/_build.sh
|
sh_c ./ci/release/_build.sh
|
||||||
}
|
}
|
||||||
|
|
||||||
build_rhost() {
|
build_rhost_macos() {
|
||||||
|
sh_c ssh "$RHOST" mkdir -p src
|
||||||
|
sh_c rsync --archive --human-readable --delete ./ "$RHOST:src/d2/"
|
||||||
|
sh_c ssh -tttt "$RHOST" "DRY_RUN=${DRY_RUN-} \
|
||||||
|
HW_BUILD_DIR=$HW_BUILD_DIR \
|
||||||
|
VERSION=$VERSION \
|
||||||
|
OS=$OS \
|
||||||
|
ARCH=$ARCH \
|
||||||
|
ARCHIVE=$ARCHIVE \
|
||||||
|
TERM=$TERM \
|
||||||
|
./src/d2/ci/release/_build.sh"
|
||||||
|
sh_c rsync --archive --human-readable "$RHOST:src/d2/$ARCHIVE" "$ARCHIVE"
|
||||||
|
}
|
||||||
|
|
||||||
|
build_rhost_linux() {
|
||||||
sh_c ssh "$RHOST" mkdir -p src
|
sh_c ssh "$RHOST" mkdir -p src
|
||||||
sh_c rsync --archive --human-readable --delete ./ "$RHOST:src/d2/"
|
sh_c rsync --archive --human-readable --delete ./ "$RHOST:src/d2/"
|
||||||
sh_c ssh -tttt "$RHOST" "DRY_RUN=${DRY_RUN-} \
|
sh_c ssh -tttt "$RHOST" "DRY_RUN=${DRY_RUN-} \
|
||||||
|
|
|
||||||
|
|
@ -75,8 +75,8 @@ create_rhosts() {
|
||||||
--instance-type=t2.small \
|
--instance-type=t2.small \
|
||||||
--security-groups=ssh \
|
--security-groups=ssh \
|
||||||
"--key-name=$KEY_NAME" \
|
"--key-name=$KEY_NAME" \
|
||||||
--tag-specifications 'ResourceType=instance,Tags=[{Key=Name,Value=d2-builder-linux-amd64}]' \
|
--tag-specifications '"ResourceType=instance,Tags=[{Key=Name,Value=d2-builder-linux-amd64}]"' \
|
||||||
'ResourceType=volume,Tags=[{Key=Name,Value=d2-builder-linux-amd64}]' >/dev/null
|
'"ResourceType=volume,Tags=[{Key=Name,Value=d2-builder-linux-amd64}]"' >/dev/null
|
||||||
fi
|
fi
|
||||||
while true; do
|
while true; do
|
||||||
dnsname=$(sh_c aws ec2 describe-instances \
|
dnsname=$(sh_c aws ec2 describe-instances \
|
||||||
|
|
@ -100,8 +100,8 @@ create_rhosts() {
|
||||||
--instance-type=t4g.small \
|
--instance-type=t4g.small \
|
||||||
--security-groups=ssh \
|
--security-groups=ssh \
|
||||||
"--key-name=$KEY_NAME" \
|
"--key-name=$KEY_NAME" \
|
||||||
--tag-specifications 'ResourceType=instance,Tags=[{Key=Name,Value=d2-builder-linux-arm64}]' \
|
--tag-specifications '"ResourceType=instance,Tags=[{Key=Name,Value=d2-builder-linux-arm64}]"' \
|
||||||
'ResourceType=volume,Tags=[{Key=Name,Value=d2-builder-linux-arm64}]' >/dev/null
|
'"ResourceType=volume,Tags=[{Key=Name,Value=d2-builder-linux-arm64}]"' >/dev/null
|
||||||
fi
|
fi
|
||||||
while true; do
|
while true; do
|
||||||
dnsname=$(sh_c aws ec2 describe-instances \
|
dnsname=$(sh_c aws ec2 describe-instances \
|
||||||
|
|
@ -114,18 +114,86 @@ create_rhosts() {
|
||||||
fi
|
fi
|
||||||
sleep 5
|
sleep 5
|
||||||
done
|
done
|
||||||
|
|
||||||
|
header "allocate macOS hosts"
|
||||||
|
if ! aws ec2 describe-hosts | grep -q mac1.metal; then
|
||||||
|
aws ec2 allocate-hosts --instance-type mac1.metal --quantity 1 --availability-zone us-west-2a
|
||||||
|
fi
|
||||||
|
if ! aws ec2 describe-hosts | grep -q mac2.metal; then
|
||||||
|
aws ec2 allocate-hosts --instance-type mac2.metal --quantity 1 --availability-zone us-west-2a
|
||||||
|
fi
|
||||||
|
|
||||||
|
header macos-amd64
|
||||||
|
if ! aws ec2 describe-instances \
|
||||||
|
"--query=Reservations[*].Instances[?State.Name!='terminated']" \
|
||||||
|
| grep -q d2-builder-macos-amd64; then
|
||||||
|
sh_c aws ec2 run-instances \
|
||||||
|
--image-id=ami-0dd2ded7568750663 \
|
||||||
|
--count=1 \
|
||||||
|
--instance-type=mac1.metal \
|
||||||
|
--security-groups=ssh \
|
||||||
|
"--key-name=$KEY_NAME" \
|
||||||
|
--placement 'Tenancy=host,HostId=h-0d881926de2e17555' \
|
||||||
|
--tag-specifications '"ResourceType=instance,Tags=[{Key=Name,Value=d2-builder-macos-amd64}]"' \
|
||||||
|
'"ResourceType=volume,Tags=[{Key=Name,Value=d2-builder-macos-amd64}]"' >/dev/null
|
||||||
|
fi
|
||||||
|
while true; do
|
||||||
|
dnsname=$(sh_c aws ec2 describe-instances \
|
||||||
|
--filters 'Name=instance-state-name,Values=pending,running,shutting-down,stopping,stopped' 'Name=tag:Name,Values=d2-builder-macos-amd64' \
|
||||||
|
| jq -r '.Reservations[].Instances[].PublicDnsName')
|
||||||
|
if [ -n "$dnsname" ]; then
|
||||||
|
log "TSTRUCT_MACOS_AMD64_BUILDER=ec2-user@$dnsname"
|
||||||
|
export TSTRUCT_MACOS_AMD64_BUILDER=ec2-user@$dnsname
|
||||||
|
break
|
||||||
|
fi
|
||||||
|
sleep 5
|
||||||
|
done
|
||||||
|
|
||||||
|
header macos-arm64
|
||||||
|
if ! aws ec2 describe-instances \
|
||||||
|
"--query=Reservations[*].Instances[?State.Name!='terminated']" \
|
||||||
|
| grep -q d2-builder-macos-arm64; then
|
||||||
|
sh_c aws ec2 run-instances \
|
||||||
|
--image-id=ami-0af0516ff2c43dbbe \
|
||||||
|
--count=1 \
|
||||||
|
--instance-type=mac2.metal \
|
||||||
|
--security-groups=ssh \
|
||||||
|
"--key-name=$KEY_NAME" \
|
||||||
|
--placement 'Tenancy=host,HostId=h-040b9305c2d64119d' \
|
||||||
|
--tag-specifications '"ResourceType=instance,Tags=[{Key=Name,Value=d2-builder-macos-arm64}]"' \
|
||||||
|
'"ResourceType=volume,Tags=[{Key=Name,Value=d2-builder-macos-arm64}]"' >/dev/null
|
||||||
|
fi
|
||||||
|
while true; do
|
||||||
|
dnsname=$(sh_c aws ec2 describe-instances \
|
||||||
|
--filters 'Name=instance-state-name,Values=pending,running,shutting-down,stopping,stopped' 'Name=tag:Name,Values=d2-builder-macos-arm64' \
|
||||||
|
| jq -r '.Reservations[].Instances[].PublicDnsName')
|
||||||
|
if [ -n "$dnsname" ]; then
|
||||||
|
log "TSTRUCT_MACOS_ARM64_BUILDER=ec2-user@$dnsname"
|
||||||
|
export TSTRUCT_MACOS_ARM64_BUILDER=ec2-user@$dnsname
|
||||||
|
break
|
||||||
|
fi
|
||||||
|
sleep 5
|
||||||
|
done
|
||||||
}
|
}
|
||||||
|
|
||||||
init_rhosts() {
|
init_rhosts() {
|
||||||
header linux-amd64
|
header linux-amd64
|
||||||
RHOST=$TSTRUCT_LINUX_AMD64_BUILDER init_rhost
|
RHOST=$TSTRUCT_LINUX_AMD64_BUILDER init_rhost_linux
|
||||||
header linux-arm64
|
header linux-arm64
|
||||||
RHOST=$TSTRUCT_LINUX_ARM64_BUILDER init_rhost
|
RHOST=$TSTRUCT_LINUX_ARM64_BUILDER init_rhost_linux
|
||||||
|
header macos-amd64
|
||||||
|
RHOST=$TSTRUCT_MACOS_AMD64_BUILDER init_rhost_macos
|
||||||
|
header macos-arm64
|
||||||
|
RHOST=$TSTRUCT_MACOS_ARM64_BUILDER init_rhost_macos
|
||||||
|
|
||||||
|
COLOR=2 header summary
|
||||||
log "export TSTRUCT_LINUX_AMD64_BUILDER=$TSTRUCT_LINUX_AMD64_BUILDER"
|
log "export TSTRUCT_LINUX_AMD64_BUILDER=$TSTRUCT_LINUX_AMD64_BUILDER"
|
||||||
log "export TSTRUCT_LINUX_ARM64_BUILDER=$TSTRUCT_LINUX_ARM64_BUILDER"
|
log "export TSTRUCT_LINUX_ARM64_BUILDER=$TSTRUCT_LINUX_ARM64_BUILDER"
|
||||||
|
log "export TSTRUCT_MACOS_AMD64_BUILDER=$TSTRUCT_MACOS_AMD64_BUILDER"
|
||||||
|
log "export TSTRUCT_MACOS_ARM64_BUILDER=$TSTRUCT_MACOS_ARM64_BUILDER"
|
||||||
}
|
}
|
||||||
|
|
||||||
init_rhost() {
|
init_rhost_linux() {
|
||||||
while true; do
|
while true; do
|
||||||
if sh_c ssh "$RHOST" :; then
|
if sh_c ssh "$RHOST" :; then
|
||||||
break
|
break
|
||||||
|
|
@ -140,4 +208,17 @@ init_rhost() {
|
||||||
sh_c ssh "$RHOST" 'sudo reboot' || true
|
sh_c ssh "$RHOST" 'sudo reboot' || true
|
||||||
}
|
}
|
||||||
|
|
||||||
|
init_rhost_macos() {
|
||||||
|
while true; do
|
||||||
|
if sh_c ssh "$RHOST" :; then
|
||||||
|
break
|
||||||
|
fi
|
||||||
|
sleep 5
|
||||||
|
done
|
||||||
|
sh_c ssh "$RHOST" '": | /bin/bash -c \"\$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)\""'
|
||||||
|
sh_c ssh "$RHOST" 'brew update'
|
||||||
|
sh_c ssh "$RHOST" 'brew upgrade'
|
||||||
|
sh_c ssh "$RHOST" 'brew install go'
|
||||||
|
}
|
||||||
|
|
||||||
main "$@"
|
main "$@"
|
||||||
|
|
|
||||||
2
ci/sub
2
ci/sub
|
|
@ -1 +1 @@
|
||||||
Subproject commit 231dec9096304f1a033fd2ef35228d4c6e0744b3
|
Subproject commit be28ce747b280c59b8fe89e6b29bb0637984985d
|
||||||
Loading…
Reference in a new issue