Skip to content

Commit

Permalink
fix: aproxy arm/amd revision fix (#204)
Browse files Browse the repository at this point in the history
* fix: aproxy arm/amd revision fix

* chore: switch default arm/amd selection
  • Loading branch information
yanksyoon authored Jan 23, 2024
1 parent 153b562 commit 7e73a46
Showing 1 changed file with 14 additions and 3 deletions.
17 changes: 14 additions & 3 deletions src/runner.py
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,9 @@
LXD_PROFILE_YAML = LXD_PROFILE_YAML.parent / "lxd-profile.yml"
LXDBR_DNSMASQ_LEASES_FILE = Path("/var/snap/lxd/common/lxd/networks/lxdbr0/dnsmasq.leases")

APROXY_ARM_REVISION = 9
APROXY_AMD_REVISION = 8


class Snap(NamedTuple):
"""This class represents a snap installation."""
Expand Down Expand Up @@ -151,7 +154,7 @@ def create(self, config: CreateRunnerConfig):
# Wait some initial time for the instance to boot up
time.sleep(60)
self._wait_boot_up()
self._install_binaries(config.binary_path)
self._install_binaries(config.binary_path, config.arch)
self._configure_runner()

self._register_runner(
Expand Down Expand Up @@ -467,7 +470,7 @@ def _wait_boot_up(self) -> None:
logger.info("Finished booting up LXD instance for runner: %s", self.config.name)

@retry(tries=10, delay=10, max_delay=120, backoff=2, local_logger=logger)
def _install_binaries(self, runner_binary: Path) -> None:
def _install_binaries(self, runner_binary: Path, arch: ARCH) -> None:
"""Install runner binary and other binaries.
Args:
Expand All @@ -479,7 +482,15 @@ def _install_binaries(self, runner_binary: Path) -> None:
if self.instance is None:
raise RunnerError("Runner operation called prior to runner creation.")

self._snap_install([Snap(name="aproxy", channel="edge", revision=6)])
self._snap_install(
[
Snap(
name="aproxy",
channel="edge",
revision=APROXY_ARM_REVISION if arch == ARCH.ARM64 else APROXY_AMD_REVISION,
)
]
)

# The LXD instance is meant to run untrusted workload. Hardcoding the tmp directory should
# be fine.
Expand Down

0 comments on commit 7e73a46

Please sign in to comment.