]>
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`
16 # shellcheck disable=SC2068
21 # shellcheck disable=SC2145
22 log
"ERROR: $@ Error code: $error."
25 function update_repo_status
{
26 # Update the parent first.
29 # This is a fatal error. Something in the environment isn't right and we will
30 # terminate the execution.
32 if [ ! $error -eq 0 ]; then
33 log_err
"Where is $SRC_GIT_REPO?"
37 HTTPS_PROXY
=fwdproxy
:8080 git fetch
-f
40 if [ ! $error -eq 0 ]; then
41 log_err
"git fetch -f failed."
46 git update-ref refs
/heads
/master refs
/remotes
/origin
/master
49 if [ ! $error -eq 0 ]; then
50 log_err
"git update-ref failed."
57 # We're back in an instance-specific directory. Get the latest changes.
61 if [ ! $error -eq 0 ]; then
62 log_err
"git pull --rebase failed."
68 # Execution starts here.
71 # Path to the determinator from the root of the RocksDB repo.
72 CONTRUN_DETERMINATOR
=.
/build_tools
/RocksDBCommonHelper.php
74 # Value of the previous commit.
77 log
"Starting to monitor for new RocksDB changes ..."
78 log
"Running under `pwd` as `whoami`."
80 # Paranoia. Make sure that we're using the right branch.
84 if [ ! $error -eq 0 ]; then
85 log_err
"This is not good. Can't checkout master. Bye-bye!"
89 # We'll run forever and let the execution environment terminate us if we'll
90 # exceed whatever timeout is set for the job.
93 # Get the latest changes committed.
97 if [ $error -eq 0 ]; then
98 LAST_COMMIT
=`git log -1 | head -1 | grep commit | awk '{ print $2; }'`
100 log
"Last commit is '$LAST_COMMIT', previous commit is '$PREV_COMMIT'."
102 if [ "$PREV_COMMIT" == "$LAST_COMMIT" ]; then
103 log
"There were no changes since the last time I checked. Going to sleep."
105 if [ ! -z "$LAST_COMMIT" ]; then
106 log
"New code has been committed or previous commit not known. " \
107 "Will trigger the tests."
109 PREV_COMMIT
=$LAST_COMMIT
110 log
"Updated previous commit to '$PREV_COMMIT'."
113 # This is where we'll trigger the Sandcastle run. The values for
114 # HTTPS_APP_VALUE and HTTPS_APP_VALUE will be set in the container we're
117 POST_RECEIVE_HOOK
=1 php
$CONTRUN_DETERMINATOR
120 if [ $error -eq 0 ]; then
121 log
"Sandcastle run successfully triggered."
123 log_err
"Failed to trigger Sandcastle run."
126 log_err
"Previous commit not updated. Don't know what the last one is."
130 log_err
"Getting latest changes failed. Will skip running tests for now."
133 # Always sleep, even if errors happens while trying to determine the latest
134 # commit. This will prevent us terminating in case of transient errors.
135 log
"Will go to sleep for 5 minutes."