Skip to content
Snippets Groups Projects
Commit d10d8b56 authored by Hahn Axel (hahn)'s avatar Hahn Axel (hahn)
Browse files

Merge branch '6877_final_status_in_log' into 'master'

6877 final status in log

See merge request !10
parents 77a25805 199161eb
No related branches found
No related tags found
1 merge request!106877 final status in log
#!/usr/bin/env bash
# ======================================================================
#
# DEPLOYMENT CLIENT :: CHECK STATUS
#
# ----------------------------------------------------------------------
# 2023-12-11 v0.1 <axel.hahn@iml.unibe.ch> first lines...
# ======================================================================
# ----------------------------------------------------------------------
# CONFIG
# ----------------------------------------------------------------------
cd $( dirname $0 )
selfdir=$( /bin/pwd )
logdir=/var/log/imldeployment-client
tmpfile=/tmp/deploystatus.log
typeset -i iErrors=0
typeset -i iCount=0
# ----------------------------------------------------------------------
# FUNCTIONS
# ----------------------------------------------------------------------
# get a list profiles by searching a config.sh
# no param
function getprofiles(){
find ${selfdir}/profiles/ -name "config.sh" | rev | cut -f 2 -d "/" | rev
}
# ----------------------------------------------------------------------
# MAIN
# ----------------------------------------------------------------------
for myprofile in $( getprofiles )
do
iCount+=1
logfile=$( ls -tr1 ${logdir}/${myprofile}__* | tail -1 )
lastline=$( tail -1 ${logfile} )
if grep "^OK:" <<< $lastline >/dev/null; then
echo "OK: $myprofile - $logfile"
else
iErrors+=1
echo "ERROR: $myprofile - $logfile"
echo " Last lines:"
tail -10 "${logfile}" | sed "s#^# #g"
echo
fi
done > "$tmpfile"
if [ $iCount -eq 0 ]; then
echo "Deployment No profile was created yet."
else
if [ $iErrors -eq 0 ]; then
echo -n "OK"
else
echo -n "ERROR"
fi
echo " Deployment ... Profiles: $iCount ... Errors: $iErrors"
cat "$tmpfile"
fi
rm -f "$tmpfile"
exit $iErrors
# ----------------------------------------------------------------------
#!/usr/bin/env bash #!/usr/bin/env bash
# ====================================================================== # ======================================================================
# #
# DEPLOYMENT POC CLIENT # DEPLOYMENT CLIENT
# Roll out a package of IML CI server on a target system.
# #
# ---------------------------------------------------------------------- # ----------------------------------------------------------------------
# 2021-04-19 v0.1 <axel.hahn@iml.unibe.ch> initial version # 2021-04-19 v0.1 <axel.hahn@iml.unibe.ch> initial version
...@@ -14,6 +15,7 @@ ...@@ -14,6 +15,7 @@
# 2022-11-24 v0.8 <axel.hahn@iml.unibe.ch> tar -xzf without dot as 2nd param # 2022-11-24 v0.8 <axel.hahn@iml.unibe.ch> tar -xzf without dot as 2nd param
# 2022-11-25 v0.9 <axel.hahn@iml.unibe.ch> support custom phase + file per project # 2022-11-25 v0.9 <axel.hahn@iml.unibe.ch> support custom phase + file per project
# 2023-02-14 v1.0 <axel.hahn@unibe.ch> set v1.0 (no changes) # 2023-02-14 v1.0 <axel.hahn@unibe.ch> set v1.0 (no changes)
# 2023-02-14 v1.1 <axel.hahn@unibe.ch> show OK message in profile log
# ====================================================================== # ======================================================================
...@@ -288,6 +290,8 @@ function deploy(){ ...@@ -288,6 +290,8 @@ function deploy(){
cd $( dirname $0 ) cd $( dirname $0 )
echo "OK: ${IMLCI_PROJECT}"
} }
# delete old logfiles keeping the last N files # delete old logfiles keeping the last N files
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment