query and show commits by branch

This allows the same SHA to have different builds on different branches, each
separately viewable. This is useful for expressing a "pipeline" in terms of
branches, e.g. a commit starts on branch A and progress through B and C to
master, with the build script switching on branch name.

Previously viewing each build would arbitrarily choose which branch's commit
to show.
This commit is contained in:
Alex Suraci
2014-03-14 11:34:43 -07:00
parent 2241b5bb81
commit 2d837cc3db
14 changed files with 85 additions and 31 deletions

View File

@@ -95,8 +95,8 @@ func (w *worker) execute(task *BuildTask) error {
// make sure a channel exists for the repository,
// the commit, and the commit output (TODO)
reposlug := fmt.Sprintf("%s/%s/%s", task.Repo.Host, task.Repo.Owner, task.Repo.Name)
commitslug := fmt.Sprintf("%s/%s/%s/commit/%s", task.Repo.Host, task.Repo.Owner, task.Repo.Name, task.Commit.Hash)
consoleslug := fmt.Sprintf("%s/%s/%s/commit/%s/builds/%s", task.Repo.Host, task.Repo.Owner, task.Repo.Name, task.Commit.Hash, task.Build.Slug)
commitslug := fmt.Sprintf("%s/%s/%s/commit/%s/%s", task.Repo.Host, task.Repo.Owner, task.Repo.Name, task.Commit.Branch, task.Commit.Hash)
consoleslug := fmt.Sprintf("%s/%s/%s/commit/%s/%s/builds/%s", task.Repo.Host, task.Repo.Owner, task.Repo.Name, task.Commit.Branch, task.Commit.Hash, task.Build.Slug)
channel.Create(reposlug)
channel.Create(commitslug)
channel.CreateStream(consoleslug)
@@ -223,7 +223,7 @@ func updateGitHubStatus(repo *Repo, commit *Commit) error {
client.ApiUrl = settings.GitHubApiUrl
var url string
url = settings.URL().String() + "/" + repo.Slug + "/commit/" + commit.Hash
url = settings.URL().String() + "/" + repo.Slug + "/commit/" + commit.Branch + "/" + commit.Hash
return client.Repos.CreateStatus(repo.Owner, repo.Name, status, url, message, commit.Hash)
}