parent
692eec5f44
commit
a65dc965b5
|
@ -1,7 +1,16 @@
|
|||
#!/bin/bash
|
||||
|
||||
mkdir -p /var/local/redmine/repositories
|
||||
chown redmine:redmine /var/local/redmine/repositories
|
||||
REDMINE_LOCAL_PATH="/var/local/redmine"
|
||||
|
||||
if [ ! -z "$GIT_SYNC_FOLDER" ]; then
|
||||
mkdir -p "$GIT_SYNC_FOLDER"
|
||||
chown redmine:redmine "$GIT_SYNC_FOLDER"
|
||||
fi
|
||||
|
||||
cat <<EOT >> "$REDMINE_LOCAL_PATH/update-repositories.env"
|
||||
REDMINE_API_KEY=${REDMINE_API_KEY}
|
||||
GIT_SYNC_FOLDER=${GIT_SYNC_FOLDER}
|
||||
EOT
|
||||
|
||||
/usr/sbin/cron
|
||||
crontab -u root /var/local/redmine/crontab
|
||||
|
|
|
@ -1,6 +1,27 @@
|
|||
#!/bin/bash
|
||||
|
||||
GIT_SYNC_FOLDER="/var/local/redmine/repositories"
|
||||
source "/var/local/redmine/update-repositories.env"
|
||||
|
||||
if [ -z "$REDMINE_API_KEY" ]; then
|
||||
echo -e "Environment variable 'REDMINE_API_KEY' is missing, ignoring."
|
||||
exit 0
|
||||
fi
|
||||
|
||||
if [ -z "$GIT_SYNC_FOLDER" ]; then
|
||||
echo -e "Environment variable 'GIT_SYNC_FOLDER' is missing, ignoring."
|
||||
exit 0
|
||||
fi
|
||||
|
||||
if [ ! -d "$GIT_SYNC_FOLDER" ]; then
|
||||
echo -e "Cannot find repositories storage: $GIT_SYNC_FOLDER"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
GIT=`command -v git`
|
||||
if [ -z "$GIT" ]; then
|
||||
echo -e "Command 'git' is missing, failing."
|
||||
exit 1
|
||||
fi
|
||||
|
||||
for REPO_DIR in "$GIT_SYNC_FOLDER/"*; do
|
||||
if [ -d "$REPO_DIR" ] && [[ "$REPO_DIR" =~ ^.+\.git$ ]]; then
|
||||
|
@ -9,4 +30,5 @@ for REPO_DIR in "$GIT_SYNC_FOLDER/"*; do
|
|||
fi
|
||||
done
|
||||
|
||||
/usr/src/redmine/bin/rails runner "Repository.fetch_changesets" -e production
|
||||
#/usr/src/redmine/bin/rails runner "Repository.fetch_changesets" -e production
|
||||
curl -q "http://localhost:3000/sys/fetch_changesets?key=${REDMINE_API_KEY}"
|
||||
|
|
Loading…
Reference in New Issue