Merge remote-tracking branch 'upstream/master'
This commit is contained in:
commit
67de263066
10 changed files with 54 additions and 0 deletions
|
@ -601,6 +601,7 @@ definitions:
|
|||
example: |
|
||||
{
|
||||
"id": 1,
|
||||
"scm": "git",
|
||||
"owner": "octocat",
|
||||
"name": "hello-world",
|
||||
"full_name": "octocat/hello-world",
|
||||
|
@ -620,6 +621,8 @@ definitions:
|
|||
id:
|
||||
type: integer
|
||||
format: int64
|
||||
scm:
|
||||
type: string
|
||||
owner:
|
||||
type: string
|
||||
name:
|
||||
|
@ -721,6 +724,8 @@ definitions:
|
|||
finished_at:
|
||||
type: integer
|
||||
format: int64
|
||||
deploy_to:
|
||||
type: string
|
||||
commit:
|
||||
type: string
|
||||
branch:
|
||||
|
|
|
@ -10,6 +10,7 @@ type Build struct {
|
|||
Created int64 `json:"created_at" meddler:"build_created"`
|
||||
Started int64 `json:"started_at" meddler:"build_started"`
|
||||
Finished int64 `json:"finished_at" meddler:"build_finished"`
|
||||
Deploy string `json:"deploy_to" meddler:"build_deploy"`
|
||||
Commit string `json:"commit" meddler:"build_commit"`
|
||||
Branch string `json:"branch" meddler:"build_branch"`
|
||||
Ref string `json:"ref" meddler:"build_ref"`
|
||||
|
|
|
@ -16,3 +16,10 @@ const (
|
|||
StatusKilled = "killed"
|
||||
StatusError = "error"
|
||||
)
|
||||
|
||||
const (
|
||||
RepoGit = "git"
|
||||
RepoHg = "hg"
|
||||
RepoFossil = "fossil"
|
||||
RepoPerforce = "perforce"
|
||||
)
|
||||
|
|
|
@ -15,6 +15,7 @@ type Repo struct {
|
|||
FullName string `json:"full_name" meddler:"repo_full_name"`
|
||||
Avatar string `json:"avatar_url" meddler:"repo_avatar"`
|
||||
Link string `json:"link_url" meddler:"repo_link"`
|
||||
Kind string `json:"scm" meddler:"repo_scm"`
|
||||
Clone string `json:"clone_url" meddler:"repo_clone"`
|
||||
Branch string `json:"default_branch" meddler:"repo_branch"`
|
||||
Timeout int64 `json:"timeout" meddler:"repo_timeout"`
|
||||
|
|
|
@ -17,6 +17,7 @@ func convertRepo(from *Repo) *model.Repo {
|
|||
Link: from.Links.Html.Href,
|
||||
IsPrivate: from.IsPrivate,
|
||||
Avatar: from.Owner.Links.Avatar.Href,
|
||||
Kind: from.Scm,
|
||||
Branch: "master",
|
||||
}
|
||||
|
||||
|
|
|
@ -147,6 +147,7 @@ func (g *Github) Repo(u *model.User, owner, name string) (*model.Repo, error) {
|
|||
repo.Clone = *repo_.CloneURL
|
||||
repo.Branch = "master"
|
||||
repo.Avatar = *repo_.Owner.AvatarURL
|
||||
repo.Kind = model.RepoGit
|
||||
|
||||
if repo_.DefaultBranch != nil {
|
||||
repo.Branch = *repo_.DefaultBranch
|
||||
|
@ -324,6 +325,7 @@ func (g *Github) push(r *http.Request) (*model.Repo, *model.Build, error) {
|
|||
repo.IsPrivate = hook.Repo.Private
|
||||
repo.Clone = hook.Repo.CloneURL
|
||||
repo.Branch = hook.Repo.DefaultBranch
|
||||
repo.Kind = model.RepoGit
|
||||
|
||||
build := &model.Build{}
|
||||
build.Event = model.EventPush
|
||||
|
@ -384,6 +386,7 @@ func (g *Github) pullRequest(r *http.Request) (*model.Repo, *model.Build, error)
|
|||
repo.Link = *hook.Repo.HTMLURL
|
||||
repo.IsPrivate = *hook.Repo.Private
|
||||
repo.Clone = *hook.Repo.CloneURL
|
||||
repo.Kind = model.RepoGit
|
||||
repo.Branch = "master"
|
||||
if hook.Repo.DefaultBranch != nil {
|
||||
repo.Branch = *hook.Repo.DefaultBranch
|
||||
|
@ -425,6 +428,7 @@ func (g *Github) deployment(r *http.Request) (*model.Repo, *model.Build, error)
|
|||
repo.IsPrivate = hook.Repo.Private
|
||||
repo.Clone = hook.Repo.CloneURL
|
||||
repo.Branch = hook.Repo.DefaultBranch
|
||||
repo.Kind = model.RepoGit
|
||||
|
||||
// ref can be
|
||||
// branch, tag, or sha
|
||||
|
@ -438,6 +442,7 @@ func (g *Github) deployment(r *http.Request) (*model.Repo, *model.Build, error)
|
|||
build.Author = hook.Sender.Login
|
||||
build.Ref = hook.Deployment.Ref
|
||||
build.Branch = hook.Deployment.Ref
|
||||
build.Deploy = hook.Deployment.Env
|
||||
|
||||
// if the ref is a sha or short sha we need to manually
|
||||
// construct the ref.
|
||||
|
|
|
@ -37,6 +37,7 @@ func toRepo(from *gogs.Repository) *model.Repo {
|
|||
from.Owner.AvatarUrl,
|
||||
)
|
||||
return &model.Repo{
|
||||
Kind: model.RepoGit,
|
||||
Name: name,
|
||||
Owner: from.Owner.UserName,
|
||||
FullName: from.FullName,
|
||||
|
|
11
store/migration/mysql/2.sql
Normal file
11
store/migration/mysql/2.sql
Normal file
|
@ -0,0 +1,11 @@
|
|||
-- +migrate Up
|
||||
|
||||
ALTER TABLE repos ADD COLUMN repo_scm VARCHAR(25);
|
||||
ALTER TABLE builds ADD COLUMN build_deploy VARCHAR(500);
|
||||
|
||||
UPDATE repos SET repo_scm = 'git';
|
||||
|
||||
-- +migrate Down
|
||||
|
||||
ALTER TABLE repos DROP COLUMN repo_scm;
|
||||
ALTER TABLE builds DROP COLUMN build_deploy;
|
11
store/migration/postgres/2.sql
Normal file
11
store/migration/postgres/2.sql
Normal file
|
@ -0,0 +1,11 @@
|
|||
-- +migrate Up
|
||||
|
||||
ALTER TABLE repos ADD COLUMN repo_scm VARCHAR(25);
|
||||
ALTER TABLE builds ADD COLUMN build_deploy VARCHAR(500);
|
||||
|
||||
UPDATE repos SET repo_scm = 'git';
|
||||
|
||||
-- +migrate Down
|
||||
|
||||
ALTER TABLE repos DROP COLUMN repo_scm;
|
||||
ALTER TABLE builds DROP COLUMN build_deploy;
|
11
store/migration/sqlite3/2.sql
Normal file
11
store/migration/sqlite3/2.sql
Normal file
|
@ -0,0 +1,11 @@
|
|||
-- +migrate Up
|
||||
|
||||
ALTER TABLE repos ADD COLUMN repo_scm TEXT;
|
||||
ALTER TABLE builds ADD COLUMN build_deploy TEXT;
|
||||
|
||||
UPDATE repos SET repo_scm = 'git';
|
||||
|
||||
-- +migrate Down
|
||||
|
||||
ALTER TABLE repos DROP COLUMN repo_scm;
|
||||
ALTER TABLE builds DROP COLUMN build_deploy;
|
Loading…
Reference in a new issue