Edited wizzard, runner: first run - do not run CI!
This commit is contained in:
parent
8aee30f8d2
commit
68670d16f2
|
@ -1,5 +1,18 @@
|
|||
#!/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(){
|
||||
sha=$1
|
||||
history=$DET_DIR/detectorExecuted
|
||||
|
|
|
@ -68,6 +68,9 @@ then
|
|||
exit 0
|
||||
fi
|
||||
|
||||
# try to init cache
|
||||
detectorTryInit $repodir
|
||||
|
||||
# first, solve commits
|
||||
# branches that were deleted or merged
|
||||
find $DET_BRANCHES -type f | sort | while read branchpath
|
||||
|
@ -158,5 +161,5 @@ do
|
|||
done
|
||||
|
||||
# save hash to keep things clear
|
||||
#detectorSumPersist $repodir
|
||||
detectorSumPersist $repodir
|
||||
|
||||
|
|
|
@ -71,6 +71,21 @@ function createConfigFile(){
|
|||
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(){
|
||||
# generates ssh key with $1 path and $2 description
|
||||
local keyfile=$1/id_rsa
|
||||
|
@ -137,6 +152,19 @@ else
|
|||
read_submodule_limit=N
|
||||
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
|
||||
# start generating config
|
||||
mkdir -p $root/config
|
||||
|
@ -166,6 +194,7 @@ then
|
|||
reuseSSHKey $root/config/auth/ssh/id_rsa
|
||||
fi
|
||||
|
||||
|
||||
echo "First run - initialization of repos..."
|
||||
if ! env BASE=$root run-checker
|
||||
then
|
||||
|
@ -177,6 +206,7 @@ then
|
|||
rm -Rf $root
|
||||
fi
|
||||
else
|
||||
createDetectorConfig $root/config/detector.cfg
|
||||
echo "Setup has finished!"
|
||||
touch $root/.enabled
|
||||
fi
|
||||
|
|
Loading…
Reference in New Issue
Block a user