1
0
mirror of https://github.com/lineageos4microg/docker-lineage-cicd synced 2024-09-20 12:22:40 +02:00

Add "now" option

This commit is contained in:
Nicola Corna 2017-05-04 14:51:19 +02:00
parent fd59136e29
commit b235a6e245
2 changed files with 14 additions and 9 deletions

View File

@ -40,6 +40,7 @@ ENV CLEAN_OUTDIR true
# Change this cron rule to what fits best for you
# By Default = At 10:00 UTC ~ 2am PST/PDT
# Use 'now' to start the build immediately
ENV CRONTAB_TIME '0 10 * * *'
# Print detailed output rather than only summary

View File

@ -19,13 +19,17 @@ fi
git config --global user.name $USER_NAME
git config --global user.email $USER_MAIL
# Initialize the cronjob
cronFile=/tmp/buildcron
printf "SHELL=/bin/bash\n" > $cronFile
printenv -0 | sed -e 's/=\x0/=""\n/g' | sed -e 's/\x0/\n/g' | sed -e "s/_=/PRINTENV=/g" >> $cronFile
printf "\n$CRONTAB_TIME /usr/bin/flock -n /tmp/lock.build /root/build.sh >> $DOCKER_LOG 2>&1\n" >> $cronFile
crontab $cronFile
rm $cronFile
if [ "$CRONTAB_TIME" = "now" ]; then
/usr/bin/flock -n /tmp/lock.build /root/build.sh >> $DOCKER_LOG 2>&1
else
# Initialize the cronjob
cronFile=/tmp/buildcron
printf "SHELL=/bin/bash\n" > $cronFile
printenv -0 | sed -e 's/=\x0/=""\n/g' | sed -e 's/\x0/\n/g' | sed -e "s/_=/PRINTENV=/g" >> $cronFile
printf "\n$CRONTAB_TIME /usr/bin/flock -n /tmp/lock.build /root/build.sh >> $DOCKER_LOG 2>&1\n" >> $cronFile
crontab $cronFile
rm $cronFile
# Run crond in foreground
crond -n -m off 2>&1
# Run crond in foreground
crond -n -m off 2>&1
fi