v2.2.0
===================================================================== --- New Scripts -------------------------- zsh ) amazon EKS - aws/eks/login --- Changes ------------------------------ - moved global .config to global/config.zsh - moved various global configurations to global/ --- Bug Fixes ---------------------------- - REDIS_AUTH no longer required to attempt connection - global configurations now propagate to non-zsh scripts
This commit is contained in:
parent
89e899d49d
commit
e8bb889789
32
global/common.zsh
Normal file
32
global/common.zsh
Normal file
@ -0,0 +1,32 @@
|
||||
#####################################################################
|
||||
|
||||
[ ! $SCWRYPTS_ROOT ] && SCWRYPTS_ROOT="$(dirname ${0:a:h})"
|
||||
|
||||
source "${0:a:h}/config.zsh"
|
||||
|
||||
#####################################################################
|
||||
|
||||
__SCWRYPT=1 # arbitrary; indicates scwrypts exists
|
||||
|
||||
__PREFERRED_PYTHON_VERSIONS=(3.10 3.9)
|
||||
__NODE_VERSION=18.0.0
|
||||
|
||||
__ENV_TEMPLATE=$SCWRYPTS_ROOT/.env.template
|
||||
|
||||
#####################################################################
|
||||
|
||||
__RUN_SCWRYPT() {
|
||||
((SUBSCWRYPT+=1))
|
||||
printf ' '; printf '--%.0s' {1..$SUBSCWRYPT}; printf " ($SUBSCWRYPT) "
|
||||
echo " BEGIN SUBSCWRYPT : $(basename $1)"
|
||||
|
||||
SUBSCWRYPT=$SUBSCWRYPT SCWRYPTS_ENV=$ENV_NAME \
|
||||
"$SCWRYPTS_ROOT/scwrypts" $@
|
||||
EXIT_CODE=$?
|
||||
|
||||
printf ' '; printf '--%.0s' {1..$SUBSCWRYPT}; printf " ($SUBSCWRYPT) "
|
||||
echo " END SUBSCWRYPT : $(basename $1)"
|
||||
((SUBSCWRYPT-=1))
|
||||
|
||||
return $EXIT_CODE
|
||||
}
|
@ -14,6 +14,8 @@ SCWRYPTS_LOG_PATH="$SCWRYPTS_DATA_PATH/logs"
|
||||
SCWRYPTS_OUTPUT_PATH="$SCWRYPTS_DATA_PATH/output"
|
||||
SCWRYPTS_VIRTUALENV_PATH="$SCWRYPTS_DATA_PATH/virtualenv"
|
||||
|
||||
#####################################################################
|
||||
|
||||
[ -f $SCWRYPTS_CONFIG_PATH/config ] && source $SCWRYPTS_CONFIG_PATH/config
|
||||
|
||||
#####################################################################
|
||||
@ -21,15 +23,12 @@ SCWRYPTS_VIRTUALENV_PATH="$SCWRYPTS_DATA_PATH/virtualenv"
|
||||
[ ! -d $SCWRYPTS_CONFIG_PATH ] && mkdir -p $SCWRYPTS_CONFIG_PATH
|
||||
[ ! -d $SCWRYPTS_DATA_PATH ] && mkdir -p $SCWRYPTS_DATA_PATH
|
||||
|
||||
|
||||
[ ! -d $SCWRYPTS_ENV_PATH ] && mkdir -p $SCWRYPTS_ENV_PATH
|
||||
[ ! -d $SCWRYPTS_LOG_PATH ] && mkdir -p $SCWRYPTS_LOG_PATH
|
||||
|
||||
[ ! -d $SCWRYPTS_OUTPUT_PATH ] && mkdir -p $SCWRYPTS_OUTPUT_PATH
|
||||
[ ! -d $SCWRYPTS_VIRTUALENV_PATH ] && mkdir -p $SCWRYPTS_VIRTUALENV_PATH
|
||||
|
||||
#####################################################################
|
||||
|
||||
export \
|
||||
SCWRYPTS_CONFIG_PATH \
|
||||
SCWRYPTS_DATA_PATH \
|
||||
@ -40,4 +39,6 @@ export \
|
||||
SCWRYPTS_OUTPUT_PATH \
|
||||
SCWRYPTS_VIRTUALENV_PATH \
|
||||
;
|
||||
|
||||
#####################################################################
|
||||
true
|
@ -8,7 +8,7 @@ class RedisClient(StrictRedis):
|
||||
super().__init__(
|
||||
host = getenv('REDIS_HOST'),
|
||||
port = getenv('REDIS_PORT'),
|
||||
password = getenv('REDIS_AUTH'),
|
||||
password = getenv('REDIS_AUTH', required=False),
|
||||
decode_responses = True,
|
||||
)
|
||||
|
||||
|
6
zsh/aws/eks/common.zsh
Normal file
6
zsh/aws/eks/common.zsh
Normal file
@ -0,0 +1,6 @@
|
||||
_DEPENDENCIES+=(
|
||||
kubectl
|
||||
)
|
||||
_REQUIRED_ENV+=()
|
||||
source ${0:a:h}/../common.zsh
|
||||
#####################################################################
|
19
zsh/aws/eks/login
Executable file
19
zsh/aws/eks/login
Executable file
@ -0,0 +1,19 @@
|
||||
#!/bin/zsh
|
||||
_DEPENDENCIES+=()
|
||||
_REQUIRED_ENV+=()
|
||||
source ${0:a:h}/common.zsh
|
||||
#####################################################################
|
||||
|
||||
__STATUS "performing AWS ECR docker login"
|
||||
|
||||
CLUSTER_NAME=$(\
|
||||
_AWS eks list-clusters \
|
||||
| jq -r '.[] | .[]' \
|
||||
| __FZF 'select a cluster'
|
||||
)
|
||||
[ ! $CLUSTER_NAME ] && __ABORT
|
||||
|
||||
__STATUS "updating kubeconfig for '$CLUSTER_NAME'"
|
||||
_AWS eks update-kubeconfig --name $CLUSTER_NAME \
|
||||
&& __SUCCESS "kubeconfig updated with '$CLUSTER_NAME'" \
|
||||
|| __ERROR "failed to update kubeconfig; do you have permissions to access '$CLUSTER_NAME'?"
|
@ -1,17 +1,8 @@
|
||||
#####################################################################
|
||||
|
||||
[ ! $SCWRYPTS_ROOT ] && SCWRYPTS_ROOT="$(dirname ${0:a:h})"
|
||||
|
||||
__PREFERRED_PYTHON_VERSIONS=(3.10 3.9)
|
||||
__NODE_VERSION=18.0.0
|
||||
__ENV_TEMPLATE=$SCWRYPTS_ROOT/.env.template
|
||||
|
||||
__SCWRYPT=1
|
||||
|
||||
source $SCWRYPTS_ROOT/.config
|
||||
source ${0:a:h}/utils/utils.module.zsh || {
|
||||
[ $DONT_EXIT ] && return 1 || exit 1
|
||||
}
|
||||
source ${0:a:h}/../global/common.zsh
|
||||
source ${0:a:h}/utils/utils.module.zsh \
|
||||
|| { [ $DONT_EXIT ] && return 1 || exit 1; }
|
||||
|
||||
#####################################################################
|
||||
|
||||
@ -26,33 +17,15 @@ __GET_ENV_NAMES() { __GET_ENV_FILES | sed 's/.*\///'; }
|
||||
__GET_ENV_FILE() { echo "$SCWRYPTS_CONFIG_PATH/env/$1"; }
|
||||
|
||||
__SELECT_OR_CREATE_ENV() { __GET_ENV_NAMES | __FZF_TAIL 'select/create an environment'; }
|
||||
__SELECT_ENV() { __GET_ENV_NAMES | __FZF 'select an environment'; }
|
||||
__SELECT_ENV() { __GET_ENV_NAMES | __FZF 'select an environment'; }
|
||||
|
||||
#####################################################################
|
||||
|
||||
__GET_AVAILABLE_SCRIPTS() {
|
||||
cd $SCWRYPTS_ROOT;
|
||||
find . -mindepth 2 -type f -executable \
|
||||
| grep -v '\.git' \
|
||||
| grep -v '\.env' \
|
||||
| grep -v 'node_modules' \
|
||||
| sed 's/^\.\///; s/\.[^.]*$//' \
|
||||
;
|
||||
}
|
||||
|
||||
#####################################################################
|
||||
|
||||
__RUN_SCWRYPT() {
|
||||
# run a scwrypt inside a scwrypt w/stack-depth indicators
|
||||
((SUBSCWRYPT+=1))
|
||||
printf ' '; printf '--%.0s' {1..$SUBSCWRYPT}; printf " ($SUBSCWRYPT) "
|
||||
echo " BEGIN SUBSCWRYPT : $(basename $1)"
|
||||
|
||||
SUBSCWRYPT=$SUBSCWRYPT SCWRYPTS_ENV=$ENV_NAME \
|
||||
"$SCWRYPTS_ROOT/scwrypts" $@
|
||||
EXIT_CODE=$?
|
||||
|
||||
printf ' '; printf '--%.0s' {1..$SUBSCWRYPT}; printf " ($SUBSCWRYPT) "
|
||||
echo " END SUBSCWRYPT : $(basename $1)"
|
||||
((SUBSCWRYPT-=1))
|
||||
|
||||
return $EXIT_CODE
|
||||
}
|
||||
|
2
zsh/scwrypts/configure
vendored
2
zsh/scwrypts/configure
vendored
@ -13,7 +13,7 @@ source ${0:a:h}/common.zsh
|
||||
echo '#'
|
||||
echo '# configuration for scwrypts'
|
||||
echo '#'
|
||||
sed -n '1d; /^###/q; p' $SCWRYPTS_ROOT/.config | sed '$d'
|
||||
sed -n '1d; /^###/q; p' $SCWRYPTS_ROOT/global/config.zsh | sed '$d'
|
||||
} > $SCWRYPTS_CONFIG_PATH/config
|
||||
|
||||
__EDIT $SCWRYPTS_CONFIG_PATH/config
|
||||
|
Loading…
Reference in New Issue
Block a user