Skip to content

infra: simplify — remove GCP playbooks, reconcile agent deploy workflow #1

infra: simplify — remove GCP playbooks, reconcile agent deploy workflow

infra: simplify — remove GCP playbooks, reconcile agent deploy workflow #1

# VM Staging Deploy
#
# Builds the agent + control-plane binaries, bakes a VM image on the staging
# host via Packer, and launches the new agent VM.
#
# Trigger: automatic on pull_request targeting main (validates before merge).
# Host/user/memory/cpus come from infra/ansible/inventory/staging.yml — no
# inline overrides needed.
#
# App deployment (private-llm etc.) is handled by the private-llm repo,
# not here. This workflow owns infra only.
name: VM Staging Deploy
on:
pull_request:
branches: [main]
paths:
- "agent/**"
- "control-plane/**"
- "images/**"
- "infra/**"
- ".github/workflows/vm-*"
workflow_dispatch:
concurrency:
group: dd-vm-staging
cancel-in-progress: true
permissions:
contents: read
jobs:
deploy:
runs-on: ubuntu-latest
environment: staging
steps:
# ── Build binaries ──────────────────────────────────────────────────
- uses: actions/checkout@v4
- uses: dtolnay/rust-toolchain@stable
- uses: Swatinem/rust-cache@v2
# Build both dd-agent and dd-cp in release mode
- run: cargo build --workspace --release
- run: pip install ansible
# ── SSH setup ───────────────────────────────────────────────────────
# Write the deploy key to the path the inventory expects (/tmp/deploy-key)
- name: Set up SSH
run: |
echo "${{ secrets.VM_DEPLOY_SSH_KEY }}" > /tmp/deploy-key
chmod 600 /tmp/deploy-key
ssh-keyscan -H 57.130.10.246 >> ~/.ssh/known_hosts 2>/dev/null || true
# ── Deploy agent VM ─────────────────────────────────────────────────
# Runs the vm-agent-deploy playbook against the staging inventory.
# Only build-time vars (binary paths, image name) are passed with -e;
# host, user, memory, cpus, node_size all come from the inventory file.
- name: Deploy agent to staging host
env:
ANSIBLE_HOST_KEY_CHECKING: "false"
run: |
sha12="$(echo "${{ github.sha }}" | cut -c1-12)"
ansible-playbook infra/ansible/playbooks/vm-agent-deploy.yml \
-i infra/ansible/inventory/staging.yml \
-e "agent_binary_local=${GITHUB_WORKSPACE}/target/release/dd-agent" \
-e "cp_binary_local=${GITHUB_WORKSPACE}/target/release/dd-cp" \
-e "packer_template_dir=${GITHUB_WORKSPACE}/images/packer" \
-e "image_name=dd-vm-${sha12}"
# ── Cleanup ─────────────────────────────────────────────────────────
- name: Cleanup SSH key
if: always()
run: rm -f /tmp/deploy-key