func()

in commands/exec.go [36:87]


func (c *ExecCommand) createBuild(repoURL string, abortSignal chan os.Signal) (build *common.Build, err error) {
	// Check if we have uncommitted changes
	_, err = c.runCommand("git", "diff", "--quiet", "HEAD")
	if err != nil {
		logrus.Warningln("You most probably have uncommitted changes.")
		logrus.Warningln("These changes will not be tested.")
	}

	// Parse Git settings
	sha, err := c.runCommand("git", "rev-parse", "HEAD")
	if err != nil {
		return
	}

	beforeSha, err := c.runCommand("git", "rev-parse", "HEAD~1")
	if err != nil {
		beforeSha = "0000000000000000000000000000000000000000"
	}

	refName, err := c.runCommand("git", "rev-parse", "--abbrev-ref", "HEAD")
	if err != nil {
		return
	}

	build = &common.Build{
		JobResponse: common.JobResponse{
			ID:            1,
			Token:         "",
			AllowGitFetch: false,
			JobInfo: common.JobInfo{
				Name:        "",
				Stage:       "",
				ProjectID:   1,
				ProjectName: "",
			},
			GitInfo: common.GitInfo{
				RepoURL:   repoURL,
				Ref:       strings.TrimSpace(refName),
				Sha:       strings.TrimSpace(sha),
				BeforeSha: strings.TrimSpace(beforeSha),
			},
			RunnerInfo: common.RunnerInfo{
				Timeout: c.getTimeout(),
			},
		},
		Runner: &common.RunnerConfig{
			RunnerSettings: c.RunnerSettings,
		},
		SystemInterrupt: abortSignal,
	}
	return
}