blob: 4a7c79e41cbf3794944fde56f5a1862eea6e041c [file] [log] [blame]
# Go build command to build static binaries suitable for lean Alpine containers.
KGO := CGO_ENABLED=0 GOOS=linux go build
export VERSION:=$(shell ../bash/release_tag.sh)
# This build must be launched from an Ansible playbook which will extract the
# service account keys and base64 encode them into the SERVICE_ACCOUNT_KEY and
# INTERNAL_SERVICE_ACCOUNT_KEY environment variables.
#
# The directory under ./build/Linux/x86_64/ is the name of the secret where the
# service key is stored under.
build_metadata_server_ansible:
rm -rf ./build
test -n "${SERVICE_ACCOUNT_KEY}" || (echo "SERVICE_ACCOUNT_KEY must be set by Ansible playbook."; exit 1)
test -n "${INTERNAL_SERVICE_ACCOUNT_KEY}" || (echo "INTERNAL_SERVICE_ACCOUNT_KEY must be set by Ansible playbook."; exit 1)
CGO_ENABLED=0 \
GOOS=linux \
GOARCH=amd64 \
go build \
-o ./build/Linux/x86_64/chromium-swarm-bots/metadata_server_ansible \
-ldflags="-X 'main.Version=${VERSION}' -X 'main.Key=${SERVICE_ACCOUNT_KEY}' " \
./go/metadata_server_ansible
CGO_ENABLED=0 \
GOOS=linux \
GOARCH=amd64 \
go build \
-o ./build/Linux/x86_64/chrome-swarming-bots/metadata_server_ansible \
-ldflags="-X 'main.Version=${VERSION}' -X 'main.Key=${INTERNAL_SERVICE_ACCOUNT_KEY}' " \
./go/metadata_server_ansible
build_and_upload_metadata_server_ansible: build_metadata_server_ansible
cipd create -pkg-def=metadata_server_ansible_cipd.yml --tag version:${VERSION}
release_metadata_server_ansible: build_and_upload_metadata_server_ansible
../bash/ansible-release.sh metadata_server_ansible ${VERSION}
build_powercycle_server_ansible:
rm -rf ./build
CGO_ENABLED=0 \
GOOS=linux \
GOARCH=amd64 \
go build \
-o ./build/Linux/x86_64/powercycle_server_ansible \
-ldflags="-X 'main.Version=${VERSION}' " \
./go/powercycle_server_ansible
build_and_upload_powercycle_server_ansible: build_powercycle_server_ansible
cipd create -pkg-def=powercycle_server_ansible_cipd.yml --tag version:${VERSION}
release_powercycle_server_ansible: build_and_upload_powercycle_server_ansible
../bash/ansible-release.sh powercycle_server_ansible ${VERSION}
build_router_backup_ansible:
rm -rf ./build
CGO_ENABLED=0 \
GOOS=linux \
GOARCH=amd64 \
go build \
-o ./build/Linux/x86_64/router_backup_ansible \
-ldflags="-X 'main.Version=${VERSION}' " \
./go/router_backup_ansible
build_and_upload_router_backup_ansible: build_router_backup_ansible
cipd create -pkg-def=router_backup_ansible_cipd.yml --tag version:${VERSION}
release_router_backup_ansible: build_and_upload_router_backup_ansible
../bash/ansible-release.sh router_backup_ansible ${VERSION}
# The POWERCYCLE_PASSWORD must be set in the environment for this to work correctly.
run-local-instance-powercycle_server_ansible:
go install ./go/powercycle_server_ansible
powercycle_server_ansible --local --powercycle_config=powercycle-rack4.json5 --config=prod.json
run-local-instance-router_backup_ansible:
go install ./go/router_backup_ansible
router_backup_ansible --local \
--gce_bucket skia-backups \
--gce_folder router_config_test_backups \
--remote_file_path "admin@router-rack1:/config/config.boot"
# The PROMETHEUS_VERSION env variable must also be set.
download_prometheus_x86_64_Linux:
ifeq ("$(wildcard ./build/Linux/x86_64/prometheus-$(PROMETHEUS_VERSION).linux-amd64/prometheus)", "")
mkdir -p ./build/Linux/x86_64
wget https://github.com/prometheus/prometheus/releases/download/v${PROMETHEUS_VERSION}/prometheus-${PROMETHEUS_VERSION}.linux-amd64.tar.gz -O - | tar -xz --directory=./build/Linux/x86_64
endif
-echo Download complete.