github.com/minio/minio@v0.0.0-20240328213742-3f72439b8a27/.github/workflows/multipart/migrate.sh (about)

     1  #!/bin/bash
     2  
     3  set -x
     4  
     5  ## change working directory
     6  cd .github/workflows/multipart/
     7  
     8  function cleanup() {
     9  	docker-compose -f docker-compose-site1.yaml rm -s -f || true
    10  	docker-compose -f docker-compose-site2.yaml rm -s -f || true
    11  	for volume in $(docker volume ls -q | grep minio); do
    12  		docker volume rm ${volume} || true
    13  	done
    14  
    15  	docker system prune -f || true
    16  	docker volume prune -f || true
    17  	docker volume rm $(docker volume ls -q -f dangling=true) || true
    18  }
    19  
    20  cleanup
    21  
    22  if [ ! -f ./mc ]; then
    23  	wget --quiet -O mc https://dl.minio.io/client/mc/release/linux-amd64/mc &&
    24  		chmod +x mc
    25  fi
    26  
    27  (
    28  	cd ./docs/debugging/s3-check-md5
    29  	go install -v
    30  )
    31  
    32  export RELEASE=RELEASE.2023-08-29T23-07-35Z
    33  
    34  docker-compose -f docker-compose-site1.yaml up -d
    35  docker-compose -f docker-compose-site2.yaml up -d
    36  
    37  sleep 30s
    38  
    39  ./mc alias set site1 http://site1-nginx:9001 minioadmin minioadmin --api s3v4
    40  ./mc alias set site2 http://site2-nginx:9002 minioadmin minioadmin --api s3v4
    41  
    42  ./mc ready site1/
    43  ./mc ready site2/
    44  
    45  ./mc admin replicate add site1 site2
    46  ./mc mb site1/testbucket/
    47  ./mc cp -r --quiet /usr/bin site1/testbucket/
    48  
    49  sleep 5
    50  
    51  s3-check-md5 -h
    52  
    53  failed_count_site1=$(s3-check-md5 -versions -access-key minioadmin -secret-key minioadmin -endpoint http://site1-nginx:9001 -bucket testbucket 2>&1 | grep FAILED | wc -l)
    54  failed_count_site2=$(s3-check-md5 -versions -access-key minioadmin -secret-key minioadmin -endpoint http://site2-nginx:9002 -bucket testbucket 2>&1 | grep FAILED | wc -l)
    55  
    56  if [ $failed_count_site1 -ne 0 ]; then
    57  	echo "failed with multipart on site1 uploads"
    58  	exit 1
    59  fi
    60  
    61  if [ $failed_count_site2 -ne 0 ]; then
    62  	echo "failed with multipart on site2 uploads"
    63  	exit 1
    64  fi
    65  
    66  ./mc cp -r --quiet /usr/bin site1/testbucket/
    67  
    68  sleep 5
    69  
    70  failed_count_site1=$(s3-check-md5 -versions -access-key minioadmin -secret-key minioadmin -endpoint http://site1-nginx:9001 -bucket testbucket 2>&1 | grep FAILED | wc -l)
    71  failed_count_site2=$(s3-check-md5 -versions -access-key minioadmin -secret-key minioadmin -endpoint http://site2-nginx:9002 -bucket testbucket 2>&1 | grep FAILED | wc -l)
    72  
    73  ## we do not need to fail here, since we are going to test
    74  ## upgrading to master, healing and being able to recover
    75  ## the last version.
    76  if [ $failed_count_site1 -ne 0 ]; then
    77  	echo "failed with multipart on site1 uploads ${failed_count_site1}"
    78  fi
    79  
    80  if [ $failed_count_site2 -ne 0 ]; then
    81  	echo "failed with multipart on site2 uploads ${failed_count_site2}"
    82  fi
    83  
    84  export RELEASE=${1}
    85  
    86  docker-compose -f docker-compose-site1.yaml up -d
    87  docker-compose -f docker-compose-site2.yaml up -d
    88  
    89  ./mc ready site1/
    90  ./mc ready site2/
    91  
    92  for i in $(seq 1 10); do
    93  	# mc admin heal -r --remove when used against a LB endpoint
    94  	# behaves flaky, let this run 10 times before giving up
    95  	./mc admin heal -r --remove --json site1/ 2>&1 >/dev/null
    96  	./mc admin heal -r --remove --json site2/ 2>&1 >/dev/null
    97  done
    98  
    99  failed_count_site1=$(s3-check-md5 -versions -access-key minioadmin -secret-key minioadmin -endpoint http://site1-nginx:9001 -bucket testbucket 2>&1 | grep FAILED | wc -l)
   100  failed_count_site2=$(s3-check-md5 -versions -access-key minioadmin -secret-key minioadmin -endpoint http://site2-nginx:9002 -bucket testbucket 2>&1 | grep FAILED | wc -l)
   101  
   102  if [ $failed_count_site1 -ne 0 ]; then
   103  	echo "failed with multipart on site1 uploads"
   104  	exit 1
   105  fi
   106  
   107  if [ $failed_count_site2 -ne 0 ]; then
   108  	echo "failed with multipart on site2 uploads"
   109  	exit 1
   110  fi
   111  
   112  cleanup
   113  
   114  ## change working directory
   115  cd ../../../