github.com/ethersphere/bee/v2@v2.2.0/.github/bin/beekeeper_artifacts.sh (about)

     1  #!/bin/bash
     2  
     3  cluster_name=$1
     4  if [[ -z $cluster_name ]]; then
     5      echo "Cluster name has to be specified!"
     6      exit 1
     7  fi
     8  
     9  nodes=$(beekeeper print nodes --cluster-name $cluster_name  --log-verbosity 0)
    10  
    11  zip_files="debug/pprof/goroutine?debug=0"
    12  debug_text="debug/pprof/goroutine?debug=1 debug/pprof/goroutine?debug=2 metrics"
    13  debug_json="health node addresses chainstate transactions"
    14  business_json="peers reservestate blocklist topology balances consumed timesettlements settlements chequebook/cheque chequebook/balance wallet stamps batches"
    15  api_json="tags pins"
    16  
    17  for n in $nodes
    18  do
    19    mkdir -p dump/"$n"/{zip_files,debug_text,debug_json,business_json,api_json}
    20    for e in $zip_files
    21    do
    22      curl -s -o dump/"$n"/zip_files/${e//[\/\"\:\<\>\|\?\*]/_}.gzip "$n"-debug.localhost/$e
    23    done
    24    for e in $debug_text
    25    do
    26      curl -s -o dump/"$n"/debug_text/${e//[\/\"\:\<\>\|\?\*]/_} "$n"-debug.localhost/$e
    27    done
    28    for e in $debug_json
    29    do
    30      curl -s -o dump/"$n"/debug_json/${e//[\/\"\:\<\>\|\?\*]/_}.json "$n"-debug.localhost/$e
    31    done
    32    for e in $business_json
    33    do
    34      curl -s -o dump/"$n"/business_json/${e//[\/\"\:\<\>\|\?\*]/_}.json "$n"-debug.localhost/$e
    35    done
    36    for e in $api_json
    37    do
    38      curl -s -o dump/"$n"/api_json/${e//[\/\"\:\<\>\|\?\*]/_}.json "$n".localhost/$e
    39    done
    40  done
    41  kubectl -n local get pods > dump/kubectl_get_pods
    42  kubectl -n local logs -l app.kubernetes.io/part-of=bee --tail -1 --prefix -c bee > dump/kubectl_logs
    43  endpoint=$AWS_ENDPOINT
    44  if [[ "$endpoint" != http* ]]
    45  then
    46    endpoint=https://$endpoint
    47  fi
    48  fname=artifacts_${GITHUB_RUN_ID}.tar.gz
    49  tar -cz dump | aws --endpoint-url "$endpoint" s3 cp - s3://"$BUCKET_NAME"/"$fname"
    50  aws --endpoint-url "$endpoint" s3api put-object-acl --bucket "$BUCKET_NAME" --acl public-read --key "$fname"
    51  out="== Uploaded debugging artifacts to https://${BUCKET_NAME}.${AWS_ENDPOINT}/$fname =="
    52  ln=${#out}
    53  while [ "$ln" -gt 0 ]; do printf '=%.0s' '='; ((ln--));done;
    54  echo ""
    55  echo "$out"
    56  ln=${#out}
    57  while [ "$ln" -gt 0 ]; do printf '=%.0s' '='; ((ln--));done;
    58  echo ""