Exemple #1
0
func (h *RpcClient) Deploy(r *http.Request, args *rpc.SimpleArgs, reply *rpc.RpcReply) error {
	host.Active(args.Id)

	task.Trigger("host.Deploy")
	reply.Response = true
	return nil
}
Exemple #2
0
func StartTask() {
	if taskStarted {
		return
	}
	taskStarted = true
	task.Trigger("Heartbeat")
}
Exemple #3
0
func Compile(rend render.Render, req *http.Request) {

	if master.IsLock() {
		rend.JSON(200, helper.Error(helper.BusyError))
		return
	}

	master.Lock()
	master.SetBusy()
	master.SetMessage("ready to compile")

	task.Trigger("master.Compile")
	rend.JSON(200, helper.Success())
}
Exemple #4
0
func update() (model.Version, error) {
	now := time.Now()
	version := model.Version{}

	num, list, err := svnUp()
	if err != nil {
		return version, err
	}

	if master.IsChanged(num) == false {
		return version, helper.NewError("no change")
	}

	master.Version = num

	version = model.Version{
		Version: num,
		Time:    now,
		List:    JSON.Stringify(list),
	}

	if err := master.UpdateVersion(&version); err != nil {
		return version, err
	}

	master.SetUnDeployFile(list)

	task.Trigger("client.UpdateHostUnDeployList")

	webSocket.BroadCastAll(&webSocket.Message{
		"svnup",
		helper.Success(version),
	})

	return version, nil
}