@@ -59,18 +59,32 @@ class MapperUtil {
5959 * @return the MachineRequirement API object, or null if no settings
6060 */
6161 static MachineRequirement toMachineRequirement (MachineRequirementOpts opts , String taskArch ) {
62+ return toMachineRequirement(opts, taskArch, false )
63+ }
64+
65+ /**
66+ * Maps MachineRequirementOpts to MachineRequirement API object, merging with task arch
67+ * and snapshot settings.
68+ *
69+ * @param opts the config options (can be null)
70+ * @param taskArch the task container platform/arch (can be null)
71+ * @param snapshotEnabled whether Fusion snapshots are enabled
72+ * @return the MachineRequirement API object, or null if no settings
73+ */
74+ static MachineRequirement toMachineRequirement (MachineRequirementOpts opts , String taskArch , boolean snapshotEnabled ) {
6275 final arch = taskArch ?: opts?. arch
6376 final provisioning = opts?. provisioning
6477 final maxSpotAttempts = opts?. maxSpotAttempts
6578 final machineFamilies = opts?. machineFamilies
6679 // return null if no settings
67- if (! arch && ! provisioning && ! maxSpotAttempts && ! machineFamilies)
80+ if (! arch && ! provisioning && ! maxSpotAttempts && ! machineFamilies && ! snapshotEnabled )
6881 return null
6982 new MachineRequirement ()
7083 .arch(arch)
7184 .provisioning(toProvisioningModel(provisioning))
7285 .maxSpotAttempts(maxSpotAttempts)
7386 .machineFamilies(machineFamilies)
87+ .snapshotEnabled(snapshotEnabled ? Boolean . TRUE : null )
7488 }
7589
7690 /**
0 commit comments