|
| 1 | +#!/bin/bash |
| 2 | + |
| 3 | +set -euxo pipefail |
| 4 | + |
| 5 | +ENV_YAML="$SRCDIR/l2/mkosi.extra/etc/flashbots/l2.yaml" |
| 6 | + |
| 7 | +VAULT_VERSION=$(mkosi-chroot yq -r .vault.version < "$ENV_YAML") |
| 8 | +GOMPLATE_VERSION=$(mkosi-chroot yq -r .deps.gomplate_version < "$ENV_YAML") |
| 9 | +OPS_AGENT_VERSION=$(mkosi-chroot yq -r .deps.ops_agent_version < "$ENV_YAML") |
| 10 | + |
| 11 | +source scripts/make_git_package.sh |
| 12 | + |
| 13 | +# build gomplate |
| 14 | +make_git_package \ |
| 15 | + "gomplate" \ |
| 16 | + "v${GOMPLATE_VERSION}" \ |
| 17 | + "https://github.com/hairyhenderson/gomplate" \ |
| 18 | + 'go build -trimpath -ldflags "-s -w -buildid=" -o ./build/gomplate ./cmd/gomplate' \ |
| 19 | + "build/gomplate:/usr/bin/gomplate" |
| 20 | +chmod +x $DESTDIR/usr/bin/gomplate |
| 21 | + |
| 22 | +# build vault |
| 23 | +make_git_package \ |
| 24 | + "vault" \ |
| 25 | + "v${VAULT_VERSION}" \ |
| 26 | + "https://github.com/hashicorp/vault.git" \ |
| 27 | + 'go build -trimpath -ldflags "-s -w -buildid=" -o ./bin/vault .' \ |
| 28 | + "bin/vault:/usr/bin/vault" |
| 29 | +chmod +x $DESTDIR/usr/bin/vault |
| 30 | + |
| 31 | +cd "$BUILDROOT" |
| 32 | + |
| 33 | +# Build Google Cloud Ops Agent |
| 34 | +IMPORT_PATH="github.com/GoogleCloudPlatform/ops-agent" |
| 35 | +BUILD_CMD=" |
| 36 | + # Fluentbit |
| 37 | + export SOURCE_DATE_EPOCH=0 PATH=/usr/local/go/bin:\$PATH |
| 38 | + export CFLAGS='-fno-ident -Wno-date-time' CXXFLAGS='-fno-ident -Wno-date-time' |
| 39 | + git submodule update --init --depth 1 submodules/fluent-bit |
| 40 | + ./builds/fluent_bit.sh \$(pwd)/out |
| 41 | +
|
| 42 | + # Main gcs agent binaries |
| 43 | + mkdir -p out/libexec |
| 44 | + LDFLAGS='-s -w -buildid=' |
| 45 | + go build -buildvcs=false -trimpath -ldflags \"\$LDFLAGS \\ |
| 46 | + -X $IMPORT_PATH/internal/version.BuildDistro=debian13 \\ |
| 47 | + -X $IMPORT_PATH/internal/version.Version=$OPS_AGENT_VERSION\" \\ |
| 48 | + -o out/libexec/google_cloud_ops_agent_engine \\ |
| 49 | + $IMPORT_PATH/cmd/google_cloud_ops_agent_engine |
| 50 | +
|
| 51 | + go build -buildvcs=false -trimpath -ldflags \"\$LDFLAGS\" \\ |
| 52 | + -o out/libexec/google_cloud_ops_agent_wrapper \\ |
| 53 | + $IMPORT_PATH/cmd/agent_wrapper |
| 54 | +" |
| 55 | + |
| 56 | +make_git_package \ |
| 57 | + "google-cloud-ops-agent" \ |
| 58 | + "$OPS_AGENT_VERSION" \ |
| 59 | + "https://github.com/GoogleCloudPlatform/ops-agent" \ |
| 60 | + "$BUILD_CMD" \ |
| 61 | + "out/libexec:/opt/google-cloud-ops-agent/libexec" \ |
| 62 | + "out/opt/google-cloud-ops-agent/subagents/fluent-bit:/opt/google-cloud-ops-agent/subagents/fluent-bit" \ |
| 63 | + "systemd/google-cloud-ops-agent-fluent-bit.service:/usr/lib/systemd/system/google-cloud-ops-agent-fluent-bit.service" \ |
| 64 | + "systemd/google-cloud-ops-agent.service:/usr/lib/systemd/system/google-cloud-ops-agent.service" |
| 65 | + |
| 66 | +sed -i 's|@PREFIX@|/opt/google-cloud-ops-agent|g; s|@SYSCONFDIR@|/etc|g' "$DESTDIR/usr/lib/systemd/system/google-cloud-ops-agent"*.service |
0 commit comments