@@ -618,7 +618,20 @@ func CheckpointsVersion(ctx context.Context) int {
618618 if err != nil {
619619 return 1
620620 }
621- return s .CheckpointsVersion ()
621+ version := s .CheckpointsVersion ()
622+ if s .StrategyOptions != nil {
623+ if configured , ok := s .StrategyOptions ["checkpoints_version" ]; ok {
624+ if _ , supported := parseCheckpointsVersion (configured ); ! supported {
625+ checkpointsVersionWarningOnce .Do (func () {
626+ fmt .Fprintf (os .Stderr ,
627+ "[entire] unsupported strategy_options.checkpoints_version %v detected in settings. Falling back to the default version (1).\n " ,
628+ configured ,
629+ )
630+ })
631+ }
632+ }
633+ }
634+ return version
622635}
623636
624637// IsPushV2RefsEnabled checks if pushing v2 refs is enabled in settings.
@@ -736,33 +749,30 @@ func (s *EntireSettings) CheckpointsVersion() int {
736749 if ! ok {
737750 return 1
738751 }
739-
740- warnUnsupported := func (configured any ) {
741- checkpointsVersionWarningOnce .Do (func () {
742- fmt .Fprintf (os .Stderr ,
743- "[entire] unsupported checkpoints version %v detected in settings. Falling back to the default version (1).\n " ,
744- configured ,
745- )
746- })
752+ version , ok := parseCheckpointsVersion (val )
753+ if ok {
754+ return version
747755 }
756+ return 1
757+ }
748758
759+ func parseCheckpointsVersion (val any ) (int , bool ) {
749760 v , ok := val .(int )
750761 if ok && (v == 1 || v == 2 ) {
751- return v
762+ return v , true
752763 }
753764 floatV , ok := val .(float64 )
754765 if ok && (floatV == 1 || floatV == 2 ) {
755- return int (floatV )
766+ return int (floatV ), true
756767 }
757768 stringV , ok := val .(string )
758769 if ok {
759770 parsed , err := strconv .Atoi (stringV )
760771 if err == nil && (parsed == 1 || parsed == 2 ) {
761- return parsed
772+ return parsed , true
762773 }
763774 }
764- warnUnsupported (val )
765- return 1
775+ return 1 , false
766776}
767777
768778// IsPushV2RefsEnabled checks if pushing v2 refs is enabled.
0 commit comments