add debug field to build
This commit is contained in:
parent
2a5f639e8b
commit
96d1a99428
17 changed files with 58 additions and 2 deletions
|
@ -46,6 +46,7 @@ type Build struct {
|
|||
Cron string `db:"build_cron" json:"cron,omitempty"`
|
||||
Deploy string `db:"build_deploy" json:"deploy_to,omitempty"`
|
||||
DeployID int64 `db:"build_deploy_id" json:"deploy_id,omitempty"`
|
||||
Debug bool `db:"build_debug" json:"debug,omitempty"`
|
||||
Started int64 `db:"build_started" json:"started"`
|
||||
Finished int64 `db:"build_finished" json:"finished"`
|
||||
Created int64 `db:"build_created" json:"created"`
|
||||
|
|
|
@ -50,6 +50,7 @@ type Hook struct {
|
|||
AuthorAvatar string `json:"author_avatar"`
|
||||
Deployment string `json:"deploy_to"`
|
||||
DeploymentID int64 `json:"deploy_id"`
|
||||
Debug bool `json:"debug"`
|
||||
Cron string `json:"cron"`
|
||||
Sender string `json:"sender"`
|
||||
Params map[string]string `json:"params"`
|
||||
|
|
2
go.mod
2
go.mod
|
@ -13,7 +13,7 @@ require (
|
|||
github.com/dchest/authcookie v0.0.0-20120917135355-fbdef6e99866
|
||||
github.com/dchest/uniuri v0.0.0-20160212164326-8902c56451e9
|
||||
github.com/dgrijalva/jwt-go v3.2.0+incompatible
|
||||
github.com/drone/drone-go v1.3.2-0.20200826185551-24929e4d2cfc
|
||||
github.com/drone/drone-go v1.4.1-0.20201109202657-b9e58bbbcf27
|
||||
github.com/drone/drone-runtime v1.1.1-0.20200623162453-61e33e2cab5d
|
||||
github.com/drone/drone-ui v0.0.0-20200701170131-2b91a041998b
|
||||
github.com/drone/drone-yaml v1.2.4-0.20200326192514-6f4d6dfb39e4
|
||||
|
|
2
go.sum
2
go.sum
|
@ -78,6 +78,8 @@ github.com/docker/go-units v0.3.3 h1:Xk8S3Xj5sLGlG5g67hJmYMmUgXv5N4PhkjJHHqrwnTk
|
|||
github.com/docker/go-units v0.3.3/go.mod h1:fgPhTUdO+D/Jk86RDLlptpiXQzgHJF7gydDDbaIK4Dk=
|
||||
github.com/drone/drone-go v1.3.2-0.20200826185551-24929e4d2cfc h1:6AXXCMPilpJqwNqUfG6Zgwakr7HCwnialFiQ/AbqYyQ=
|
||||
github.com/drone/drone-go v1.3.2-0.20200826185551-24929e4d2cfc/go.mod h1:fxCf9jAnXDZV1yDr0ckTuWd1intvcQwfJmTRpTZ1mXg=
|
||||
github.com/drone/drone-go v1.4.1-0.20201109202657-b9e58bbbcf27 h1:58xKlW/Kwp/Apz+R5qNGzBUIzfq1Z57L7Udz1B6bgWE=
|
||||
github.com/drone/drone-go v1.4.1-0.20201109202657-b9e58bbbcf27/go.mod h1:fxCf9jAnXDZV1yDr0ckTuWd1intvcQwfJmTRpTZ1mXg=
|
||||
github.com/drone/drone-runtime v1.0.7-0.20190729202838-87c84080f4a1/go.mod h1:+osgwGADc/nyl40J0fdsf8Z09bgcBZXvXXnLOY48zYs=
|
||||
github.com/drone/drone-runtime v1.1.1-0.20200623162453-61e33e2cab5d h1:P5HI/Y9hARTZ3F3EKs0kYijhjXZWQRQHYn1neTi0pWM=
|
||||
github.com/drone/drone-runtime v1.1.1-0.20200623162453-61e33e2cab5d/go.mod h1:4/2QToW5+HGD0y1sTw7X35W1f7YINS14UfDY4isggT8=
|
||||
|
|
|
@ -83,6 +83,7 @@ func HandleRetry(
|
|||
AuthorAvatar: prev.AuthorAvatar,
|
||||
Deployment: prev.Deploy,
|
||||
DeploymentID: prev.DeployID,
|
||||
Debug: r.FormValue("debug") == "true",
|
||||
Cron: prev.Cron,
|
||||
Sender: prev.Sender,
|
||||
Params: map[string]string{},
|
||||
|
@ -92,6 +93,9 @@ func HandleRetry(
|
|||
if key == "access_token" {
|
||||
continue
|
||||
}
|
||||
if key == "debug" {
|
||||
continue
|
||||
}
|
||||
if len(value) == 0 {
|
||||
continue
|
||||
}
|
||||
|
|
|
@ -470,6 +470,7 @@ SELECT
|
|||
,build_cron
|
||||
,build_deploy
|
||||
,build_deploy_id
|
||||
,build_debug
|
||||
,build_started
|
||||
,build_finished
|
||||
,build_created
|
||||
|
@ -607,6 +608,7 @@ INSERT INTO builds (
|
|||
,build_cron
|
||||
,build_deploy
|
||||
,build_deploy_id
|
||||
,build_debug
|
||||
,build_started
|
||||
,build_finished
|
||||
,build_created
|
||||
|
@ -640,6 +642,7 @@ INSERT INTO builds (
|
|||
,:build_cron
|
||||
,:build_deploy
|
||||
,:build_deploy_id
|
||||
,:build_debug
|
||||
,:build_started
|
||||
,:build_finished
|
||||
,:build_created
|
||||
|
|
|
@ -56,6 +56,7 @@ func toParams(build *core.Build) map[string]interface{} {
|
|||
"build_cron": build.Cron,
|
||||
"build_deploy": build.Deploy,
|
||||
"build_deploy_id": build.DeployID,
|
||||
"build_debug": build.Debug,
|
||||
"build_started": build.Started,
|
||||
"build_finished": build.Finished,
|
||||
"build_created": build.Created,
|
||||
|
@ -140,6 +141,7 @@ func scanRow(scanner db.Scanner, dest *core.Build) error {
|
|||
&dest.Cron,
|
||||
&dest.Deploy,
|
||||
&dest.DeployID,
|
||||
&dest.Debug,
|
||||
&dest.Started,
|
||||
&dest.Finished,
|
||||
&dest.Created,
|
||||
|
|
|
@ -326,6 +326,7 @@ const queryColsBulds = queryCols + `
|
|||
,build_cron
|
||||
,build_deploy
|
||||
,build_deploy_id
|
||||
,build_debug
|
||||
,build_started
|
||||
,build_finished
|
||||
,build_created
|
||||
|
|
|
@ -173,6 +173,7 @@ func scanRowBuild(scanner db.Scanner, dest *core.Repository) error {
|
|||
&build.Cron,
|
||||
&build.Deploy,
|
||||
&build.DeployID,
|
||||
&build.Debug,
|
||||
&build.Started,
|
||||
&build.Finished,
|
||||
&build.Created,
|
||||
|
|
|
@ -53,6 +53,7 @@ type nullBuild struct {
|
|||
Cron sql.NullString
|
||||
Deploy sql.NullString
|
||||
DeployID sql.NullInt64
|
||||
Debug sql.NullBool
|
||||
Started sql.NullInt64
|
||||
Finished sql.NullInt64
|
||||
Created sql.NullInt64
|
||||
|
@ -93,6 +94,7 @@ func (b *nullBuild) value() *core.Build {
|
|||
Cron: b.Cron.String,
|
||||
Deploy: b.Deploy.String,
|
||||
DeployID: b.DeployID.Int64,
|
||||
Debug: b.Debug.Bool,
|
||||
Started: b.Started.Int64,
|
||||
Finished: b.Finished.Int64,
|
||||
Created: b.Created.Int64,
|
||||
|
|
|
@ -64,6 +64,10 @@ var migrations = []struct {
|
|||
name: "create-index-builds-ref",
|
||||
stmt: createIndexBuildsRef,
|
||||
},
|
||||
{
|
||||
name: "alter-table-builds-add-column-debug",
|
||||
stmt: alterTableBuildsAddColumnDebug,
|
||||
},
|
||||
{
|
||||
name: "create-table-stages",
|
||||
stmt: createTableStages,
|
||||
|
@ -382,6 +386,10 @@ var createIndexBuildsRef = `
|
|||
CREATE INDEX ix_build_ref ON builds (build_repo_id, build_ref);
|
||||
`
|
||||
|
||||
var alterTableBuildsAddColumnDebug = `
|
||||
ALTER TABLE builds ADD COLUMN build_debug BOOLEAN NOT NULL DEFAULT false;
|
||||
`
|
||||
|
||||
//
|
||||
// 005_create_table_stages.sql
|
||||
//
|
||||
|
|
|
@ -51,4 +51,8 @@ CREATE INDEX ix_build_sender ON builds (build_sender);
|
|||
|
||||
-- name: create-index-builds-ref
|
||||
|
||||
CREATE INDEX ix_build_ref ON builds (build_repo_id, build_ref);
|
||||
CREATE INDEX ix_build_ref ON builds (build_repo_id, build_ref);
|
||||
|
||||
-- name: alter-table-builds-add-column-debug
|
||||
|
||||
ALTER TABLE builds ADD COLUMN build_debug BOOLEAN NOT NULL DEFAULT false;
|
||||
|
|
|
@ -68,6 +68,10 @@ var migrations = []struct {
|
|||
name: "create-index-builds-ref",
|
||||
stmt: createIndexBuildsRef,
|
||||
},
|
||||
{
|
||||
name: "alter-table-builds-add-column-debug",
|
||||
stmt: alterTableBuildsAddColumnDebug,
|
||||
},
|
||||
{
|
||||
name: "create-table-stages",
|
||||
stmt: createTableStages,
|
||||
|
@ -383,6 +387,10 @@ var createIndexBuildsRef = `
|
|||
CREATE INDEX IF NOT EXISTS ix_build_ref ON builds (build_repo_id, build_ref);
|
||||
`
|
||||
|
||||
var alterTableBuildsAddColumnDebug = `
|
||||
ALTER TABLE builds ADD COLUMN build_debug BOOLEAN NOT NULL DEFAULT false;
|
||||
`
|
||||
|
||||
//
|
||||
// 005_create_table_stages.sql
|
||||
//
|
||||
|
|
|
@ -57,3 +57,7 @@ CREATE INDEX IF NOT EXISTS ix_build_sender ON builds (build_sender);
|
|||
-- name: create-index-builds-ref
|
||||
|
||||
CREATE INDEX IF NOT EXISTS ix_build_ref ON builds (build_repo_id, build_ref);
|
||||
|
||||
-- name: alter-table-builds-add-column-debug
|
||||
|
||||
ALTER TABLE builds ADD COLUMN build_debug BOOLEAN NOT NULL DEFAULT false;
|
||||
|
|
|
@ -68,6 +68,10 @@ var migrations = []struct {
|
|||
name: "create-index-build-incomplete",
|
||||
stmt: createIndexBuildIncomplete,
|
||||
},
|
||||
{
|
||||
name: "alter-table-builds-add-column-debug",
|
||||
stmt: alterTableBuildsAddColumnDebug,
|
||||
},
|
||||
{
|
||||
name: "create-table-stages",
|
||||
stmt: createTableStages,
|
||||
|
@ -382,6 +386,10 @@ CREATE INDEX IF NOT EXISTS ix_build_incomplete ON builds (build_status)
|
|||
WHERE build_status IN ('pending', 'running');
|
||||
`
|
||||
|
||||
var alterTableBuildsAddColumnDebug = `
|
||||
ALTER TABLE builds ADD COLUMN build_debug BOOLEAN NOT NULL DEFAULT 0;
|
||||
`
|
||||
|
||||
//
|
||||
// 005_create_table_stages.sql
|
||||
//
|
||||
|
|
|
@ -56,3 +56,7 @@ CREATE INDEX IF NOT EXISTS ix_build_ref ON builds (build_repo_id, build_ref);
|
|||
|
||||
CREATE INDEX IF NOT EXISTS ix_build_incomplete ON builds (build_status)
|
||||
WHERE build_status IN ('pending', 'running');
|
||||
|
||||
-- name: alter-table-builds-add-column-debug
|
||||
|
||||
ALTER TABLE builds ADD COLUMN build_debug BOOLEAN NOT NULL DEFAULT 0;
|
||||
|
|
|
@ -186,6 +186,7 @@ func (t *triggerer) Trigger(ctx context.Context, repo *core.Repository, base *co
|
|||
Cron: base.Cron,
|
||||
Deploy: base.Deployment,
|
||||
DeployID: base.DeploymentID,
|
||||
Debug: base.Debug,
|
||||
Sender: base.Sender,
|
||||
Created: time.Now().Unix(),
|
||||
Updated: time.Now().Unix(),
|
||||
|
@ -367,6 +368,7 @@ func (t *triggerer) Trigger(ctx context.Context, repo *core.Repository, base *co
|
|||
Params: base.Params,
|
||||
Deploy: base.Deployment,
|
||||
DeployID: base.DeploymentID,
|
||||
Debug: base.Debug,
|
||||
Sender: base.Sender,
|
||||
Cron: base.Cron,
|
||||
Created: time.Now().Unix(),
|
||||
|
@ -541,6 +543,7 @@ func (t *triggerer) createBuildError(ctx context.Context, repo *core.Repository,
|
|||
AuthorAvatar: base.AuthorAvatar,
|
||||
Deploy: base.Deployment,
|
||||
DeployID: base.DeploymentID,
|
||||
Debug: base.Debug,
|
||||
Sender: base.Sender,
|
||||
Created: time.Now().Unix(),
|
||||
Updated: time.Now().Unix(),
|
||||
|
|
Loading…
Reference in a new issue