Exemplo n.º 1
0
// HTTPHandler ...
func HTTPHandler(w http.ResponseWriter, r *http.Request) {
	resp := RespModel{
		Message:         "Welcome to bitrise-webhooks! You can find more information and setup guides at: https://github.com/bitrise-io/bitrise-webhooks",
		Version:         version.VERSION,
		Time:            fmt.Sprintf("%s", time.Now()),
		EnvironmentMode: config.GetServerEnvMode(),
	}

	service.RespondWithSuccessOK(w, resp)
}
Exemplo n.º 2
0
func triggerBuild(triggerURL *url.URL, apiToken string, triggerAPIParams bitriseapi.TriggerAPIParamsModel) (bitriseapi.TriggerAPIResponseModel, bool, error) {
	log.Printf(" ===> trigger build: %s", triggerURL)
	isOnlyLog := !(config.SendRequestToURL != nil || config.GetServerEnvMode() == config.ServerEnvModeProd)
	if isOnlyLog {
		log.Println(" (debug) isOnlyLog: true")
	}

	responseModel, isSuccess, err := bitriseapi.TriggerBuild(triggerURL, apiToken, triggerAPIParams, isOnlyLog)
	if err != nil {
		log.Printf(" [!] Exception: failed to trigger build: %s", err)
		return bitriseapi.TriggerAPIResponseModel{}, false, fmt.Errorf("Failed to Trigger the Build: %s", err)
	}
	log.Printf(" ===> trigger build - DONE (success: %t) (%s)", isSuccess, triggerURL)
	log.Printf("      (debug) response: (%#v)", responseModel)
	return responseModel, isSuccess, nil
}