]>
git.proxmox.com Git - ceph.git/blob - ceph/src/rocksdb/build_tools/cont_integration.sh
3 # Copyright (c) 2016, Facebook. All rights reserved.
5 # Overall wrapper script for RocksDB continuous builds. The implementation is a
6 # trivial pulling scheme. We loop infinitely, check if any new changes have been
7 # committed, if yes then trigger a Sandcastle run, and finally go to sleep again
8 # for a certain interval.
11 SRC_GIT_REPO
=/data
/git
/rocksdb-public
15 DATE
=`date +%Y-%m-%d:%H:%M:%S`
20 log
"ERROR: $@ Error code: $error."
23 function update_repo_status
{
24 # Update the parent first.
27 # This is a fatal error. Something in the environment isn't right and we will
28 # terminate the execution.
30 if [ ! $error -eq 0 ]; then
31 log_err
"Where is $SRC_GIT_REPO?"
35 HTTPS_PROXY
=fwdproxy
:8080 git fetch
-f
38 if [ ! $error -eq 0 ]; then
39 log_err
"git fetch -f failed."
44 git update-ref refs
/heads
/master refs
/remotes
/origin
/master
47 if [ ! $error -eq 0 ]; then
48 log_err
"git update-ref failed."
55 # We're back in an instance-specific directory. Get the latest changes.
59 if [ ! $error -eq 0 ]; then
60 log_err
"git pull --rebase failed."
66 # Execution starts here.
69 # Path to the determinator from the root of the RocksDB repo.
70 CONTRUN_DETERMINATOR
=.
/arcanist_util
/config
/RocksDBCommonHelper.php
72 # Value of the previous commit.
75 log
"Starting to monitor for new RocksDB changes ..."
76 log
"Running under `pwd` as `whoami`."
78 # Paranoia. Make sure that we're using the right branch.
82 if [ ! $error -eq 0 ]; then
83 log_err
"This is not good. Can't checkout master. Bye-bye!"
87 # We'll run forever and let the execution environment terminate us if we'll
88 # exceed whatever timeout is set for the job.
91 # Get the latest changes committed.
95 if [ $error -eq 0 ]; then
96 LAST_COMMIT
=`git log -1 | head -1 | grep commit | awk '{ print $2; }'`
98 log
"Last commit is '$LAST_COMMIT', previous commit is '$PREV_COMMIT'."
100 if [ "$PREV_COMMIT" == "$LAST_COMMIT" ]; then
101 log
"There were no changes since the last time I checked. Going to sleep."
103 if [ ! -z "$LAST_COMMIT" ]; then
104 log
"New code has been committed or previous commit not known. " \
105 "Will trigger the tests."
107 PREV_COMMIT
=$LAST_COMMIT
108 log
"Updated previous commit to '$PREV_COMMIT'."
111 # This is where we'll trigger the Sandcastle run. The values for
112 # HTTPS_APP_VALUE and HTTPS_APP_VALUE will be set in the container we're
115 POST_RECEIVE_HOOK
=1 php
$CONTRUN_DETERMINATOR
118 if [ $error -eq 0 ]; then
119 log
"Sandcastle run successfully triggered."
121 log_err
"Failed to trigger Sandcastle run."
124 log_err
"Previous commit not updated. Don't know what the last one is."
128 log_err
"Getting latest changes failed. Will skip running tests for now."
131 # Always sleep, even if errors happens while trying to determine the latest
132 # commit. This will prevent us terminating in case of transient errors.
133 log
"Will go to sleep for 5 minutes."