You've already forked woodpecker
							
							
				mirror of
				https://github.com/woodpecker-ci/woodpecker.git
				synced 2025-10-30 23:27:39 +02:00 
			
		
		
		
	Moved things closer that belong together
This commit is contained in:
		| @@ -157,13 +157,7 @@ func PostHook(c *gin.Context) { | ||||
| 	} | ||||
| 	build.ConfigID = conf.ID | ||||
|  | ||||
| 	netrc, err := remote_.Netrc(user, repo) | ||||
| 	if err != nil { | ||||
| 		c.String(500, "Failed to generate netrc file. %s", err) | ||||
| 		return | ||||
| 	} | ||||
|  | ||||
| 	// verify the branches can be built vs skipped | ||||
| 	// verify that pipeline can be built at all | ||||
| 	parsedPipelineConfig, err := yaml.ParseString(conf.Data) | ||||
| 	if err == nil { | ||||
| 		if !parsedPipelineConfig.Branches.Match(build.Branch) && build.Event != model.EventTag && build.Event != model.EventDeploy { | ||||
| @@ -172,11 +166,6 @@ func PostHook(c *gin.Context) { | ||||
| 		} | ||||
| 	} | ||||
|  | ||||
| 	// update some build fields | ||||
| 	build.RepoID = repo.ID | ||||
| 	build.Verified = true | ||||
| 	build.Status = model.StatusPending | ||||
|  | ||||
| 	if repo.IsGated { | ||||
| 		allowed, _ := Config.Services.Senders.SenderAllowed(user, repo, build, conf) | ||||
| 		if !allowed { | ||||
| @@ -184,6 +173,11 @@ func PostHook(c *gin.Context) { | ||||
| 		} | ||||
| 	} | ||||
|  | ||||
| 	// update some build fields | ||||
| 	build.RepoID = repo.ID | ||||
| 	build.Verified = true | ||||
| 	build.Status = model.StatusPending | ||||
|  | ||||
| 	err = store.CreateBuild(c, build, build.Procs...) | ||||
| 	if err != nil { | ||||
| 		logrus.Errorf("failure to save commit for %s. %s", repo.FullName, err) | ||||
| @@ -197,6 +191,12 @@ func PostHook(c *gin.Context) { | ||||
| 		return | ||||
| 	} | ||||
|  | ||||
| 	netrc, err := remote_.Netrc(user, repo) | ||||
| 	if err != nil { | ||||
| 		c.String(500, "Failed to generate netrc file. %s", err) | ||||
| 		return | ||||
| 	} | ||||
|  | ||||
| 	envs := map[string]string{} | ||||
| 	if Config.Services.Environ != nil { | ||||
| 		globals, _ := Config.Services.Environ.EnvironList(repo) | ||||
| @@ -215,14 +215,9 @@ func PostHook(c *gin.Context) { | ||||
| 		logrus.Debugf("Error getting registry credentials for %s#%d. %s", repo.FullName, build.Number, err) | ||||
| 	} | ||||
|  | ||||
| 	// get the previous build so that we can send | ||||
| 	// on status change notifications | ||||
| 	// get the previous build so that we can send status change notifications | ||||
| 	last, _ := store.GetBuildLastBefore(c, repo, build.Branch, build.ID) | ||||
|  | ||||
| 	// | ||||
| 	// BELOW: NEW | ||||
| 	// | ||||
|  | ||||
| 	defer func() { | ||||
| 		uri := fmt.Sprintf("%s/%s/%d", httputil.GetURL(c.Request), repo.FullName, build.Number) | ||||
| 		err = remote_.Status(user, repo, build, uri) | ||||
|   | ||||
		Reference in New Issue
	
	Block a user