Skip to content

Commit

Permalink
Skip jq install if possible
Browse files Browse the repository at this point in the history
This minimize the time to start the VM in the CI, making it easier to
debug startup issue, when we don't have ssh access to the guest. The
time moves to the next step preparing the VM, but it is easier to debug
that step with ssh access.

Before:
- start vm: 2m15s
- prepare vm: 15s

After:
- start vm: 1m33s
- prepare vm: 1m1s
  • Loading branch information
nirs committed Feb 24, 2025
1 parent 85cbb09 commit 83f952a
Showing 1 changed file with 7 additions and 5 deletions.
12 changes: 7 additions & 5 deletions vmnet/cidata.py
Original file line number Diff line number Diff line change
Expand Up @@ -67,17 +67,19 @@ def create_user_data(vm):
"expire": False,
},
"ssh_authorized_keys": public_keys(),
"packages": [
"jq",
],
"package_update": False,
"package_upgrade": False,
"runcmd": [
"ip_address=$(ip -4 -j addr show dev vmnet0 | jq -r '.[0].addr_info[0].local')",
f"echo > {serial_console}",
f"echo {vm.vm_name} address: $ip_address > {serial_console}",
],
}

# Skip jq install if posisble to minimize startup time in the CI.
if vm.distro != "ubuntu":
data["packages"] = ["jq"]
data["package_update"] = False
data["package_upgrade"] = False

path = store.vm_path(vm.vm_name, "user-data")
with open(path, "w") as f:
f.write("#cloud-config\n")
Expand Down

0 comments on commit 83f952a

Please sign in to comment.