Conversation
…demand per job The label ghr-ec2-capacity-type:spot|on-demand overrides the capacity type of the runner configuration for one job. Other values are rejected as invalid runner labels. The label is ignored for dedicated hosts, and the max price is not passed to the fleet request for on-demand runners.
resolveCapacityType is now one entry in a list of resolvers applied in order before runner creation, so a future per-job override can be added as another resolver without changing createRunners.
This branch has not been deployed
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.
Fixes #5484
Summary
The capacity type (spot or on-demand) of a runner configuration is fixed by
instance_target_capacity_type, and a workflow job cannot choose it. This PR adds the dynamic labelghr-ec2-capacity-type:spot|on-demand, so one runner configuration can serve both kinds of jobs instead of needing a separate configuration for each.Changes
ghr-ec2-capacity-type:<spot|on-demand>. The value overridesINSTANCE_TARGET_CAPACITY_TYPEfor the runner created for that job. The value is not case-sensitive.InvalidRunnerLabelsError, the existing error for labels that are permanently invalid and must not be retried.runner-creation.ts. The label is removed from the fleet overrides, so it is not sent to AWS. Because the resolved type is used for the request, the on-demand failover follows it: it applies to jobs that use spot and never to jobs that use on-demand.use_dedicated_host = truethe label is ignored, becauseRunInstancesdoes not support spot. Aspotvalue writes a warning to the log.on-demand, the value ofghr-ec2-max-priceis not passed to the fleet request, because it only applies to spot.docs/configuration.md: new row in the basic fleet overrides table and a "Capacity type" section that describes the behavior above, the limitation for spot request tags (they come from the launch template), and a policy example that allows only spot.Test plan
scale-up.test.ts: parsing (both values, not case-sensitive), validation (accepted and rejected values), and runner creation: on-demand label in a spot configuration, spot label in an on-demand configuration, no label, max price with spot and with on-demand, dedicated host, and an unsupported value. The tests for the resolution fail without the change inrunner-creation.ts.dynamic-labels-policy.test.ts:restricted_keysoncapacity-typeallows spot and rejects on-demand.libs/compute-providers(369 tests) andfunctions/control-plane(352 tests)eslint,prettierandtsc --noEmit