local err
err=0
+
if ! output=$(git clone "$repository" -b "$branch" "$builddir/sources" 2>&1); then
err=1
fi
dispatch_tasks() {
local endpoint_name="$1"
- local topic="$2"
+ local watch="$2"
+ local publish_to="$3"
local endpoint
return 1
fi
+ if ! ipc_endpoint_subscribe "$endpoint" "$watch"; then
+ log_error "Could not subscribe to $watch"
+ return 1
+ fi
+
while inst_running; do
local msg
local data
inst_set_status "Build request received"
- handle_build_request "$endpoint" "$topic" "$data"
+ handle_build_request "$endpoint" "$publish_to" "$data"
done
return 0
main() {
local endpoint
- local topic
+ local watch
+ local publish_to
- opt_add_arg "e" "endpoint" "v" "pub/buildbot" "The IPC endpoint to listen on"
- opt_add_arg "t" "topic" "v" "builds" "The topic to publish builds under"
+ opt_add_arg "e" "endpoint" "v" "pub/buildbot" "The IPC endpoint to listen on"
+ opt_add_arg "w" "watch" "v" "commits" "The topic to watch for commit messages"
+ opt_add_arg "p" "publish-to" "v" "builds" "The topic to publish builds under"
if ! opt_parse "$@"; then
return 1
fi
endpoint=$(opt_get "endpoint")
- topic=$(opt_get "topic")
+ watch=$(opt_get "watch")
+ publish_to=$(opt_get "publish-to")
- if ! inst_start dispatch_tasks "$endpoint" "$topic"; then
+ if ! inst_start dispatch_tasks "$endpoint" "$watch" "$publish_to"; then
return 1
fi