Skip to content

Commit 6fecc06

Browse files
committed
fix: serve fls binary from exporter instead of downloading from GitHub
Serve the fls binary already installed in the exporter container via its HTTP server, Users can still override with --fls-version or --fls-binary-url. This would help to avoid scenarios in which github is not available for example Signed-off-by: Benny Zlotnik <bzlotnik@redhat.com> Assisted-by: claude-opus-4.6
1 parent c29eece commit 6fecc06

3 files changed

Lines changed: 29 additions & 3 deletions

File tree

python/Containerfile

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,14 @@ RUN ARCH=$(uname -m) && \
2020
TEMP_FILE="/tmp/fls-${ARCH}-${SUFFIX}.tmp" && \
2121
curl -fsSL "${URL}" -o "${TEMP_FILE}" && \
2222
mv "${TEMP_FILE}" /usr/local/bin/fls && \
23-
chmod +x /usr/local/bin/fls
23+
chmod +x /usr/local/bin/fls && \
24+
if [ "$ARCH" != "aarch64" ]; then \
25+
curl -fsSL "https://github.com/jumpstarter-dev/fls/releases/download/${FLS_VERSION}/fls-aarch64-linux-musl" \
26+
-o /usr/local/bin/fls-aarch64 && \
27+
chmod +x /usr/local/bin/fls-aarch64; \
28+
else \
29+
ln -s /usr/local/bin/fls /usr/local/bin/fls-aarch64; \
30+
fi
2431

2532
FROM builder AS wheels
2633
ADD . /src

python/packages/jumpstarter-driver-flashers/jumpstarter_driver_flashers/client.py

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@
3939

4040
from jumpstarter.client.core import DriverMethodNotImplemented
4141
from jumpstarter.client.decorators import driver_click_group
42-
from jumpstarter.common.exceptions import ArgumentError, JumpstarterException
42+
from jumpstarter.common.exceptions import ArgumentError, ConfigurationError, JumpstarterException
4343
from jumpstarter.common.fls import get_fls_github_url
4444

4545

@@ -306,6 +306,11 @@ def _categorize_exception(self, exception: Exception) -> FlashRetryableError | F
306306
if isinstance(exception, CancelledError):
307307
return FlashNonRetryableError("Operation cancelled")
308308

309+
# ConfigurationError is deterministic and should not be retried
310+
config_error = self._find_exception_in_chain(exception, ConfigurationError)
311+
if config_error is not None:
312+
return FlashNonRetryableError(str(config_error))
313+
309314
# Unknown exception - log full stack trace and wrap as retryable
310315
self.logger.exception(
311316
f"Unknown exception encountered during flash operation, treating as retryable: "
@@ -701,9 +706,13 @@ def _flash_with_fls(
701706
self._download_fls_binary(console, prompt, fls_binary_url, f"Failed to download FLS from {fls_binary_url}")
702707
elif fls_version != "":
703708
self.logger.info(f"Downloading FLS version {fls_version} from GitHub releases")
704-
# Download fls binary to the target device (always aarch64 for target devices)
705709
fls_url = get_fls_github_url(fls_version, arch="aarch64")
706710
self._download_fls_binary(console, prompt, fls_url, f"Failed to download FLS from {fls_url}")
711+
else:
712+
self.logger.info("Serving FLS binary from exporter container")
713+
self.call("setup_fls_binary")
714+
fls_url = self.http.get_url() + "/fls"
715+
self._download_fls_binary(console, prompt, fls_url, "Failed to download FLS from exporter")
707716

708717
# Flash the image
709718
creds_file = None

python/packages/jumpstarter-driver-flashers/jumpstarter_driver_flashers/driver.py

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -78,6 +78,16 @@ async def get_cacert(self) -> str | None:
7878
with open(self.cacert) as f:
7979
return f.read()
8080

81+
@export
82+
async def setup_fls_binary(self):
83+
"""Copy local fls binary to HTTP server root for DUT download"""
84+
fls_path = Path("/usr/local/bin/fls-aarch64")
85+
if not fls_path.exists():
86+
fls_path = Path("/usr/local/bin/fls")
87+
if not fls_path.exists():
88+
raise ConfigurationError("fls binary not found at /usr/local/bin/fls-aarch64 or /usr/local/bin/fls")
89+
await self.http.storage.copy_exporter_file(fls_path, "fls")
90+
8191
@export
8292
async def setup_flasher_bundle(self, force_flash_bundle: str | None = None):
8393
"""Setup flasher bundle

0 commit comments

Comments
 (0)