Edited wizzard, runner: first run - do not run CI!
This commit is contained in:
parent
8aee30f8d2
commit
68670d16f2
|
@ -1,5 +1,18 @@
|
||||||
#!/bin/bash
|
#!/bin/bash
|
||||||
|
|
||||||
|
function detectorTryInit(){
|
||||||
|
# repo dir
|
||||||
|
dir=$1
|
||||||
|
history=$DET_DIR/detectorExecuted
|
||||||
|
|
||||||
|
if ! [ -f $history ]
|
||||||
|
then
|
||||||
|
echo "Initializing detector cache"
|
||||||
|
# initialize seed
|
||||||
|
git --git-dir $dir log --all --format="%H" > $history
|
||||||
|
fi
|
||||||
|
}
|
||||||
|
|
||||||
function detectorCheckCommit(){
|
function detectorCheckCommit(){
|
||||||
sha=$1
|
sha=$1
|
||||||
history=$DET_DIR/detectorExecuted
|
history=$DET_DIR/detectorExecuted
|
||||||
|
|
|
@ -68,6 +68,9 @@ then
|
||||||
exit 0
|
exit 0
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
# try to init cache
|
||||||
|
detectorTryInit $repodir
|
||||||
|
|
||||||
# first, solve commits
|
# first, solve commits
|
||||||
# branches that were deleted or merged
|
# branches that were deleted or merged
|
||||||
find $DET_BRANCHES -type f | sort | while read branchpath
|
find $DET_BRANCHES -type f | sort | while read branchpath
|
||||||
|
@ -158,5 +161,5 @@ do
|
||||||
done
|
done
|
||||||
|
|
||||||
# save hash to keep things clear
|
# save hash to keep things clear
|
||||||
#detectorSumPersist $repodir
|
detectorSumPersist $repodir
|
||||||
|
|
||||||
|
|
|
@ -71,6 +71,21 @@ function createConfigFile(){
|
||||||
EOF
|
EOF
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function createDetectorConfig(){
|
||||||
|
# $1 - file
|
||||||
|
local cfgFile=$1
|
||||||
|
|
||||||
|
mkdir -p $(dirname $cfgFile)
|
||||||
|
|
||||||
|
if [ $read_detector -eq 1 ]
|
||||||
|
then
|
||||||
|
cat > $cfgFile <<-EOF
|
||||||
|
# this file is config for detector
|
||||||
|
# now, it is empty - to disable detector, just delete it!
|
||||||
|
EOF
|
||||||
|
fi
|
||||||
|
}
|
||||||
|
|
||||||
function generateSSHKey(){
|
function generateSSHKey(){
|
||||||
# generates ssh key with $1 path and $2 description
|
# generates ssh key with $1 path and $2 description
|
||||||
local keyfile=$1/id_rsa
|
local keyfile=$1/id_rsa
|
||||||
|
@ -137,6 +152,19 @@ else
|
||||||
read_submodule_limit=N
|
read_submodule_limit=N
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
|
||||||
|
# determine CI?
|
||||||
|
echo -n "Do you want to enable CI support? (detector) [Y/n]"
|
||||||
|
read read_detector
|
||||||
|
[ -n "$read_detector" ] || read_detector=Y
|
||||||
|
if ! [[ "$read_detector" =~ ^[Yy]$ ]]
|
||||||
|
then
|
||||||
|
read_detector=0
|
||||||
|
else
|
||||||
|
read_detector=1
|
||||||
|
fi
|
||||||
|
|
||||||
|
|
||||||
root=/data/$dir_prefix-$read_project_name
|
root=/data/$dir_prefix-$read_project_name
|
||||||
# start generating config
|
# start generating config
|
||||||
mkdir -p $root/config
|
mkdir -p $root/config
|
||||||
|
@ -166,6 +194,7 @@ then
|
||||||
reuseSSHKey $root/config/auth/ssh/id_rsa
|
reuseSSHKey $root/config/auth/ssh/id_rsa
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
|
||||||
echo "First run - initialization of repos..."
|
echo "First run - initialization of repos..."
|
||||||
if ! env BASE=$root run-checker
|
if ! env BASE=$root run-checker
|
||||||
then
|
then
|
||||||
|
@ -177,6 +206,7 @@ then
|
||||||
rm -Rf $root
|
rm -Rf $root
|
||||||
fi
|
fi
|
||||||
else
|
else
|
||||||
|
createDetectorConfig $root/config/detector.cfg
|
||||||
echo "Setup has finished!"
|
echo "Setup has finished!"
|
||||||
touch $root/.enabled
|
touch $root/.enabled
|
||||||
fi
|
fi
|
||||||
|
|
Loading…
Reference in New Issue
Block a user