Skip to content

Commit

Permalink
Merge pull request #11 from Cosvernauta/Alpha
Browse files Browse the repository at this point in the history
Fix and News Release 4.2.9
  • Loading branch information
Cosvernauta authored Apr 26, 2023
2 parents 0e3de76 + 2ae95e9 commit 1a5991f
Show file tree
Hide file tree
Showing 4 changed files with 107 additions and 58 deletions.
8 changes: 5 additions & 3 deletions Example/DeployExample.conf
Original file line number Diff line number Diff line change
@@ -1,10 +1,12 @@
# Archivo de Configuracion para rdeployer.sh
# Sobre ambientes WebLogic
# 2018 (c)
#### Jimmy R.: jlili.salgado(a)gmail.com
RUTAWL=/Ruta/del/Domain/Home/Weblogic
#######################################
RUTAD=/Ruta/del/Domain/Home/Weblogic
APWAR=DeployExample.war
SRVNAMES=serverPto01
RTJK=/Ruta/donde/tomar/ComponenteWAR
NODE=ExampleNode01
RTINST=/ruta/del/servidor/RFC
RTINST=/ruta/para/copiar/componente/localmente
### DODEPLOY=[weblogic|jboss|esb]
DODEPLOY=weblogic
19 changes: 19 additions & 0 deletions Example/DeployExampleESB.conf
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
# Archivo de Configuracion para rdeployer.sh
# Sobre ambientes WebLogic
# 2018 (c)
######################################
RUTAD=/Ruta/del/Domain/Home/ESB
APWAR=DeployExampleESB.jar
SRVNAMES=serverPto01
# XML para reapuntes con ESB
PROJECTCONF=DeployExample.xml
########################
# Variables por default
########################
OSBKEY=osb
PROJECTNAME=default
RTJK=/Ruta/donde/tomar/ComponenteWAR
NODE=ExampleNode01ESB
RTINST=/ruta/del/servidor/RFC
### DODEPLOY=[weblogic|jboss|esb]
DODEPLOY=esb
11 changes: 8 additions & 3 deletions ROADMAP
Original file line number Diff line number Diff line change
Expand Up @@ -9,19 +9,24 @@ ROADMAP rdeployer-plugin para JK,UC
# - (New) ANSICOLOR ahora se puede desactivar en conf.
#
# 4.2.2 - 140922-0120 - (Bug) Dependencia cuando es Rollback, de revisar componente, por lo cual ya no
# revisará si el componente existe en situaciones de RB.
# revisará si el componente existe en situaciones de RB.
#
# 4.2.4 - 240922-1347 - (Bug) Módulo JBoss al momento de stop y start.
# - (New) Impresión de firma en txt, para complemento con Jenkins,
# usando un plugin llamado "Build Name and Description Setter".
# usando un plugin llamado "Build Name and Description Setter".
#
# 4.2.6 - 101022-1535 - (Bug) Modulo para problemas con rollbacks con error, se crea temp para los puntos
# de montaje de cada componente. fnErrorExecute, fnEstructuraTemp
# de montaje de cada componente. fnErrorExecute, fnEstructuraTemp
#
# 4.2.7 - 101022-2000 - (New) Funcion para obtener servers o instancias a nivel JBoss.
#
# 4.2.8 - 120123-2011 - (Fix) Se adecua intepretacion de JBoss 7.2 en adelante, para modos kill.
#
# 4.2.9 - 210323-1151 - (Fix) Se realiza validacion que existan los plugins de cada uno (Weblogic/ESB/Jboss)
# - (New) Imprime las instancias cuando no estan disponibles para Weblogic como WARN.
# 250423-1837 - (Fix) Cuando componente coincida con el prev, se omite su instalacion y solo
# se ejecutara el deploy.
#
# 4.2.x - - (Dev) Construir modulo fnValidaEstructuraRB para prev con FIX.
# - (Dev) Checar estructura de xml, cuando es por RFC su instalacion.
# - (Dev) Programacion de URL usando la que despliega JK en el plugin.
Expand Down
127 changes: 75 additions & 52 deletions rdeployer.sh
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,8 @@ U_HOUR="$(date '+%H%M')"
U_DATE="$(date '+%Y%m%d')"
U_TIME="${U_DATE}${U_HOUR}"
U_MES="$(date '+%m')"
>version.txt # Inicializando, para cualquier tipo de error en primera ejecución.

if [ "${PluginLauncher}" == "UrbanCode" ]
then
if [ -f BNUMBER.prc ]
Expand All @@ -51,7 +53,7 @@ APPLOG=${APNAME}.${BUILD_NUMBER}.log # 230319-1528
APPID=${APNAME}${BUILD_NUMBER} # 070919-1736
#[ "${CICD}" == "Jenkins" ] && APPLOG=${APNAME}.${BUILD_NUMBER}.log # 230319-1528 140921-0836
#[ "${CICD}" == "Jenkins" ] && APPID=${APNAME}${BUILD_NUMBER} || APPID=${APNAME} # 070919-1736 140921-0836
VERSION="4.2.8"
VERSION="4.2.9"
export monthnames=(Invalid Ene Feb Mar Abr May Jun Jul Ago Sep Oct Nov Dic)
YEAR="$(date '+%Y')"
MES=${monthnames[${U_MES#0}]}
Expand Down Expand Up @@ -228,6 +230,9 @@ else
if [ ${WARNG} -gt 0 ]
then
msg "Se encontraron que algunas instancias no estaban disponibles, checar salida del log en la url anteriormente mostrada" "WARN"
WARNINST=$(grep "Unable to contact" ${APPLOG}| awk '{print $5}'|sort|uniq) # 210323-1151
msg "Instancias con problemas:" "WARN"
msg "${WARNINST}" "WARN"
vEXIT=4
fi
#[ "$NPROD" == "1" ] && RTINST=$(dirname $(grep "Starting task with path" ${APPLOG} | awk -F":" '{print $4}'))
Expand Down Expand Up @@ -375,7 +380,7 @@ fnCheckInstJB()
for HC in $(${JB_HOME}/bin/jboss-cli.sh ${OPTIONS} --command="ls host=")
do
grpInfo=$(${JB_HOME}/bin/jboss-cli.sh ${OPTIONS} --command="/host=${HC}:resolve-expression-on-domain" | grep ${Grp} | awk '{print $1,$5,$7}'| sed 's/{//g'|sed 's/"//g')
echo "${grpInfo}" >> ${APPLOG}
echo "${grpInfo}" | grep .. >> ${APPLOG}
done
done

Expand Down Expand Up @@ -526,7 +531,7 @@ msg "Validando variables de entorno Jenkins:" "INFO"

if [ -z ${WEBLOGIC_HOME} ] && [ -z ${APHOME} ] && [ -z ${JB_HOME} ] && [ -z ${OSB_HOME} ] && [ -z ${NPROD} ] && [ -z ${JAVA_HOME} ]
then
msg "No esta configurado Plugin rdeployer correctamente en Jenkins" "ERROR"
msg "No esta configurado Plugin rdeployer correctamente en ${PluginLauncher}" "ERROR"
exit 1
else
msg "Variables set correctamente." "OK"
Expand Down Expand Up @@ -598,44 +603,51 @@ fi
fnEstructuraNew()
{
vCOMP=$1
RUTA_COPIA="${RTINST}/${YEAR}/${MES}/${NRFC}"
msg "Creando comando para estructura de directorios:" "INFO"
msg "${RTINST}" "DEBUG"
msg "${YEAR}" "DEBUG"
msg "${MES}" "DEBUG"
CMD1="mkdir -p ${RUTA_COPIA}"
ssh -q ${IPSRV} "${CMD1}"
# 080320-2358 Se actualiza la forma de estructura con mas validaciones.
msg "Creando comando para mover instalación que exista:" "INFO"
msg "backup ${RTINST}/${vCOMP}.prev" "DEBUG"
CMD1="[ ! -d ${RTINST}/.bck ] && mkdir ${RTINST}/.bck"
CMD1="$CMD1;[ -f ${RTINST}/${vCOMP}.prev ] && mv ${RTINST}/${vCOMP}.prev ${RTINST}/.bck/${vCOMP}.prev.${U_TIME}"
msg "backup ${RTINST}/${vCOMP}" "DEBUG"
CMD1="$CMD1;[ -f ${RTINST}/${vCOMP} ] && cp -rp ${RTINST}/${vCOMP} ${RTINST}/${vCOMP}.prev"
CMD1="$CMD1;[ -d ${RTINST}/.bck ] && ls -ltr ${RTINST}/.bck/${vCOMP}.prev.${U_TIME}"
CMD1="$CMD1;[ -f ${RTINST}/${vCOMP}.prev ] && ls -ltr ${RTINST}/${vCOMP}.prev"

msg "Creando comando para punto de montaje como liga suave:" "INFO"
msg "remove ${RTINST}/${vCOMP}" "DEBUG"
CMD1="$CMD1;[ -f ${RTINST}/${vCOMP} ] && rm -rf ${RTINST}/${vCOMP}"
msg "link ${RUTA_COPIA}/${vCOMP} ${RTINST}/${vCOMP}" "DEBUG"
CMD1="$CMD1;ln -s ${RUTA_COPIA}/${vCOMP} ${RTINST}/${vCOMP}"

msg "Copiando el componente en el directorio:" "INFO"
msg "${RTJK}/${vCOMP}" "DEBUG"
msg "${IPSRV}:${RUTA_COPIA}/." "DEBUG"
scp -qrp ${RTJK}/${vCOMP} ${IPSRV}:${RUTA_COPIA}/.

if [ $? -gt 0 ]
then
msg "Error al copiar el componente ${vCOMP}" "ERROR"
vFirmaActual=$(ssh -q ${IPSRV} "md5sum ${RTINST}/${vCOMP}" | awk '{print $1}') #250423-1837
vFirmaNewComponente=$(md5sum ${RTJK}/${vCOMP} | awk '{print $1}') #250423-1837

if [ "${vFirmaActual}" != "${vFirmaNewComponente}" ]; then #250423-1837
RUTA_COPIA="${RTINST}/${YEAR}/${MES}/${NRFC}"
msg "Creando comando para estructura de directorios:" "INFO"
msg "${RTINST}" "DEBUG"
msg "${YEAR}" "DEBUG"
msg "${MES}" "DEBUG"
CMD1="mkdir -p ${RUTA_COPIA}"
ssh -q ${IPSRV} "${CMD1}"
# 080320-2358 Se actualiza la forma de estructura con mas validaciones.
msg "Creando comando para mover instalación que exista:" "INFO"
msg "backup ${RTINST}/${vCOMP}.prev" "DEBUG"
CMD1="[ ! -d ${RTINST}/.bck ] && mkdir ${RTINST}/.bck"
CMD1="$CMD1;[ -f ${RTINST}/${vCOMP}.prev ] && mv ${RTINST}/${vCOMP}.prev ${RTINST}/.bck/${vCOMP}.prev.${U_TIME}"
msg "backup ${RTINST}/${vCOMP}" "DEBUG"
CMD1="$CMD1;[ -f ${RTINST}/${vCOMP} ] && cp -rp ${RTINST}/${vCOMP} ${RTINST}/${vCOMP}.prev"
CMD1="$CMD1;[ -d ${RTINST}/.bck ] && ls -ltr ${RTINST}/.bck/${vCOMP}.prev.${U_TIME}"
CMD1="$CMD1;[ -f ${RTINST}/${vCOMP}.prev ] && ls -ltr ${RTINST}/${vCOMP}.prev"

msg "Creando comando para punto de montaje como liga suave:" "INFO"
msg "remove ${RTINST}/${vCOMP}" "DEBUG"
CMD1="$CMD1;[ -f ${RTINST}/${vCOMP} ] && rm -rf ${RTINST}/${vCOMP}"
msg "link ${RUTA_COPIA}/${vCOMP} ${RTINST}/${vCOMP}" "DEBUG"
CMD1="$CMD1;ln -s ${RUTA_COPIA}/${vCOMP} ${RTINST}/${vCOMP}"

msg "Copiando el componente en el directorio:" "INFO"
msg "${RTJK}/${vCOMP}" "DEBUG"
msg "${IPSRV}:${RUTA_COPIA}/." "DEBUG"
scp -qrp ${RTJK}/${vCOMP} ${IPSRV}:${RUTA_COPIA}/.

if [ $? -gt 0 ]
then
msg "Error al copiar el componente ${vCOMP}" "ERROR"
exit 1
fi
fi

msg "Ejecutando comandos de estructura:" "INFO"
msg "$CMD1" "DEBUG"
ssh -q ${IPSRV} "${CMD1}"
msg "Se termina ejecución" "OK"
msg "Ejecutando comandos de estructura:" "INFO"
msg "$CMD1" "DEBUG"
ssh -q ${IPSRV} "${CMD1}"
msg "Se termina ejecución" "OK"
else
msg "Componente tiene misma firma, se omite su copiado" "WARN" #250423-1837
fi #250423-1837

}

Expand Down Expand Up @@ -708,7 +720,7 @@ fnValidateFile()
if [ ! -f ${FileVal} ]; then
msg "No existe Archivo ${FileVal}, favor de validar" "ERROR"
else
msg "${FileVal} correcto" "OK"
msg "${FileVal} seems right!" "DEBUG"
fi

}
Expand Down Expand Up @@ -738,17 +750,11 @@ case "${CONN}" in
;;
esac

#if [ "${CONN}" == "ERROR" ]
#then
# msg "No se puede obtener usuario y password en el archivo de configuracion" "ERROR"
# exit 1
#else
msg "Datos de consola encontrados." "OK"
USER=$(echo $CONN | awk '{print $1}')
PASSWD=$(echo $CONN | awk '{print $2}')
IPSRV=$(echo $CONN | awk '{print $3}')
PORT=$(echo $CONN | awk '{print $4}')
#fi
msg "Datos de consola encontrados." "OK"
USER=$(echo $CONN | awk '{print $1}')
PASSWD=$(echo $CONN | awk '{print $2}')
IPSRV=$(echo $CONN | awk '{print $3}')
PORT=$(echo $CONN | awk '{print $4}')

export USER
export PASSWD
Expand Down Expand Up @@ -791,7 +797,12 @@ fnPluginInfo() {
case $1 in
"weblogic")
echo "===== PLUGIN VERSION =====" >> ${APPLOG}
${JAVA_HOME}/bin/java -Xms${vMemoryIni} -Xmx${vMemoryMax} -cp ${WEBLOGIC_HOME}/server/lib/weblogic.jar weblogic.Deployer -version >> ${APPLOG}
if [ -f ${WEBLOGIC_HOME}/server/lib/weblogic.jar ]; then
${JAVA_HOME}/bin/java -Xms${vMemoryIni} -Xmx${vMemoryMax} -cp ${WEBLOGIC_HOME}/server/lib/weblogic.jar weblogic.Deployer -version >> ${APPLOG}
else
msg "Plugin no encontrado en la ruta ${WEBLOGIC_HOME}" "ERROR"
exit 1
fi

if [ $? -gt 0 ]
then
Expand All @@ -800,6 +811,17 @@ case $1 in
fi
;;

"jboss") # 210323-1151
echo "===== PLUGIN VERSION =====" >> ${APPLOG}

if [ -f ${JB_HOME}/bin/jboss-cli.sh ]; then
msg "JBoss CLI Detected" >> ${APPLOG}
else
msg "No se encuentra el archivo plugin para Jboss en ${JB_HOME}" "ERROR"
exit 1
fi
;;

"esb")
if [ -f ${OSB_HOME}/osb/tools/configjar/setenv.sh ]
then
Expand Down Expand Up @@ -899,6 +921,7 @@ case $DODEPLOY in
fnFirma ${NPROD} ${APWAR} # Variable NPROD obtenido de Jenkins
;;
"jboss")
fnPluginInfo jboss # 210323-1151
msg "Plugin cargado: JBoss_CLI" "INFO"
fnGetConsole JBoss
[ "$NPROD" == "0" ] && fnTipoEstructuraInstall ${TYPEINST} # 120521-0111
Expand Down

0 comments on commit 1a5991f

Please sign in to comment.