зеркало из https://github.com/golang/build.git
env/freebsd-amd64: port to LUCI and upgrade to 14.1
Port to LUCI includes: - Install Python. - Install bootstrapswarm. - Use bootstrapswarm instead of buildlet. For golang/go#61095. Change-Id: Ie787f6d098186259398ad135b60758e1ce8b489c Reviewed-on: https://go-review.googlesource.com/c/build/+/616836 Auto-Submit: Michael Knyszek <mknyszek@google.com> LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com> Reviewed-by: Dmitri Shuralyov <dmitshur@google.com> Reviewed-by: Dmitri Shuralyov <dmitshur@golang.org>
This commit is contained in:
Родитель
c4345a7cbf
Коммит
a0b635343b
|
@ -3,17 +3,17 @@
|
|||
|
||||
upload-staging:
|
||||
go install golang.org/x/build/cmd/upload
|
||||
upload --verbose --file=freebsd-amd64-112.tar.gz --public dev-go-builder-data/freebsd-amd64-112.tar.gz
|
||||
upload --verbose --file=freebsd-amd64-141.tar.gz --public dev-go-builder-data/freebsd-amd64-141.tar.gz
|
||||
|
||||
upload-prod:
|
||||
go install golang.org/x/build/cmd/upload
|
||||
upload --verbose --file=freebsd-amd64-112.tar.gz --public go-builder-data/freebsd-amd64-112.tar.gz
|
||||
upload --verbose --file=freebsd-amd64-141.tar.gz --public go-builder-data/freebsd-amd64-141.tar.gz
|
||||
|
||||
create-image-staging:
|
||||
gcloud compute --project go-dashboard-dev images create freebsd-amd64-112 --source-uri gs://dev-go-builder-data/freebsd-amd64-112.tar.gz
|
||||
gcloud compute --project go-dashboard-dev images create freebsd-amd64-141 --source-uri gs://dev-go-builder-data/freebsd-amd64-141.tar.gz
|
||||
|
||||
create-image-prod:
|
||||
gcloud compute --project symbolic-datum-552 images create freebsd-amd64-112 --source-uri gs://go-builder-data/freebsd-amd64-112.tar.gz
|
||||
gcloud compute --project symbolic-datum-552 images create freebsd-amd64-141 --source-uri gs://go-builder-data/freebsd-amd64-141.tar.gz
|
||||
|
||||
delete-image-prod:
|
||||
gcloud compute --project symbolic-datum-552 images delete freebsd-amd64-112
|
||||
gcloud compute --project symbolic-datum-552 images delete freebsd-amd64-141
|
||||
|
|
|
@ -22,18 +22,42 @@ load_rc_config $name
|
|||
buildlet_prestart()
|
||||
{
|
||||
local buildlet_url
|
||||
local project
|
||||
local gcehost
|
||||
local buildletsh
|
||||
local swarming
|
||||
|
||||
info $(netstat -rn)
|
||||
info $(cat /etc/resolv.conf)
|
||||
|
||||
buildlet_url=$(/usr/local/bin/curl -s -H "Metadata-Flavor: Google" \
|
||||
http://metadata.google.internal/computeMetadata/v1/instance/attributes/buildlet-binary-url)
|
||||
project=$(/usr/local/bin/curl -s -H "Metadata-Flavor: Google" http://metadata.google.internal/computeMetadata/v1/project/project-id)
|
||||
info "Found project GCE ${project}."
|
||||
case "$project" in
|
||||
*luci*)
|
||||
info "Setting up bootstrapswarm..."
|
||||
|
||||
if ! /usr/local/bin/curl -o /buildlet "${buildlet_url}"; then
|
||||
warn "failed to download buildlet from ${buildlet_url}"
|
||||
poweroff
|
||||
return 1
|
||||
fi
|
||||
gcehost=$(/usr/local/bin/curl -s -H "Metadata-Flavor: Google" http://metadata.google.internal/computeMetadata/v1/instance/hostname | cut -d . -f 1)
|
||||
info "Found GCE host ${gcehost}."
|
||||
|
||||
swarming=$(/usr/local/bin/curl -s -H "Metadata-Flavor: Google" http://metadata.google.internal/computeMetadata/v1/instance/attributes/swarming | cut -d . -f 1)
|
||||
swarming="${swarming}.appspot.com"
|
||||
info "Found Swarming host ${swarming}."
|
||||
|
||||
buildletsh="#!/bin/sh\n\nset -x\n\nsu -l swarming -c \"/usr/local/bin/bootstrapswarm --hostname $gcehost --swarming $swarming\"\n"
|
||||
echo -e $buildletsh >/buildlet
|
||||
;;
|
||||
*)
|
||||
info "Setting up buildlet..."
|
||||
buildlet_url=$(/usr/local/bin/curl -s -H "Metadata-Flavor: Google" \
|
||||
http://metadata.google.internal/computeMetadata/v1/instance/attributes/buildlet-binary-url)
|
||||
|
||||
if ! /usr/local/bin/curl -o /buildlet "${buildlet_url}"; then
|
||||
warn "failed to download buildlet from ${buildlet_url}"
|
||||
poweroff
|
||||
return 1
|
||||
fi
|
||||
;;
|
||||
esac
|
||||
|
||||
chmod a+x /buildlet
|
||||
}
|
||||
|
|
|
@ -6,7 +6,7 @@
|
|||
# Builds FreeBSD image based on raw disk images provided by FreeBSD.org
|
||||
# This script boots the image once, side-loads GCE Go builder configuration via
|
||||
# an ISO mounted as the CD-ROM, and customizes the system before powering down.
|
||||
# SSH is enabled, and a user gopher, password gopher, is created.
|
||||
# SSH is enabled, and a user swarming, password swarming, is created.
|
||||
|
||||
# Only tested on Ubuntu 20.04.
|
||||
# Requires packages: qemu-system-x86 qemu-img expect genisoimage
|
||||
|
@ -99,9 +99,15 @@ case $1 in
|
|||
readonly SHA256=7b8fcc2330c8d9f66dd012c5859167d56c227ece39188c8f55b2bddbf688875f # https://lists.freebsd.org/archives/freebsd-snapshots/2021-December/000036.html
|
||||
readonly BLIND_SWITCH_CONSOLE=1
|
||||
;;
|
||||
14.1)
|
||||
readonly VERSION=14.1-RELEASE
|
||||
readonly VERSION_TRAILER=
|
||||
readonly SHA256=f2eb6f0033e573f580d43f0cf5a0e9c17c6994de9e502c711fd2325dac3b8f69
|
||||
readonly BLIND_SWITCH_CONSOLE=1
|
||||
;;
|
||||
*)
|
||||
echo "Usage: $0 <version>"
|
||||
echo " version - FreeBSD version to build. Valid choices: 9.3 10.3 10.4 11.0 11.1 11.2 11.3 11.4 12.0 12.1 12.2 13.0 13.0-SNAPSHOT"
|
||||
echo " version - FreeBSD version to build. Valid choices: 9.3 10.3 10.4 11.0 11.1 11.2 11.3 11.4 12.0 12.1 12.2 13.0 13.0-SNAPSHOT 14.1"
|
||||
exit 1
|
||||
esac
|
||||
|
||||
|
@ -120,26 +126,28 @@ fi
|
|||
|
||||
qemu-img create -f qcow2 -b FreeBSD-${VERSION:?}-amd64${VERSION_TRAILER}.raw -F raw disk.qcow2 16G
|
||||
|
||||
mkdir -p iso/boot iso/etc iso/usr/local/etc/rc.d
|
||||
mkdir -p iso/boot iso/etc iso/usr/local/etc/rc.d iso/usr/local/bin
|
||||
cp loader.conf iso/boot
|
||||
cp rc.conf iso/etc
|
||||
cp sysctl.conf iso/etc
|
||||
cp buildlet iso/usr/local/etc/rc.d
|
||||
CGO_ENABLED=0 GOOS=freebsd GOARCH=amd64 go build -o iso/usr/local/bin/bootstrapswarm golang.org/x/build/cmd/bootstrapswarm
|
||||
|
||||
cat >iso/install.sh <<'EOF'
|
||||
#!/bin/sh
|
||||
set -x
|
||||
|
||||
mkdir -p /usr/local/etc/rc.d/
|
||||
mkdir -p /usr/local/etc/rc.d/ /usr/local/bin/
|
||||
cp /mnt/usr/local/etc/rc.d/buildlet /usr/local/etc/rc.d/buildlet
|
||||
chmod +x /usr/local/etc/rc.d/buildlet
|
||||
cp /mnt/boot/loader.conf /boot/loader.conf
|
||||
cp /mnt/etc/rc.conf /etc/rc.conf
|
||||
cp /mnt/usr/local/bin/bootstrapswarm /usr/local/bin/bootstrapswarm
|
||||
cat /mnt/etc/sysctl.conf >> /etc/sysctl.conf
|
||||
adduser -f - <<ADDUSEREOF
|
||||
gopher::::::Gopher Gopherson::/bin/sh:gopher
|
||||
swarming::::::Swarming Gopher Gopherson::/bin/sh:swarming
|
||||
ADDUSEREOF
|
||||
pw user mod gopher -G wheel
|
||||
pw user mod swarming -G wheel
|
||||
|
||||
# Enable serial console early in boot process.
|
||||
echo '-h' > /boot.conf
|
||||
|
@ -238,7 +246,7 @@ if {$::env(DOWNLOAD_UPDATES)} {
|
|||
|
||||
expect -re $prompt
|
||||
sleep 1
|
||||
send "pkg install -y bash curl git gdb\n"
|
||||
send "pkg install -y bash curl git gdb python\n"
|
||||
|
||||
expect -re $prompt
|
||||
send "sync\n"
|
||||
|
|
Загрузка…
Ссылка в новой задаче