@@ -861,61 +861,30 @@ func RunCacheProbe(ctx context.Context, opts options.Options) (v1.Image, error)
861
861
862
862
buildTimeWorkspaceFolder := opts .WorkspaceFolder
863
863
var fallbackErr error
864
- var cloned bool
865
- if opts .GitURL != "" {
866
- cloneOpts , err := git .CloneOptionsFromOptions (opts )
867
- if err != nil {
868
- return nil , fmt .Errorf ("git clone options: %w" , err )
869
- }
870
-
871
- endStage := startStage ("📦 Cloning %s to %s..." ,
872
- newColor (color .FgCyan ).Sprintf (opts .GitURL ),
873
- newColor (color .FgCyan ).Sprintf (cloneOpts .Path ),
874
- )
875
-
876
- w := git .ProgressWriter (func (line string ) { opts .Logger (log .LevelInfo , "#%d: %s" , stageNumber , line ) })
877
- defer w .Close ()
878
- cloneOpts .Progress = w
879
864
880
- cloned , fallbackErr = git .CloneRepo (ctx , cloneOpts )
881
- if fallbackErr == nil {
882
- if cloned {
883
- endStage ("📦 Cloned repository!" )
884
- } else {
885
- endStage ("📦 The repository already exists!" )
886
- }
887
- } else {
888
- opts .Logger (log .LevelError , "Failed to clone repository: %s" , fallbackErr .Error ())
889
- opts .Logger (log .LevelError , "Falling back to the default image..." )
890
- }
891
-
892
- // Always clone the repo in remote repo build mode into a location that
893
- // we control that isn't affected by the users changes.
894
- if opts .RemoteRepoBuildMode {
895
- cloneOpts , err := git .CloneOptionsFromOptions (opts )
896
- if err != nil {
897
- return nil , fmt .Errorf ("git clone options: %w" , err )
898
- }
899
- cloneOpts .Path = constants .MagicRemoteRepoDir
865
+ // Cache probing only supports repo mode.
866
+ cloneOpts , err := git .CloneOptionsFromOptions (opts )
867
+ if err != nil {
868
+ return nil , fmt .Errorf ("git clone options: %w" , err )
869
+ }
870
+ cloneOpts .Path = constants .MagicRemoteRepoDir
900
871
901
- endStage := startStage ("📦 Remote repo build mode enabled, cloning %s to %s for build context..." ,
902
- newColor (color .FgCyan ).Sprintf (opts .GitURL ),
903
- newColor (color .FgCyan ).Sprintf (cloneOpts .Path ),
904
- )
872
+ endStage := startStage ("📦 Remote repo build mode enabled, cloning %s to %s for build context..." ,
873
+ newColor (color .FgCyan ).Sprintf (opts .GitURL ),
874
+ newColor (color .FgCyan ).Sprintf (cloneOpts .Path ),
875
+ )
905
876
906
- w := git .ProgressWriter (func (line string ) { opts .Logger (log .LevelInfo , "#%d: %s" , stageNumber , line ) })
907
- defer w .Close ()
908
- cloneOpts .Progress = w
877
+ w := git .ProgressWriter (func (line string ) { opts .Logger (log .LevelInfo , "#%d: %s" , stageNumber , line ) })
878
+ defer w .Close ()
879
+ cloneOpts .Progress = w
909
880
910
- fallbackErr = git .ShallowCloneRepo (ctx , cloneOpts )
911
- if fallbackErr == nil {
912
- endStage ("📦 Cloned repository!" )
913
- buildTimeWorkspaceFolder = cloneOpts .Path
914
- } else {
915
- opts .Logger (log .LevelError , "Failed to clone repository for remote repo mode: %s" , err .Error ())
916
- opts .Logger (log .LevelError , "Falling back to the default image..." )
917
- }
918
- }
881
+ fallbackErr = git .ShallowCloneRepo (ctx , cloneOpts )
882
+ if fallbackErr == nil {
883
+ endStage ("📦 Cloned repository!" )
884
+ buildTimeWorkspaceFolder = cloneOpts .Path
885
+ } else {
886
+ opts .Logger (log .LevelError , "Failed to clone repository for remote repo mode: %s" , err .Error ())
887
+ opts .Logger (log .LevelError , "Falling back to the default image..." )
919
888
}
920
889
921
890
defaultBuildParams := func () (* devcontainer.Compiled , error ) {
0 commit comments