From 289f0c9ad60d4ced5a2360a9380f73f9272938d6 Mon Sep 17 00:00:00 2001 From: Anbraten Date: Fri, 17 Sep 2021 21:40:43 +0200 Subject: [PATCH] Change pipeline config path resolution (#299) # Config resolution - pipeline-config setting empty / not specified (default): `.woodpecker/` => `.woodpecker.yml` => `.drone.yml` - pipeline-config setting defined by user: try that file / folder and no fallback (if a user sets some special value that is normally done for some reason) # Changes - pipeline-config setting will be empty by default - remove fallback setting for config loading (simplifies config) --- closes #133 --- * adjust config fetching mechanism * default path empty * remove fallback flag from ui and db --- cmd/drone-server/flags.go | 6 - docs/docs/20-usage/10-intro.md | 4 +- docs/docs/20-usage/71-project-settings.md | 4 +- docs/docs/91-migrations.md | 11 +- model/repo.go | 2 - server/build.go | 2 +- server/configFetcher.go | 47 ++-- server/configFetcher_test.go | 244 ++++++++++-------- server/repo.go | 6 - store/datastore/ddl/mysql/ddl_gen.go | 12 + .../files/026_drop_repo_fallback_column.sql | 2 + store/datastore/ddl/postgres/ddl_gen.go | 12 + .../files/026_drop_repo_fallback_column.sql | 2 + store/datastore/ddl/sqlite/ddl_gen.go | 66 +++++ .../files/026_drop_repo_fallback_column.sql | 56 ++++ store/datastore/repos.go | 1 - store/datastore/sql/mysql/files/repos.sql | 4 +- store/datastore/sql/mysql/sql_gen.go | 4 +- store/datastore/sql/postgres/files/repos.sql | 4 +- store/datastore/sql/postgres/sql_gen.go | 4 +- store/datastore/sql/sqlite/files/repos.sql | 4 +- store/datastore/sql/sqlite/sql_gen.go | 4 +- .../screens/repo/screens/settings/index.js | 13 - 23 files changed, 331 insertions(+), 183 deletions(-) create mode 100644 store/datastore/ddl/mysql/files/026_drop_repo_fallback_column.sql create mode 100644 store/datastore/ddl/postgres/files/026_drop_repo_fallback_column.sql create mode 100644 store/datastore/ddl/sqlite/files/026_drop_repo_fallback_column.sql diff --git a/cmd/drone-server/flags.go b/cmd/drone-server/flags.go index b3c6a011b..01f0ca673 100644 --- a/cmd/drone-server/flags.go +++ b/cmd/drone-server/flags.go @@ -89,12 +89,6 @@ var flags = []cli.Flag{ Name: "open", Usage: "enable open user registration", }, - cli.StringFlag{ - EnvVar: "DRONE_REPO_CONFIG,WOODPECKER_REPO_CONFIG", - Name: "repo-config", - Usage: "file path for the drone config", - Value: ".drone.yml", - }, cli.StringFlag{ EnvVar: "DRONE_DOCS,WOODPECKER_DOCS", Name: "docs", diff --git a/docs/docs/20-usage/10-intro.md b/docs/docs/20-usage/10-intro.md index a824f2c6b..c50df7378 100644 --- a/docs/docs/20-usage/10-intro.md +++ b/docs/docs/20-usage/10-intro.md @@ -20,11 +20,9 @@ When you activate your repository Woodpecker automatically add webhooks to your Webhooks are used to trigger pipeline executions. When you push code to your repository, open a pull request, or create a tag, your version control system will automatically send a webhook to Woodpecker which will in turn trigger pipeline execution. - - ## Configuration -To configure you pipeline you should place a `.woodpecker.yml` file in the root of your repository. The .woodpecker.yml file is used to define your pipeline steps. It is a superset of the widely used docker-compose file format. +To configure your pipeline you should place a `.woodpecker.yml` file in the root of your repository. The .woodpecker.yml file is used to define your pipeline steps. It is a superset of the widely used docker-compose file format. Example pipeline configuration: diff --git a/docs/docs/20-usage/71-project-settings.md b/docs/docs/20-usage/71-project-settings.md index e26387dc4..ab567b4c5 100644 --- a/docs/docs/20-usage/71-project-settings.md +++ b/docs/docs/20-usage/71-project-settings.md @@ -6,9 +6,7 @@ As the owner of a project in Woodpecker you can change some project related sett ## Pipeline path -The path to the pipeline file or folder. By default it point `.woodpecker.yml`. To use a [multi pipeline](/docs/usage/multi-pipeline) you have to change it to a folder path ending with `/` like `.woodpecker/`. - -If you enable the fallback check, Woodpecker will first try to load the configuration from the defined path and if it fails to find that file it will try to use `.drone.yml`. +The path to the pipeline config file or folder. By default it is left empty which will use the following configuration resolution `.woodpecker/*.yml` -> `.woodpecker.yml` -> `.drone.yml`. If you set a custom path Woodpecker tries to load your configuration or fails if no configuration could be found at the specified location. To use a [multi pipeline](/docs/usage/multi-pipeline) you have to change it to a folder path ending with a `/` like `.woodpecker/`. ## Repository hooks diff --git a/docs/docs/91-migrations.md b/docs/docs/91-migrations.md index f35ff4af2..8e93a7114 100644 --- a/docs/docs/91-migrations.md +++ b/docs/docs/91-migrations.md @@ -4,11 +4,14 @@ Some versions need some changes to the server configuration or the pipeline conf ## 0.15.0 -- Default pipeline path changed to `.woodpecker/` +- Default value for custom pipeline path is now empty / un-set which results in following resolution: + + `.woodpecker/*.yml` -> `.woodpecker.yml` -> `.drone.yml` + + Only projects created after updating will have an empty value by default. Existing projects will stick to the current pipeline path which is `.drone.yml` in most cases. + + Read more about it at the [Project Settings](/docs/usage/project-settings#pipeline-path) - **Solution:** Set configuration location via [project settings](/docs/usage/project-settings#pipeline-path). - - There is still a default fallback mechanism in following order: `.woodpecker/*.yml` -> `.woodpecker.yml` -> `.drone.yml` - ... ## 0.14.0 diff --git a/model/repo.go b/model/repo.go index c02e4a4ff..40a523931 100644 --- a/model/repo.go +++ b/model/repo.go @@ -55,7 +55,6 @@ type Repo struct { Config string `json:"config_file" meddler:"repo_config_path"` Hash string `json:"-" meddler:"repo_hash"` Perm *Perm `json:"-" meddler:"-"` - Fallback bool `json:"fallback" meddler:"repo_fallback"` } func (r *Repo) ResetVisibility() { @@ -106,5 +105,4 @@ type RepoPatch struct { AllowDeploy *bool `json:"allow_deploy,omitempty"` AllowTag *bool `json:"allow_tag,omitempty"` BuildCounter *int `json:"build_counter,omitempty"` - Fallback *bool `json:"fallback,omitempty"` } diff --git a/server/build.go b/server/build.go index ab6a7b678..fda3363b0 100644 --- a/server/build.go +++ b/server/build.go @@ -429,7 +429,7 @@ func PostBuild(c *gin.Context) { } } - // fetch the .drone.yml file from the database + // fetch the pipeline config from database configs, err := Config.Storage.Config.ConfigsForBuild(build.ID) if err != nil { logrus.Errorf("failure to get build config for %s. %s", repo.FullName, err) diff --git a/server/configFetcher.go b/server/configFetcher.go index f7591102d..b8c183b27 100644 --- a/server/configFetcher.go +++ b/server/configFetcher.go @@ -30,28 +30,43 @@ func (cf *configFetcher) Fetch() (files []*remote.FileMeta, err error) { for i := 0; i < 5; i++ { select { case <-time.After(time.Second * time.Duration(i)): - - // either a file - if !strings.HasSuffix(cf.repo.Config, "/") { - file, err = cf.remote_.File(cf.user, cf.repo, cf.build, cf.repo.Config) - if err == nil { - return []*remote.FileMeta{{ - Name: cf.repo.Config, - Data: file, - }}, nil + if len(cf.repo.Config) > 0 { + // either a file + if !strings.HasSuffix(cf.repo.Config, "/") { + file, err = cf.remote_.File(cf.user, cf.repo, cf.build, cf.repo.Config) + if err == nil { + return []*remote.FileMeta{{ + Name: cf.repo.Config, + Data: file, + }}, nil + } } - } - // or a folder - if strings.HasSuffix(cf.repo.Config, "/") { - files, err = cf.remote_.Dir(cf.user, cf.repo, cf.build, strings.TrimSuffix(cf.repo.Config, "/")) + // or a folder + if strings.HasSuffix(cf.repo.Config, "/") { + files, err = cf.remote_.Dir(cf.user, cf.repo, cf.build, strings.TrimSuffix(cf.repo.Config, "/")) + if err == nil { + return filterPipelineFiles(files), nil + } + } + } else { + // no user defined config so try .woodpecker/*.yml -> .woodpecker.yml -> .drone.yml + + // test .woodpecker/ folder + // if folder is not supported we will get a "Not implemented" error and continue + files, err = cf.remote_.Dir(cf.user, cf.repo, cf.build, ".woodpecker") if err == nil { return filterPipelineFiles(files), nil } - } - // or fallback - if cf.repo.Fallback { + file, err = cf.remote_.File(cf.user, cf.repo, cf.build, ".woodpecker.yml") + if err == nil { + return []*remote.FileMeta{{ + Name: ".woodpecker.yml", + Data: file, + }}, nil + } + file, err = cf.remote_.File(cf.user, cf.repo, cf.build, ".drone.yml") if err == nil { return []*remote.FileMeta{{ diff --git a/server/configFetcher_test.go b/server/configFetcher_test.go index 84b5de794..d41f53dae 100644 --- a/server/configFetcher_test.go +++ b/server/configFetcher_test.go @@ -1,7 +1,8 @@ package server_test import ( - "errors" + "fmt" + "path/filepath" "testing" "github.com/stretchr/testify/mock" @@ -15,61 +16,19 @@ func TestFetch(t *testing.T) { t.Parallel() testTable := []struct { - name string - repoConfig string - repoFallback bool - fileMocks []struct { - file []byte - err error - } - dirMock struct { - files []*remote.FileMeta - err error - } + name string + repoConfig string + files []string expectedFileNames []string expectedError bool }{ { - name: "Single .woodpecker.yml file", - repoConfig: ".woodpecker.yml", - repoFallback: false, - fileMocks: []struct { - file []byte - err error - }{ - { - file: []byte{}, - err: nil, - }, - }, - expectedFileNames: []string{ - ".woodpecker.yml", - }, - expectedError: false, - }, - { - name: "Folder .woodpecker/", - repoConfig: ".woodpecker/", - repoFallback: false, - dirMock: struct { - files []*remote.FileMeta - err error - }{ - files: []*remote.FileMeta{ - { - Name: ".woodpecker/text.txt", - Data: []byte{}, - }, - { - Name: ".woodpecker/release.yml", - Data: []byte{}, - }, - { - Name: ".woodpecker/image.png", - Data: []byte{}, - }, - }, - err: nil, + name: "Default config - .woodpecker/", + repoConfig: "", + files: []string{ + ".woodpecker/text.txt", + ".woodpecker/release.yml", + ".woodpecker/image.png", }, expectedFileNames: []string{ ".woodpecker/release.yml", @@ -77,23 +36,21 @@ func TestFetch(t *testing.T) { expectedError: false, }, { - name: "Requesting woodpecker-file but using fallback", - repoConfig: ".woodpecker.yml", - repoFallback: true, - fileMocks: []struct { - file []byte - err error - }{ - // first call requesting regular woodpecker.yml - { - file: nil, - err: errors.New("File not found"), - }, - // fallback file call - { - file: []byte{}, - err: nil, - }, + name: "Default config - .woodpecker.yml", + repoConfig: "", + files: []string{ + ".woodpecker.yml", + }, + expectedFileNames: []string{ + ".woodpecker.yml", + }, + expectedError: false, + }, + { + name: "Default config - .drone.yml", + repoConfig: "", + files: []string{ + ".drone.yml", }, expectedFileNames: []string{ ".drone.yml", @@ -101,49 +58,99 @@ func TestFetch(t *testing.T) { expectedError: false, }, { - name: "Requesting folder but using fallback", - repoConfig: ".woodpecker/", - repoFallback: true, - fileMocks: []struct { - file []byte - err error - }{ - { - file: []byte{}, - err: nil, - }, - }, - dirMock: struct { - files []*remote.FileMeta - err error - }{ - files: []*remote.FileMeta{}, - err: errors.New("Dir not found"), + name: "Default config - Empty repo", + repoConfig: "", + files: []string{}, + expectedFileNames: []string{}, + expectedError: true, + }, + { + name: "Default config - Additional sub-folders", + repoConfig: "", + files: []string{ + ".woodpecker/test.yml", + ".woodpecker/sub-folder/config.yml", }, expectedFileNames: []string{ - ".drone.yml", + ".woodpecker/test.yml", }, expectedError: false, }, { - name: "Not found and disabled fallback", - repoConfig: ".woodpecker.yml", - repoFallback: false, - fileMocks: []struct { - file []byte - err error - }{ - // first call requesting regular woodpecker.yml - { - file: nil, - err: errors.New("File not found"), - }, - // fallback file call - { - file: []byte{}, - err: errors.New("File not found"), - }, + name: "Default config - Additional none .yml files", + repoConfig: "", + files: []string{ + ".woodpecker/notes.txt", + ".woodpecker/image.png", + ".woodpecker/test.yml", }, + expectedFileNames: []string{ + ".woodpecker/test.yml", + }, + expectedError: false, + }, + { + name: "Special config - folder (ignoring default files)", + repoConfig: ".my-ci-folder/", + files: []string{ + ".woodpecker/test.yml", + ".woodpecker.yml", + ".drone.yml", + ".my-ci-folder/test.yml", + }, + expectedFileNames: []string{ + ".my-ci-folder/test.yml", + }, + expectedError: false, + }, + { + name: "Special config - folder", + repoConfig: ".my-ci-folder/", + files: []string{ + ".my-ci-folder/test.yml", + }, + expectedFileNames: []string{ + ".my-ci-folder/test.yml", + }, + expectedError: false, + }, + { + name: "Special config - subfolder", + repoConfig: ".my-ci-folder/my-config/", + files: []string{ + ".my-ci-folder/my-config/test.yml", + }, + expectedFileNames: []string{ + ".my-ci-folder/my-config/test.yml", + }, + expectedError: false, + }, + { + name: "Special config - file", + repoConfig: ".config.yml", + files: []string{ + ".config.yml", + }, + expectedFileNames: []string{ + ".config.yml", + }, + expectedError: false, + }, + { + name: "Special config - file inside subfolder", + repoConfig: ".my-ci-folder/sub-folder/config.yml", + files: []string{ + ".my-ci-folder/sub-folder/config.yml", + }, + expectedFileNames: []string{ + ".my-ci-folder/sub-folder/config.yml", + }, + expectedError: false, + }, + { + name: "Special config - empty repo", + repoConfig: ".config.yml", + files: []string{}, expectedFileNames: []string{}, expectedError: true, }, @@ -151,13 +158,26 @@ func TestFetch(t *testing.T) { for _, tt := range testTable { t.Run(tt.name, func(t *testing.T) { - repo := &model.Repo{Owner: "laszlocph", Name: "drone-multipipeline", Config: tt.repoConfig, Fallback: tt.repoFallback} + repo := &model.Repo{Owner: "laszlocph", Name: "drone-multipipeline", Config: tt.repoConfig} r := new(mocks.Remote) - for _, fileMock := range tt.fileMocks { - r.On("File", mock.Anything, mock.Anything, mock.Anything, mock.Anything).Return(fileMock.file, fileMock.err).Once() + dirs := map[string][]*remote.FileMeta{} + for _, file := range tt.files { + r.On("File", mock.Anything, mock.Anything, mock.Anything, file).Return([]byte{}, nil) + path := filepath.Dir(file) + dirs[path] = append(dirs[path], &remote.FileMeta{ + Name: file, + Data: []byte{}, + }) } - r.On("Dir", mock.Anything, mock.Anything, mock.Anything, mock.Anything).Return(tt.dirMock.files, tt.dirMock.err) + + for path, files := range dirs { + r.On("Dir", mock.Anything, mock.Anything, mock.Anything, path).Return(files, nil) + } + + // if the previous mocks do not match return not found errors + r.On("File", mock.Anything, mock.Anything, mock.Anything, mock.Anything).Return(nil, fmt.Errorf("File not found")) + r.On("Dir", mock.Anything, mock.Anything, mock.Anything, mock.Anything).Return(nil, fmt.Errorf("Directory not found")) configFetcher := server.NewConfigFetcher( r, @@ -182,7 +202,11 @@ func TestFetch(t *testing.T) { } if matchingFiles != len(tt.expectedFileNames) { - t.Fatal("expected some other pipeline files", tt.expectedFileNames, files) + receivedFileNames := []string{} + for _, file := range files { + receivedFileNames = append(receivedFileNames, file.Name) + } + t.Fatal("expected some other pipeline files", tt.expectedFileNames, receivedFileNames) } }) } diff --git a/server/repo.go b/server/repo.go index b313bc6d7..ed08c9c2f 100644 --- a/server/repo.go +++ b/server/repo.go @@ -52,9 +52,6 @@ func PostRepo(c *gin.Context) { repo.Visibility = model.VisibilityPrivate } } - if repo.Config == "" { - repo.Config = Config.Server.RepoConfig - } if repo.Timeout == 0 { repo.Timeout = 60 // 1 hour default build time } @@ -149,9 +146,6 @@ func PatchRepo(c *gin.Context) { if in.BuildCounter != nil { repo.Counter = *in.BuildCounter } - if in.Fallback != nil { - repo.Fallback = *in.Fallback - } err := store.UpdateRepo(c, repo) if err != nil { diff --git a/store/datastore/ddl/mysql/ddl_gen.go b/store/datastore/ddl/mysql/ddl_gen.go index c4b1100a7..0bcbe1b16 100644 --- a/store/datastore/ddl/mysql/ddl_gen.go +++ b/store/datastore/ddl/mysql/ddl_gen.go @@ -200,6 +200,10 @@ var migrations = []struct { name: "update-builds-set-changed_files", stmt: updateBuildsSetChangedfiles, }, + { + name: "alter-table-drop-repo-fallback", + stmt: alterTableDropRepoFallback, + }, } // Migrate performs the database migration. If the migration fails @@ -745,3 +749,11 @@ ALTER TABLE builds ADD COLUMN changed_files TEXT var updateBuildsSetChangedfiles = ` UPDATE builds SET changed_files='[]' ` + +// +// 026_drop_repo_fallback_column.sql +// + +var alterTableDropRepoFallback = ` +ALTER TABLE repos DROP COLUMN repo_fallback +` diff --git a/store/datastore/ddl/mysql/files/026_drop_repo_fallback_column.sql b/store/datastore/ddl/mysql/files/026_drop_repo_fallback_column.sql new file mode 100644 index 000000000..9cd766ffc --- /dev/null +++ b/store/datastore/ddl/mysql/files/026_drop_repo_fallback_column.sql @@ -0,0 +1,2 @@ +-- name: alter-table-drop-repo-fallback +ALTER TABLE repos DROP COLUMN repo_fallback diff --git a/store/datastore/ddl/postgres/ddl_gen.go b/store/datastore/ddl/postgres/ddl_gen.go index 6366bcd3a..67e01774c 100644 --- a/store/datastore/ddl/postgres/ddl_gen.go +++ b/store/datastore/ddl/postgres/ddl_gen.go @@ -200,6 +200,10 @@ var migrations = []struct { name: "update-builds-set-changed_files", stmt: updateBuildsSetChangedfiles, }, + { + name: "alter-table-drop-repo-fallback", + stmt: alterTableDropRepoFallback, + }, } // Migrate performs the database migration. If the migration fails @@ -747,3 +751,11 @@ ALTER TABLE builds ADD COLUMN changed_files TEXT; var updateBuildsSetChangedfiles = ` UPDATE builds SET changed_files='[]' ` + +// +// 026_drop_repo_fallback_column.sql +// + +var alterTableDropRepoFallback = ` +ALTER TABLE repos DROP COLUMN repo_fallback +` diff --git a/store/datastore/ddl/postgres/files/026_drop_repo_fallback_column.sql b/store/datastore/ddl/postgres/files/026_drop_repo_fallback_column.sql new file mode 100644 index 000000000..9cd766ffc --- /dev/null +++ b/store/datastore/ddl/postgres/files/026_drop_repo_fallback_column.sql @@ -0,0 +1,2 @@ +-- name: alter-table-drop-repo-fallback +ALTER TABLE repos DROP COLUMN repo_fallback diff --git a/store/datastore/ddl/sqlite/ddl_gen.go b/store/datastore/ddl/sqlite/ddl_gen.go index d014b47cf..3fe4ce295 100644 --- a/store/datastore/ddl/sqlite/ddl_gen.go +++ b/store/datastore/ddl/sqlite/ddl_gen.go @@ -204,6 +204,10 @@ var migrations = []struct { name: "update-builds-set-changed_files", stmt: updateBuildsSetChangedfiles, }, + { + name: "alter-table-drop-repo-fallback", + stmt: alterTableDropRepoFallback, + }, } // Migrate performs the database migration. If the migration fails @@ -746,3 +750,65 @@ ALTER TABLE builds ADD COLUMN changed_files TEXT var updateBuildsSetChangedfiles = ` UPDATE builds SET changed_files='[]' ` + +// +// 026_drop_repo_fallback_column.sql +// + +var alterTableDropRepoFallback = ` +BEGIN TRANSACTION; + +CREATE TABLE repos_new ( + repo_id INTEGER PRIMARY KEY AUTOINCREMENT, + repo_user_id INTEGER, + repo_owner TEXT, + repo_name TEXT, + repo_full_name TEXT, + repo_avatar TEXT, + repo_link TEXT, + repo_clone TEXT, + repo_branch TEXT, + repo_timeout INTEGER, + repo_private BOOLEAN, + repo_trusted BOOLEAN, + repo_active BOOLEAN, + repo_allow_pr BOOLEAN, + repo_allow_push BOOLEAN, + repo_allow_deploys BOOLEAN, + repo_allow_tags BOOLEAN, + repo_hash TEXT, + repo_scm TEXT, + repo_config_path TEXT, + repo_gated BOOLEAN, + repo_visibility TEXT, + repo_counter INTEGER, + UNIQUE(repo_full_name) +); + +INSERT INTO repos_new SELECT repo_id +,repo_user_id +,repo_owner +,repo_name +,repo_full_name +,repo_avatar +,repo_link +,repo_clone +,repo_branch +,repo_timeout +,repo_private +,repo_trusted +,repo_active +,repo_allow_pr +,repo_allow_push +,repo_allow_deploys +,repo_allow_tags +,repo_hash +,repo_scm +,repo_config_path +,repo_gated +,repo_visibility +,repo_counter FROM repos; +DROP TABLE repos; +ALTER TABLE repos_new RENAME TO repos; +COMMIT; +` diff --git a/store/datastore/ddl/sqlite/files/026_drop_repo_fallback_column.sql b/store/datastore/ddl/sqlite/files/026_drop_repo_fallback_column.sql new file mode 100644 index 000000000..ce0a7f007 --- /dev/null +++ b/store/datastore/ddl/sqlite/files/026_drop_repo_fallback_column.sql @@ -0,0 +1,56 @@ +-- name: alter-table-drop-repo-fallback +BEGIN TRANSACTION; + +CREATE TABLE repos_new ( + repo_id INTEGER PRIMARY KEY AUTOINCREMENT, + repo_user_id INTEGER, + repo_owner TEXT, + repo_name TEXT, + repo_full_name TEXT, + repo_avatar TEXT, + repo_link TEXT, + repo_clone TEXT, + repo_branch TEXT, + repo_timeout INTEGER, + repo_private BOOLEAN, + repo_trusted BOOLEAN, + repo_active BOOLEAN, + repo_allow_pr BOOLEAN, + repo_allow_push BOOLEAN, + repo_allow_deploys BOOLEAN, + repo_allow_tags BOOLEAN, + repo_hash TEXT, + repo_scm TEXT, + repo_config_path TEXT, + repo_gated BOOLEAN, + repo_visibility TEXT, + repo_counter INTEGER, + UNIQUE(repo_full_name) +); + +INSERT INTO repos_new SELECT repo_id +,repo_user_id +,repo_owner +,repo_name +,repo_full_name +,repo_avatar +,repo_link +,repo_clone +,repo_branch +,repo_timeout +,repo_private +,repo_trusted +,repo_active +,repo_allow_pr +,repo_allow_push +,repo_allow_deploys +,repo_allow_tags +,repo_hash +,repo_scm +,repo_config_path +,repo_gated +,repo_visibility +,repo_counter FROM repos; +DROP TABLE repos; +ALTER TABLE repos_new RENAME TO repos; +COMMIT; diff --git a/store/datastore/repos.go b/store/datastore/repos.go index ac5d45c89..584f285f5 100644 --- a/store/datastore/repos.go +++ b/store/datastore/repos.go @@ -93,7 +93,6 @@ func (db *datastore) RepoBatch(repos []*model.Repo) error { repo.IsGated, repo.Visibility, repo.Counter, - repo.Fallback, ) if err != nil { return err diff --git a/store/datastore/sql/mysql/files/repos.sql b/store/datastore/sql/mysql/files/repos.sql index e738601cf..5459fc6b5 100644 --- a/store/datastore/sql/mysql/files/repos.sql +++ b/store/datastore/sql/mysql/files/repos.sql @@ -30,7 +30,6 @@ SELECT ,repo_gated ,repo_visibility ,repo_counter -,repo_fallback FROM repos INNER JOIN perms ON perms.perm_repo_id = repos.repo_id WHERE perms.perm_user_id = ? @@ -61,8 +60,7 @@ INSERT IGNORE INTO repos ( ,repo_gated ,repo_visibility ,repo_counter -,repo_fallback -) VALUES (?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?) +) VALUES (?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?) -- name: repo-delete diff --git a/store/datastore/sql/mysql/sql_gen.go b/store/datastore/sql/mysql/sql_gen.go index d047d2471..73990a460 100644 --- a/store/datastore/sql/mysql/sql_gen.go +++ b/store/datastore/sql/mysql/sql_gen.go @@ -448,7 +448,6 @@ SELECT ,repo_gated ,repo_visibility ,repo_counter -,repo_fallback FROM repos INNER JOIN perms ON perms.perm_repo_id = repos.repo_id WHERE perms.perm_user_id = ? @@ -479,8 +478,7 @@ INSERT IGNORE INTO repos ( ,repo_gated ,repo_visibility ,repo_counter -,repo_fallback -) VALUES (?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?) +) VALUES (?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?) ` var repoDelete = ` diff --git a/store/datastore/sql/postgres/files/repos.sql b/store/datastore/sql/postgres/files/repos.sql index 85eb37ace..6c0eb1445 100644 --- a/store/datastore/sql/postgres/files/repos.sql +++ b/store/datastore/sql/postgres/files/repos.sql @@ -30,7 +30,6 @@ SELECT ,repo_gated ,repo_visibility ,repo_counter -,repo_fallback FROM repos INNER JOIN perms ON perms.perm_repo_id = repos.repo_id WHERE perms.perm_user_id = $1 @@ -61,8 +60,7 @@ INSERT INTO repos ( ,repo_gated ,repo_visibility ,repo_counter -,repo_fallback -) VALUES ($1,$2,$3,$4,$5,$6,$7,$8,$9,$10,$11,$12,$13,$14,$15,$16,$17,$18,$19,$20,$21,$22,$23) +) VALUES ($1,$2,$3,$4,$5,$6,$7,$8,$9,$10,$11,$12,$13,$14,$15,$16,$17,$18,$19,$20,$21,$22) ON CONFLICT (repo_full_name) DO NOTHING -- name: repo-delete diff --git a/store/datastore/sql/postgres/sql_gen.go b/store/datastore/sql/postgres/sql_gen.go index 502306ced..84eb1df9a 100644 --- a/store/datastore/sql/postgres/sql_gen.go +++ b/store/datastore/sql/postgres/sql_gen.go @@ -451,7 +451,6 @@ SELECT ,repo_gated ,repo_visibility ,repo_counter -,repo_fallback FROM repos INNER JOIN perms ON perms.perm_repo_id = repos.repo_id WHERE perms.perm_user_id = $1 @@ -482,8 +481,7 @@ INSERT INTO repos ( ,repo_gated ,repo_visibility ,repo_counter -,repo_fallback -) VALUES ($1,$2,$3,$4,$5,$6,$7,$8,$9,$10,$11,$12,$13,$14,$15,$16,$17,$18,$19,$20,$21,$22,$23) +) VALUES ($1,$2,$3,$4,$5,$6,$7,$8,$9,$10,$11,$12,$13,$14,$15,$16,$17,$18,$19,$20,$21,$22) ON CONFLICT (repo_full_name) DO NOTHING ` diff --git a/store/datastore/sql/sqlite/files/repos.sql b/store/datastore/sql/sqlite/files/repos.sql index 8ae397f46..2aba7acf6 100644 --- a/store/datastore/sql/sqlite/files/repos.sql +++ b/store/datastore/sql/sqlite/files/repos.sql @@ -30,7 +30,6 @@ SELECT ,repo_gated ,repo_visibility ,repo_counter -,repo_fallback FROM repos INNER JOIN perms ON perms.perm_repo_id = repos.repo_id WHERE perms.perm_user_id = ? @@ -61,8 +60,7 @@ INSERT OR IGNORE INTO repos ( ,repo_gated ,repo_visibility ,repo_counter -,repo_fallback -) VALUES (?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?) +) VALUES (?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?) -- name: repo-delete diff --git a/store/datastore/sql/sqlite/sql_gen.go b/store/datastore/sql/sqlite/sql_gen.go index 0a57e3e02..08a2c1b43 100644 --- a/store/datastore/sql/sqlite/sql_gen.go +++ b/store/datastore/sql/sqlite/sql_gen.go @@ -448,7 +448,6 @@ SELECT ,repo_gated ,repo_visibility ,repo_counter -,repo_fallback FROM repos INNER JOIN perms ON perms.perm_repo_id = repos.repo_id WHERE perms.perm_user_id = ? @@ -479,8 +478,7 @@ INSERT OR IGNORE INTO repos ( ,repo_gated ,repo_visibility ,repo_counter -,repo_fallback -) VALUES (?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?) +) VALUES (?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?) ` var repoDelete = ` diff --git a/web/src/screens/repo/screens/settings/index.js b/web/src/screens/repo/screens/settings/index.js index a7acc8a16..3d26aaa1a 100644 --- a/web/src/screens/repo/screens/settings/index.js +++ b/web/src/screens/repo/screens/settings/index.js @@ -41,7 +41,6 @@ export default class Settings extends Component { this.handleVisibilityChange = this.handleVisibilityChange.bind(this); this.handleTimeoutChange = this.handleTimeoutChange.bind(this); this.handlePathChange = this.handlePathChange.bind(this); - this.handleFallbackChange = this.handleFallbackChange.bind(this); this.handleChange = this.handleChange.bind(this); } @@ -74,14 +73,6 @@ export default class Settings extends Component { value={repo.config_file} onBlur={this.handlePathChange} /> -
@@ -231,10 +222,6 @@ export default class Settings extends Component { this.handleChange("config_file", e.target.value); } - handleFallbackChange(e) { - this.handleChange("fallback", e.target.checked); - } - handleChange(prop, value) { const { dispatch, drone, repo } = this.props; let data = {};