Skip to content

Instantly share code, notes, and snippets.

Created October 11, 2011 20:35
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save anonymous/1279350 to your computer and use it in GitHub Desktop.
Save anonymous/1279350 to your computer and use it in GitHub Desktop.
["define",
{"BOSS_handle_SR"=>nil},
[["sequence",
{},
[["echo", {"About to do checks for SR\#${ev.id}"=>nil}, []],
["notify_irc",
{"msg"=>"SR\#${ev.id} Moving to review state and then do checks",
"irc_channel"=>"${irc_channel}"},
[]],
["change_request_state",
{"action"=>"add review", "comment"=>"Under review by BOSS"},
[]],
["notify_irc",
{"msg"=>"SR\#${ev.id} running checks", "irc_channel"=>"${irc_channel}"},
[]],
["get_relevant_changelog", {}, []],
["with_status_flag", {}, [["check_has_relevant_changelog", {}, []]]],
["with_status_flag", {}, [["check_mentions_bug", {}, []]]],
["with_status_flag", {}, [["check_multiple_destinations", {}, []]]],
["with_status_flag", {}, [["check_no_changes", {}, []]]],
["with_status_flag", {}, [["check_package_built_at_source", {}, []]]],
["with_status_flag", {}, [["check_package_is_complete", {}, []]]],
["with_status_flag", {}, [["check_spec", {"debug_dump"=>true}, []]]],
["with_status_flag", {}, [["check_yaml_matches_spec", {}, []]]],
["if",
{"test"=>"${status} != SUCCESS"},
[["sequence",
{},
[["do_reject", {}, []],
["notify_irc",
{"msg"=>"Process finished for SR\#${ev.id}",
"irc_channel"=>"${irc_channel}"},
[]],
["echo", {"Process finished for SR\#${ev.id}"=>nil}, []],
["terminate", {}, []]]]]],
["notify_irc",
{"msg"=>"${higlight}: SR\#${ev.id} : Reviewed",
"irc_channel"=>"${irc_logchan}"},
[]],
["change_request_state",
{"action"=>"accept review", "comment"=>"BOSS suggests accepting"},
[]],
["notify_irc",
{"irc_channel"=>"${irc_reqchan}",
"msg"=>
"${highlight} : https://build.pub.meego.com/request/show/${ev.id} : needs review using : osc -A cobs review accept/decline ${ev.id} -m\"MESSAGE\""},
[]],
["get_request",
{"req_id"=>"${ev.id}", "field"=>"req", "on_error"=>"do_request_vanished"},
[]],
["get_userdata", {"user"=>"${req.state.who}", "field"=>"author"}, []],
["notify",
{"template"=>"CE-commit-notice",
"subject"=>
"CE BOSS: Commit in SR\#${req.id}: Changes to ${req.actions.0.target.project}/${req.actions.0.target.package}",
"mail_to"=>"${email}"},
[]],
["change_request_state",
{"action"=>"add review",
"comment"=>
"Please replace this text with a review and approve/reject the review (not the SR). BOSS will take care of the rest",
"user"=>"sage"},
[]],
["listen",
{"to"=>"req_changed_${ev.id}",
"upon"=>"reply",
"where"=>"\"${ev.state}\" in [\"new\", \"declined\", \"revoked\"]"},
[]],
["notify_irc",
{"irc_channel"=>"${irc_logchan}",
"msg"=>
"${higlight} : SR\#${ev.id} : request state changed to ${ev.state}"},
[]],
["if",
{"test"=>"${ev.state} == declined"},
[["sequence",
{},
[["do_reject", {}, []],
["notify_irc",
{"msg"=>"Process finished for SR\#${ev.id}",
"irc_channel"=>"${irc_channel}"},
[]],
["echo", {"Process finished for SR\#${ev.id}"=>nil}, []],
["terminate", {}, []]]]]],
["notify_irc",
{"msg"=>
"${highlight}: Review completed - about to trial build for SR\#${ev.id}",
"irc_channel"=>"${irc_logchan}"},
[]],
["with_OBS_ticket",
{},
[["sequence",
{},
[["echo",
{"SR\#${ev.id} Start trial build : ${trial_project}"=>nil},
[]],
["notify_irc",
{"msg"=>"SR\#${ev.id} Start trial build : ${trial_project}",
"irc_channel"=>"${irc_channel}"},
[]],
["do_build_trial",
{"build_in"=>"${trial_project}", "linked"=>"True"},
[]],
["notify_irc",
{"irc_channel"=>"${irc_channel}",
"msg"=>
"SR\#${ev.id} Wait for trial build : https://build.pub.meego.com/project/monitor?project=${trial_project}"},
[]],
["echo",
{"SR\#${ev.id} Wait for trial build : ${trial_project}"=>nil},
[]],
["repeat",
{"timeout"=>"30m", "on_timeout"=>"error"},
[["notify_irc",
{"irc_channel"=>"${irc_channel}",
"msg"=>"SR\#${ev.id} Is repo published?"},
[]],
["echo", {"Is repo published?"=>nil}, []],
["is_repo_published", {"project"=>"${trial_project}"}, []],
["break", {"if"=>"${f:__result__}"}, []],
["wait", {"30s"=>nil}, []]]],
["notify_irc",
{"irc_channel"=>"${irc_channel}",
"msg"=>"SR\#${ev.id} Build done : ${trial_project}"},
[]],
["echo", {"SR\#${ev.id} Build done : ${trial_project}"=>nil}, []],
["get_build_trial_results", {"build_in"=>"${trial_project}"}, []],
["if",
{"test"=>"${f:__result__} == false"},
[["sequence",
{},
[["notify_irc",
{"irc_channel"=>"${irc_channel}",
"msg"=>"SR\#${ev.id} Failures : ${new_failures}"},
[]],
["echo", {"Failures : ${new_failures}"=>nil}, []],
["do_reject", {}, []]]],
["sequence",
{},
[["notify_irc",
{"irc_channel"=>"${irc_channel}",
"msg"=>
"SR\#${ev.id} Trial build succeeded : SKIPPING building an image"},
[]],
["echo",
{"Trial build succeeded : SKIPPING building an image"=>nil},
[]],
["do_accept_and_update", {}, []]]]]],
["do_revert_trial",
{"build_in"=>"${trial_project}", "linked"=>"True"},
[]]]]]],
["notify_irc",
{"irc_channel"=>"${irc_channel}", "msg"=>"SR\#${ev.id} Process finished"},
[]],
["echo", {"Process finished for SR\#${ev.id}"=>nil}, []]]],
["define",
{"do_check_image"=>nil},
[["notify_irc",
{"irc_channel"=>"${irc_channel}", "msg"=>"SR\#${ev.id} Check Image"},
[]],
["echo", {"SR\#${ev.id} check_image"=>nil}, []],
["cursor",
{"break_if"=>"${status} != SUCCESS or ${__result__} != true"},
[["notify_irc",
{"irc_channel"=>"${irc_channel}", "msg"=>"SR\#${ev.id} Prepare a ks"},
[]],
["echo", {"Prepare a ks"=>nil}, []],
["build_ks", {}, []],
["request_image", {}, []],
["notify_irc",
{"irc_channel"=>"${irc_channel}", "msg"=>"SR\#${ev.id} build image"},
[]],
["echo", {"build an image"=>nil}, []],
["build_image", {"debug_dump"=>"true"}, []],
["notify_irc",
{"irc_channel"=>"${irc_channel}",
"msg"=>"SR\#${ev.id} Would now test but OTS disabled"},
[]]]],
["if",
{"test"=>"${__result__} != true"},
[["set", {"f:status"=>"FAILED"}, []]]],
["notify_irc",
{"irc_channel"=>"${irc_channel}", "msg"=>"SR\#${ev.id} check image done"},
[]],
["echo", {"SR\#${ev.id} check_image done"=>nil}, []]]],
["define",
{"do_reject"=>nil},
[["sequence",
{},
[["notify_irc",
{"irc_channel"=>"${irc_channel}", "msg"=>"SR\#${ev.id} rejecting"},
[]],
["echo", {"SR\#${ev.id} do_reject"=>nil}, []],
["change_request_state", {"action"=>"reject"}, []],
["set", {"status"=>"FAILED"}, []],
["get_request",
{"req_id"=>"${ev.id}",
"field"=>"req",
"on_error"=>"do_request_vanished"},
[]],
["get_userdata", {"user"=>"${req.state.who}", "field"=>"author"}, []],
["notify",
{"template"=>"CE-reject-notice",
"subject"=>
"CE BOSS SR\#${req.id}: Changes to ${req.actions.0.target.project}/${req.actions.0.target.package}",
"mail_to"=>"${email}"},
[]]]]]],
["define",
{"do_request_vanished"=>nil},
[["sequence",
{},
[["notify_irc",
{"irc_channel"=>"${irc_channel}", "msg"=>"SR\#${ev.id} vanished"},
[]],
["terminate", {}, []]]]]],
["define",
{"do_accept_and_update"=>nil},
[["sequence",
{},
[["notify_irc",
{"irc_channel"=>"${irc_channel}",
"msg"=>
"SR\#${ev.id} Prechecks, build and image built succeeded: Suggest accepting"},
[]],
["echo", {"SR\#${ev.id} do_accept_and_update"=>nil}, []],
["iterator",
{"on_field"=>"ev.actions", "to_field"=>"action"},
[["sequence",
{},
[["set", {"f:package"=>"${action.sourcepackage}"}, []],
["notify_irc",
{"irc_channel"=>"${irc_channel}",
"msg"=>"SR\#${ev.id} Doing updates for ${package} after success"},
[]],
["echo", {"Doing updates for ${package} after success"=>nil}, []],
["echo", {"feed revs"=>nil}, []]]]]],
["notify",
{"template"=>"submit_request",
"subject"=>"[BOSS] Accepted promotion request \#${ev.id}",
"extra_msg"=>"${build_msg}"},
[]]]]]],
["define",
{"with_OBS_ticket"=>nil},
[["sequence",
{},
[["notify_irc",
{"irc_channel"=>"${irc_channel}",
"msg"=>"SR\#${ev.id} waiting for Trial area to be free"},
[]],
["echo", {"Get Lock ${trial_project}"=>nil}, []],
["obsticket", {"action"=>"get", "lock_project"=>"${trial_project}"}, []],
["notify_irc",
{"irc_channel"=>"${irc_channel}",
"msg"=>"SR\#${ev.id} Got Trial area (locked)"},
[]],
["echo", {"Got Lock ${trial_project}"=>nil}, []],
["apply", {}, []],
["echo", {"Unlock ${trial_project}"=>nil}, []],
["notify_irc",
{"irc_channel"=>"${irc_channel}",
"msg"=>"SR\#${ev.id} Trial area unlocked"},
[]],
["obsticket",
{"action"=>"release", "lock_project"=>"${trial_project}"},
[]],
["echo", {"Unlocked ${trial_project}"=>nil}, []]]]]],
["define",
{"with_status_flag"=>nil},
[["sequence",
{},
[["apply", {}, []],
["if",
{"test"=>"${__result__} != true"},
[["set", {"status"=>"FAIL"}, []]]]]]]]]]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment