github.com/smartcontractkit/chainlink-testing-framework/libs@v0.0.0-20240227141906-ec710b4eb1a3/charts/geth-prysm/reinstall-eth2.sh (about)

     1  #!/bin/bash
     2  
     3  # Ask for release name to uninstall
     4  read -p "Enter the Helm release name to uninstall (press Enter to uninstall the first one found, if none is given): " release_name
     5  
     6  if [ -z "$release_name" ]; then
     7    read -p "No release name provided. Are you sure you want to uninstall the first Helm deployment? (y/n): " confirm_uninstall
     8    if [ "$confirm_uninstall" != "y" ]; then
     9      echo "Aborted uninstallation."
    10      exit 0
    11    fi
    12    # Run helm list and grab the name of the first deployment
    13    release_name=$(helm list -o json | jq -r '.[0].name')
    14  fi
    15  
    16  # Uninstall the specified release
    17  helm uninstall "$release_name"
    18  
    19  echo "Removing existing PV and PVC"
    20  
    21  # Delete PVC and PV
    22  PVC_NAME="chain-state-claim"
    23  PV_NAME="chain-state-storage"
    24  kubectl delete pvc $PVC_NAME
    25  kubectl delete pv $PV_NAME
    26  
    27  param=$1
    28  
    29  if [ -n "$param" ]; then
    30    values_file="Values-$param.yaml"
    31  else
    32    values_file="Values.yaml"
    33  fi
    34  
    35  # Run helm lint
    36  if ! helm lint . -f ./$values_file; then
    37    echo "Helm lint failed. Exiting."
    38    exit 1
    39  fi
    40  
    41  # Package the Helm chart in the current directory
    42  helm package .
    43  
    44  # Get the name of the generated chart package
    45  chart_package=$(ls -1 | grep '.tgz')
    46  
    47  if [ -z "$chart_package" ]; then
    48    echo "No Helm chart package found."
    49    exit 1
    50  fi
    51  
    52  deployment_name=$2
    53  if [ -z "$deployment_name" ]; then
    54    # If deployment name is empty, use --generate-name
    55    deployment_name="--generate-name"
    56  fi
    57  
    58  # Install the newly generated chart package
    59  helm install "$deployment_name" "$chart_package" -f ./$values_file
    60