feat: spot instance support with on-demand fallback#54
Merged
Conversation
CI runners are the textbook spot workload — short-lived, ephemeral, restartable — and spot is typically 60-90% cheaper. New start-mode inputs: market-type: on-demand (default) | spot spot-fallback: on-demand (default) | fail spot-max-price: '' (optional; empty = on-demand price cap) - Spot launches request InstanceMarketOptions with SpotInstanceType=one-time and InstanceInterruptionBehavior=terminate — no persistent spot request to leak; stop mode terminates identically to on-demand. On-demand launches are byte-identical to before (no InstanceMarketOptions). - Composes with the capacity fallback (#40): launchAcrossMarkets runs the whole instance-type × subnet chain on spot first, then (unless spot-fallback: fail) the whole chain again on-demand. Fallback triggers only on capacity/price codes (InsufficientInstanceCapacity, SpotMaxPriceTooLow, ...); a fatal error aborts without downgrading. - New output market-type-used reports the realized market (spot|on-demand). - spot-max-price validated as a positive decimal at config parse. Tests: buildMarketOptions (one-time/terminate/MaxPrice), buildMarketPlan, launchAcrossMarkets (spot success, capacity fallback exactly once, price fallback, fail-mode propagation, fatal abort), config validation (159 tests total). README "Saving costs with spot" section with the interruption trade-off, inputs/outputs tables, and action.yml descriptions. Closes #39 Signed-off-by: kurok <22548029+kurok@users.noreply.github.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Closes #39 — roadmap (#49) Phase 2. The single largest cost lever; pairs with capacity fallback (#40).
Why
CI runners are the textbook spot workload — short-lived, ephemeral (
--ephemeral), restartable — and spot is typically 60–90% below on-demand.New inputs (start mode)
Behavior
InstanceMarketOptionswithSpotInstanceType: one-time+InstanceInterruptionBehavior: terminate— no persistent request to leak;stopterminates identically to on-demand.InstanceMarketOptionsemitted (regression-tested).launchAcrossMarketsruns the whole instance-type × subnet chain on spot first, then (unlessspot-fallback: fail) the whole chain again on-demand.InsufficientInstanceCapacity,SpotMaxPriceTooLow, …); a fatal error aborts without downgrading.market-type-usedreports the realized market.spot-max-pricevalidated as a positive decimal at config parse.Tests / build
tests/spot.test.js:buildMarketOptions(one-time/terminate/MaxPrice),buildMarketPlan,launchAcrossMarkets(spot success without on-demand attempt, capacity fallback exactly once,SpotMaxPriceTooLowfallback,spot-fallback: failpropagation, fatal-abort-no-fallback) + config validation. 159 tests pass (was 142). Lint clean, dist rebuilt (verify-dist green).Docs
Interruption honesty
A spot runner can be reclaimed mid-job (2-min warning); ephemeral registration means it auto-deregisters and the job re-runs cleanly rather than hanging — documented.