Skip to content

Commit

Permalink
chore: yarn prettier --write .github
Browse files Browse the repository at this point in the history
  • Loading branch information
michaelfig committed Jan 24, 2025
1 parent e5b8395 commit 405ac28
Show file tree
Hide file tree
Showing 2 changed files with 29 additions and 32 deletions.
21 changes: 12 additions & 9 deletions .github/actions/starship-action/install.sh
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ set -euo pipefail
# read config file from args into variable
CONFIGFILE="config.yaml"

SCRIPT_DIR=$( cd -- "$( dirname -- "${BASH_SOURCE[0]}" )" &> /dev/null && pwd )
SCRIPT_DIR=$(cd -- "$(dirname -- "${BASH_SOURCE[0]}")" &> /dev/null && pwd)
echo "Script dir: ${SCRIPT_DIR}"

# default values
Expand Down Expand Up @@ -43,7 +43,10 @@ function set_helm_args() {
if [[ "$scripts" == "null" ]]; then
return 0
fi
datadir="$(cd "$(dirname -- "${CONFIGFILE}")" >/dev/null; pwd -P)"
datadir="$(
cd "$(dirname -- "${CONFIGFILE}")" > /dev/null
pwd -P
)"
for script in $(yq -r ".chains[$i].scripts | keys | .[]" ${CONFIGFILE}); do
args="$args --set-file chains[$i].scripts.$script.data=$datadir/$(yq -r ".chains[$i].scripts.$script.file" ${CONFIGFILE})"
done
Expand All @@ -59,19 +62,19 @@ function install_chart() {

while [ $# -gt 0 ]; do
case "$1" in
-c|--config)
-c | --config)
CONFIGFILE="$2"
shift 2 # past argument=value
;;
-v|--version)
-v | --version)
HELM_CHART_VERSION="$2"
shift 2 # past argument
;;
-t|--timeout)
-t | --timeout)
TIMEOUT="$2"
shift 2 # past argument
;;
-n|--name)
-n | --name)
HELM_NAME="$2"
shift 2 # past argument
;;
Expand All @@ -87,12 +90,12 @@ while [ $# -gt 0 ]; do
DRY_RUN=1
shift 2 # past argument
;;
-*|--*)
-* | --*)
echo "Unknown option $1"
exit 1
;;
*)
;;
*) ;;

esac
done

Expand Down
40 changes: 17 additions & 23 deletions .github/actions/starship-action/port-forward.sh
Original file line number Diff line number Diff line change
Expand Up @@ -36,20 +36,20 @@ MONITORING_GRAFANA_PORT=8080

for i in "$@"; do
case $i in
-c=*|--config=*)
-c=* | --config=*)
CONFIGFILE="${i#*=}"
shift # past argument=value
;;
-n=*|--namespace=*)
-n=* | --namespace=*)
NAMESPACE="${i#*=}"
shift # past argument=value
;;
-*|--*)
-* | --*)
echo "Unknown option $i"
exit 1
;;
*)
;;
*) ;;

esac
done

Expand All @@ -62,16 +62,15 @@ if [[ $num_chains -gt -1 ]]; then
for i in $(seq 0 $num_chains); do
# derive chain pod name from chain id
# https://github.com/cosmology-tech/starship/blob/main/charts/devnet/templates/_helpers.tpl#L56
chain=$(yq -r ".chains[$i].id" ${CONFIGFILE} )
chain=$(yq -r ".chains[$i].id" ${CONFIGFILE})
chain=${chain/_/"-"}
localrpc=$(yq -r ".chains[$i].ports.rpc" ${CONFIGFILE} )
localgrpc=$(yq -r ".chains[$i].ports.grpc" ${CONFIGFILE} )
locallcd=$(yq -r ".chains[$i].ports.rest" ${CONFIGFILE} )
localrpc=$(yq -r ".chains[$i].ports.rpc" ${CONFIGFILE})
localgrpc=$(yq -r ".chains[$i].ports.grpc" ${CONFIGFILE})
locallcd=$(yq -r ".chains[$i].ports.rest" ${CONFIGFILE})
localexp=$(yq -r ".chains[$i].ports.exposer" ${CONFIGFILE})
localfaucet=$(yq -r ".chains[$i].ports.faucet" ${CONFIGFILE})
color yellow "chains: forwarded $chain"
if [[ $(yq -r ".chains[$i].cometmock.enabled" $CONFIGFILE) == "true" ]];
then
if [[ $(yq -r ".chains[$i].cometmock.enabled" $CONFIGFILE) == "true" ]]; then
[[ "$localrpc" != "null" ]] && color yellow " cometmock rpc to http://localhost:$localrpc" && kubectl port-forward pods/$chain-cometmock-0 $localrpc:$CHAIN_COMETMOCK_PORT --namespace $NAMESPACE > /dev/null 2>&1 &
else
[[ "$localrpc" != "null" ]] && color yellow " rpc to http://localhost:$localrpc" && kubectl port-forward pods/$chain-genesis-0 $localrpc:$CHAIN_RPC_PORT --namespace $NAMESPACE > /dev/null 2>&1 &
Expand All @@ -86,17 +85,16 @@ else
echo "No chains to port-forward: num: $num_chains"
fi


echo "Port forward relayers"
num_relayers=$(yq -r ".relayers | length - 1" ${CONFIGFILE})
if [[ $num_relayers -gt -1 ]]; then
for i in $(seq 0 $num_relayers); do
# derive chain pod name from chain id
# https://github.com/cosmology-tech/starship/blob/main/charts/devnet/templates/_helpers.tpl#L56
relayer=$(yq -r ".relayers[$i].name" ${CONFIGFILE} )
relayer=$(yq -r ".relayers[$i].type" ${CONFIGFILE} )-${relayer/_/"-"}
localrest=$(yq -r ".relayers[$i].ports.rest" ${CONFIGFILE} )
localexposer=$(yq -r ".relayers[$i].ports.exposer" ${CONFIGFILE} )
relayer=$(yq -r ".relayers[$i].name" ${CONFIGFILE})
relayer=$(yq -r ".relayers[$i].type" ${CONFIGFILE})-${relayer/_/"-"}
localrest=$(yq -r ".relayers[$i].ports.rest" ${CONFIGFILE})
localexposer=$(yq -r ".relayers[$i].ports.exposer" ${CONFIGFILE})
color yellow "relayers: forwarded $relayer"
[[ "$localrest" != "null" ]] && color yellow " rpc to http://localhost:$localrest" && kubectl port-forward pods/$relayer-0 $localrest:$RELAYER_REST_PORT --namespace $NAMESPACE > /dev/null 2>&1 &
[[ "$localexposer" != "null" ]] && color yellow " rpc to http://localhost:$localexposer" && kubectl port-forward pods/$relayer-0 $localexposer:$RELAYER_EXPOSER_PORT --namespace $NAMESPACE > /dev/null 2>&1 &
Expand All @@ -106,26 +104,22 @@ else
echo "No relayer to port-forward: num: $num_relayers"
fi


echo "Port forward services"

if [[ $(yq -r ".registry.enabled" $CONFIGFILE) == "true" ]];
then
if [[ $(yq -r ".registry.enabled" $CONFIGFILE) == "true" ]]; then
kubectl port-forward service/registry 8081:$REGISTRY_LCD_PORT --namespace $NAMESPACE > /dev/null 2>&1 &
kubectl port-forward service/registry 9091:$REGISTRY_GRPC_PORT --namespace $NAMESPACE > /dev/null 2>&1 &
sleep 1
color yellow "registry: forwarded registry lcd to grpc http://localhost:8081, to http://localhost:9091"
fi

if [[ $(yq -r ".explorer.enabled" $CONFIGFILE) == "true" ]];
then
if [[ $(yq -r ".explorer.enabled" $CONFIGFILE) == "true" ]]; then
kubectl port-forward service/explorer 8080:$EXPLORER_LCD_PORT --namespace $NAMESPACE > /dev/null 2>&1 &
sleep 1
color green "Open the explorer to get started.... http://localhost:8080"
fi

if [[ $(yq -r ".monitoring.enabled" $CONFIGFILE) == "true" ]];
then
if [[ $(yq -r ".monitoring.enabled" $CONFIGFILE) == "true" ]]; then
color yellow "monitoring port forward:"
localgrafana=$(yq -r ".monitoring.ports.grafana" ${CONFIGFILE})
localprometheus=$(yq -r ".monitoring.ports.prometheus" ${CONFIGFILE})
Expand Down

0 comments on commit 405ac28

Please sign in to comment.