Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

✨ Change builder table definition #190

Merged
merged 1 commit into from
Sep 4, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion pkg/cronjob/builder.go
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,7 @@ func (r builderRunner) runner(ctx context.Context, tw timewheel.TimeWheel) {
if err != nil {
return err
}
tag, err := builder.BuildTag(ptr.To(builderObj.CronTag), builder.BuildTagOption{ScmBranch: ptr.To(builderObj.CronBranch)})
tag, err := builder.BuildTag(ptr.To(builderObj.CronTagTemplate), builder.BuildTagOption{ScmBranch: ptr.To(builderObj.CronBranch)})
if err != nil {
return err
}
Expand Down
8 changes: 5 additions & 3 deletions pkg/dal/migrations/mysql/0001_initialize.up.sql
Original file line number Diff line number Diff line change
Expand Up @@ -362,11 +362,13 @@ CREATE TABLE IF NOT EXISTS `builders` (
`scm_submodule` tinyint NOT NULL DEFAULT 1,
-- cron settings
`cron_rule` varchar(30),
`cron_branch` varchar(30),
`cron_tag` varchar(256),
`cron_branch` varchar(256),
`cron_tag_template` varchar(256),
`cron_next_trigger` timestamp,
-- webhook settings
`webhook_tag` varchar(256),
`webhook_branch_name` varchar(256),
`webhook_branch_tag_template` varchar(256),
`webhook_tag_tag_template` varchar(256),
-- buildkit settings
`buildkit_insecure_registries` varchar(256),
`buildkit_context` varchar(30) NOT NULL DEFAULT '.',
Expand Down
8 changes: 5 additions & 3 deletions pkg/dal/migrations/postgresql/0001_initialize.up.sql
Original file line number Diff line number Diff line change
Expand Up @@ -423,11 +423,13 @@ CREATE TABLE IF NOT EXISTS "builders" (
"scm_submodule" smallint NOT NULL DEFAULT 1,
-- cron settings
"cron_rules" varchar(30),
"cron_branch" varchar(30),
"cron_tag" varchar(256),
"cron_branch" varchar(256),
"cron_tag_template" varchar(256),
"cron_next_trigger" timestamp,
-- webhook settings
"webhook_tag" varchar(256),
"webhook_branch_name" varchar(256),
"webhook_branch_tag_template" varchar(256),
"webhook_tag_tag_template" varchar(256),
-- buildkit settings
"buildkit_insecure_registries" varchar(256),
"buildkit_context" varchar(30) NOT NULL DEFAULT '.',
Expand Down
8 changes: 5 additions & 3 deletions pkg/dal/migrations/sqlite3/0001_initialize.up.sql
Original file line number Diff line number Diff line change
Expand Up @@ -362,11 +362,13 @@ CREATE TABLE IF NOT EXISTS `builders` (
`scm_submodule` integer NOT NULL DEFAULT 1,
-- cron settings
`cron_rule` varchar(30),
`cron_branch` varchar(30),
`cron_tag` varchar(256),
`cron_branch` varchar(256),
`cron_tag_template` varchar(256),
`cron_next_trigger` timestamp,
-- webhook settings
`webhook_tag` varchar(256),
`webhook_branch_name` varchar(256),
`webhook_branch_tag_template` varchar(256),
`webhook_tag_tag_template` varchar(256),
-- buildkit settings
`buildkit_insecure_registries` varchar(256),
`buildkit_context` varchar(30) NOT NULL DEFAULT '.',
Expand Down
6 changes: 4 additions & 2 deletions pkg/dal/models/builder.go
Original file line number Diff line number Diff line change
Expand Up @@ -53,11 +53,13 @@ type Builder struct {
// cron settings
CronRule *string
CronBranch *string
CronTag *string
CronTagTemplate *string
CronNextTrigger *time.Time

// webhook settings
WebhookTag *string
WebhookBranchName *string
WebhookBranchTagTemplate *string
WebhookTagTagTemplate *string

// buildkit settings
BuildkitInsecureRegistries string
Expand Down
26 changes: 17 additions & 9 deletions pkg/dal/query/builders.gen.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

162 changes: 0 additions & 162 deletions pkg/handlers/coderepos/coderepos_setupbuilder.go

This file was deleted.

3 changes: 0 additions & 3 deletions pkg/handlers/coderepos/handler.go
Original file line number Diff line number Diff line change
Expand Up @@ -37,8 +37,6 @@ type Handlers interface {
ListBranches(c echo.Context) error
// Resync resync all of the code repositories
Resync(c echo.Context) error
// Setup setup builder for code repository
SetupBuilder(c echo.Context) error
// Providers get providers
Providers(c echo.Context) error
// User3rdParty get user 3rdparty
Expand Down Expand Up @@ -117,7 +115,6 @@ func (f factory) Initialize(e *echo.Echo) error {
codereposGroup.GET("/:provider/resync", codeRepositoryHandler.Resync)
codereposGroup.GET("/:provider/owners", codeRepositoryHandler.ListOwners)
codereposGroup.GET("/:id/branches", codeRepositoryHandler.ListBranches)
codereposGroup.POST("/:id/setup-builder", codeRepositoryHandler.SetupBuilder)
return nil
}

Expand Down