github.com/minio/minio@v0.0.0-20240328213742-3f72439b8a27/buildscripts/resolve-right-versions.sh (about) 1 #!/bin/bash -e 2 3 set -E 4 set -o pipefail 5 set -x 6 set -e 7 8 WORK_DIR="$PWD/.verify-$RANDOM" 9 MINIO_CONFIG_DIR="$WORK_DIR/.minio" 10 MINIO=("$PWD/minio" --config-dir "$MINIO_CONFIG_DIR" server) 11 12 if [ ! -x "$PWD/minio" ]; then 13 echo "minio executable binary not found in current directory" 14 exit 1 15 fi 16 17 function start_minio_5drive() { 18 start_port=$1 19 20 export MINIO_ROOT_USER=minio 21 export MINIO_ROOT_PASSWORD=minio123 22 export MC_HOST_minio="http://minio:minio123@127.0.0.1:${start_port}/" 23 unset MINIO_KMS_AUTO_ENCRYPTION # do not auto-encrypt objects 24 export MINIO_CI_CD=1 25 26 MC_BUILD_DIR="mc-$RANDOM" 27 if ! git clone --quiet https://github.com/minio/mc "$MC_BUILD_DIR"; then 28 echo "failed to download https://github.com/minio/mc" 29 purge "${MC_BUILD_DIR}" 30 exit 1 31 fi 32 33 (cd "${MC_BUILD_DIR}" && go build -o "$WORK_DIR/mc") 34 35 # remove mc source. 36 purge "${MC_BUILD_DIR}" 37 38 "${WORK_DIR}/mc" cp --quiet -r "buildscripts/cicd-corpus/" "${WORK_DIR}/cicd-corpus/" 39 40 "${MINIO[@]}" --address ":$start_port" "${WORK_DIR}/cicd-corpus/disk{1...5}" >"${WORK_DIR}/server1.log" 2>&1 & 41 pid=$! 42 disown $pid 43 sleep 5 44 45 if ! ps -p ${pid} 1>&2 >/dev/null; then 46 echo "server1 log:" 47 cat "${WORK_DIR}/server1.log" 48 echo "FAILED" 49 purge "$WORK_DIR" 50 exit 1 51 fi 52 53 "${WORK_DIR}/mc" stat minio/bucket/testobj 54 55 pkill minio 56 sleep 3 57 } 58 59 function main() { 60 start_port=$(shuf -i 10000-65000 -n 1) 61 62 start_minio_5drive ${start_port} 63 } 64 65 function purge() { 66 rm -rf "$1" 67 } 68 69 (main "$@") 70 rv=$? 71 purge "$WORK_DIR" 72 exit "$rv"