@@ -734,99 +734,6 @@ func registerInGlobalCacheIndex(filePath, url string) {
734
734
}
735
735
}
736
736
737
- // getGlobalRemoteCaches has been removed as it duplicated the cache.GetGlobalRemoteCaches function.
738
-
739
- // populateRemoteS3Caches uploads a file to all configured S3 remote caches
740
- func populateRemoteS3Caches (remoteCaches []string , filePath , cacheKey string ) {
741
- // Get file stats for verification
742
- fileInfo , err := os .Stat (filePath )
743
- if err != nil {
744
- if ! GitQuiet {
745
- color .Yellow ("WARNING: Failed to get file info for S3 upload: %v" , err )
746
- }
747
- return
748
- }
749
-
750
- // Skip directories
751
- if fileInfo .IsDir () {
752
- if ! GitQuiet {
753
- color .Yellow ("WARNING: Cannot upload directory to S3 cache: %s" , filePath )
754
- }
755
- return
756
- }
757
-
758
- // Format the S3 key
759
- s3Key := cacheKey + ".tar.gz"
760
-
761
- // Loop through remote caches
762
- for _ , remoteURL := range remoteCaches {
763
- // Skip non-S3 remotes
764
- if ! strings .HasPrefix (remoteURL , "s3://" ) {
765
- continue
766
- }
767
-
768
- if ! GitQuiet {
769
- color .Green ("Uploading to S3 remote cache: %s/%s" , remoteURL , s3Key )
770
- }
771
-
772
- // Extract bucket from S3 URL
773
- parsedURL , parseErr := url .Parse (remoteURL )
774
- if parseErr != nil {
775
- if ! GitQuiet {
776
- color .Yellow ("WARNING: Failed to parse S3 URL %s: %v" , remoteURL , parseErr )
777
- }
778
- continue
779
- }
780
-
781
- // Get bucket name from URL host
782
- bucket := parsedURL .Host
783
-
784
- // Create S3 client using environment variables
785
- client , err := s3 .NewClientFromEnv (bucket )
786
- if err != nil {
787
- if ! GitQuiet {
788
- color .Yellow ("WARNING: Failed to create S3 client for %s: %v" , remoteURL , err )
789
- color .Yellow ("S3 URL details - Bucket: %s, Query params: %s" ,
790
- bucket , parsedURL .RawQuery )
791
- }
792
- continue
793
- }
794
-
795
- // Check if bucket exists and is accessible before attempting upload
796
- ctx := context .Background ()
797
- exists , err := client .BucketExists (ctx )
798
- if err != nil {
799
- if ! GitQuiet {
800
- color .Yellow ("WARNING: Failed to check if bucket exists: %v" , err )
801
- }
802
- continue
803
- }
804
-
805
- if ! exists {
806
- if ! GitQuiet {
807
- color .Yellow ("WARNING: Bucket '%s' does not exist or is not accessible" , client .Bucket )
808
- }
809
- continue
810
- }
811
-
812
- // Upload the file
813
- err = client .Upload (ctx , filePath , s3Key )
814
- if err != nil {
815
- if ! GitQuiet {
816
- color .Yellow ("WARNING: Failed to upload to S3 cache %s: %v" , remoteURL , err )
817
-
818
- // Add AWS SDK version for debugging
819
- color .Yellow ("Using AWS SDK v2 - Check if credentials and endpoint are correctly configured" )
820
- }
821
- continue
822
- }
823
-
824
- if ! GitQuiet {
825
- color .Green ("Successfully populated S3 remote cache: %s" , remoteURL )
826
- }
827
- }
828
- }
829
-
830
737
func gzipUntar (dst string , r io.Reader , subDir string ) error {
831
738
gzr , err := gzip .NewReader (r )
832
739
if err != nil {
@@ -927,7 +834,7 @@ func remoteResolveRef(ctx context.Context, remote string, ref string) (string, e
927
834
if err != nil {
928
835
return "" , err
929
836
}
930
- commitShaPattern := regexp .MustCompile (" ^([0-9a-f]{40,})\\ b" )
837
+ commitShaPattern := regexp .MustCompile (` ^([0-9a-f]{40,})\b` )
931
838
commitSha := commitShaPattern .FindString (b .String ())
932
839
return commitSha , nil
933
840
}
0 commit comments