start of a ci script
This commit is contained in:
commit
4d0af400e3
24
toci.sh
Executable file
24
toci.sh
Executable file
@ -0,0 +1,24 @@
|
||||
#!/usr/bin/bash
|
||||
|
||||
export STARTTIME=$(date)
|
||||
export TOCI_WORKING_DIR=$(mktemp -d)
|
||||
export TOCI_LOG_DIR=$(mktemp -d)
|
||||
|
||||
echo $TOCI_LOG_DIR
|
||||
|
||||
STATUS=0
|
||||
|
||||
./toci_setup.sh > $TOCI_LOG_DIR/setup.out 2>&1 || STATUS=1
|
||||
if [ $STATUS == 0 ] ; then
|
||||
./toci_test.sh > $TOCI_LOG_DIR/test.out 2>&1 || STATUS=1
|
||||
fi
|
||||
./toci_cleanup.sh > $TOCI_LOG_DIR/cleanup.out 2>&1 || STATUS=1
|
||||
|
||||
cd $(dirname $TOCI_LOG_DIR)
|
||||
tar -czf - $(basename $TOCI_LOG_DIR) | ssh ec2-user@toci_results tar -C /var/www/html/toci -xzf -
|
||||
|
||||
if [ $STATUS == 0 ] ; then
|
||||
ssh ec2-user@toci_results "echo \<a href=\"$(basename $TOCI_LOG_DIR)\"\>$STARTTIME : OK\</a\>\<br/\> >> /var/www/html/toci/index.html ; chmod -R 775 /var/www/html/toci/*"
|
||||
else
|
||||
ssh ec2-user@toci_results "echo \<a style=\\\"COLOR: \#FF0000\\\" href=\"$(basename $TOCI_LOG_DIR)\"\>$STARTTIME : ERR\</a\>\<br/\> >> /var/www/html/toci/index.html ; chmod -R 775 /var/www/html/toci/*"
|
||||
fi
|
2
toci_cleanup.sh
Executable file
2
toci_cleanup.sh
Executable file
@ -0,0 +1,2 @@
|
||||
set -xe
|
||||
|
2
toci_setup.sh
Executable file
2
toci_setup.sh
Executable file
@ -0,0 +1,2 @@
|
||||
set -xe
|
||||
|
2
toci_test.sh
Executable file
2
toci_test.sh
Executable file
@ -0,0 +1,2 @@
|
||||
set -xe
|
||||
|
13
updated_launch.sh
Executable file
13
updated_launch.sh
Executable file
@ -0,0 +1,13 @@
|
||||
#!/usr/bin/env bash
|
||||
|
||||
LOCKFILE=/var/tmp/toci.lock
|
||||
GITREF=${1:-origin/master}
|
||||
|
||||
cd $(dirname $0)
|
||||
git fetch origin
|
||||
|
||||
# Exit if there is a script already running, otherwise update repo
|
||||
# TODO : fix small race condition here (probably not a problem)
|
||||
flock -x -n $LOCKFILE git reset --hard $GITREF || exit 0
|
||||
flock -x -n $LOCKFILE ./toci.sh
|
||||
|
Loading…
Reference in New Issue
Block a user