diff --git a/.gitignore b/.gitignore index 7c3bc8f7..30150312 100644 --- a/.gitignore +++ b/.gitignore @@ -6,3 +6,4 @@ .env .env.* release/ +scripts/ diff --git a/LICENSE b/LICENSE index 0e3e172e..5c0b049b 100644 --- a/LICENSE +++ b/LICENSE @@ -1,10 +1,14 @@ Copyright 2019 Drone.IO, Inc. -Source code in this repository is variously licensed under the -Apache License Version 2.0, an Apache compatible license, or the -Drone Non-Commercial License. Source code in a given file is -licensed under the Drone Non-Commercial License unless otherwise -noted at the beginning of the file. +The Drone Community Edition is licensed under the Apache License, +Version 2.0 (the "Apache License"). You may obtain a copy of the +Apache License at + + http://www.apache.org/licenses/LICENSE-2.0 + +The Drone Enterprise Edition is licensed under the Drone +Non-Commercial License (the "Non-Commercial License"). A copy of +the Non-Commercial License is provided below. ----------------------------------------------------------------- diff --git a/cmd/drone-agent/config/config.go b/cmd/drone-agent/config/config.go index e577cacf..6d276cde 100644 --- a/cmd/drone-agent/config/config.go +++ b/cmd/drone-agent/config/config.go @@ -2,6 +2,8 @@ // Use of this source code is governed by the Drone Non-Commercial License // that can be found in the LICENSE file. +// +build !oss + package config import ( diff --git a/cmd/drone-agent/main.go b/cmd/drone-agent/main.go index 0b16df57..9b9fcec0 100644 --- a/cmd/drone-agent/main.go +++ b/cmd/drone-agent/main.go @@ -2,6 +2,8 @@ // Use of this source code is governed by the Drone Non-Commercial License // that can be found in the LICENSE file. +// +build !oss + package main import ( diff --git a/cmd/drone-controller/config/config.go b/cmd/drone-controller/config/config.go index 7f809e1b..2e2ae9bb 100644 --- a/cmd/drone-controller/config/config.go +++ b/cmd/drone-controller/config/config.go @@ -2,6 +2,8 @@ // Use of this source code is governed by the Drone Non-Commercial License // that can be found in the LICENSE file. +// +build !oss + package config import ( diff --git a/cmd/drone-controller/main.go b/cmd/drone-controller/main.go index 138dd172..91a67424 100644 --- a/cmd/drone-controller/main.go +++ b/cmd/drone-controller/main.go @@ -2,6 +2,8 @@ // Use of this source code is governed by the Drone Non-Commercial License // that can be found in the LICENSE file. +// +build !oss + package main import ( diff --git a/core/build_test.go b/core/build_test.go index 3e670ff6..0912528b 100644 --- a/core/build_test.go +++ b/core/build_test.go @@ -2,4 +2,6 @@ // Use of this source code is governed by the Drone Non-Commercial License // that can be found in the LICENSE file. +// +build !oss + package core diff --git a/core/cron_test.go b/core/cron_test.go index 3e670ff6..0912528b 100644 --- a/core/cron_test.go +++ b/core/cron_test.go @@ -2,4 +2,6 @@ // Use of this source code is governed by the Drone Non-Commercial License // that can be found in the LICENSE file. +// +build !oss + package core diff --git a/core/hook_test.go b/core/hook_test.go index 3e670ff6..0912528b 100644 --- a/core/hook_test.go +++ b/core/hook_test.go @@ -2,4 +2,6 @@ // Use of this source code is governed by the Drone Non-Commercial License // that can be found in the LICENSE file. +// +build !oss + package core diff --git a/core/license_test.go b/core/license_test.go index 3e670ff6..0912528b 100644 --- a/core/license_test.go +++ b/core/license_test.go @@ -2,4 +2,6 @@ // Use of this source code is governed by the Drone Non-Commercial License // that can be found in the LICENSE file. +// +build !oss + package core diff --git a/core/netrc_test.go b/core/netrc_test.go index 3e670ff6..0912528b 100644 --- a/core/netrc_test.go +++ b/core/netrc_test.go @@ -2,4 +2,6 @@ // Use of this source code is governed by the Drone Non-Commercial License // that can be found in the LICENSE file. +// +build !oss + package core diff --git a/core/secret_test.go b/core/secret_test.go index 3a8f218d..c9400844 100644 --- a/core/secret_test.go +++ b/core/secret_test.go @@ -2,6 +2,8 @@ // Use of this source code is governed by the Drone Non-Commercial License // that can be found in the LICENSE file. +// +build !oss + package core import "testing" diff --git a/core/stage_test.go b/core/stage_test.go index fb82adec..b00c91c9 100644 --- a/core/stage_test.go +++ b/core/stage_test.go @@ -2,6 +2,8 @@ // Use of this source code is governed by the Drone Non-Commercial License // that can be found in the LICENSE file. +// +build !oss + package core import "testing" diff --git a/core/step_test.go b/core/step_test.go index 78881f72..b7d689a4 100644 --- a/core/step_test.go +++ b/core/step_test.go @@ -2,6 +2,8 @@ // Use of this source code is governed by the Drone Non-Commercial License // that can be found in the LICENSE file. +// +build !oss + package core import "testing" diff --git a/core/trigger_test.go b/core/trigger_test.go index 3e670ff6..0912528b 100644 --- a/core/trigger_test.go +++ b/core/trigger_test.go @@ -2,4 +2,6 @@ // Use of this source code is governed by the Drone Non-Commercial License // that can be found in the LICENSE file. +// +build !oss + package core diff --git a/core/user_test.go b/core/user_test.go index 97482b8b..7d7d0eec 100644 --- a/core/user_test.go +++ b/core/user_test.go @@ -2,6 +2,8 @@ // Use of this source code is governed by the Drone Non-Commercial License // that can be found in the LICENSE file. +// +build !oss + package core import ( diff --git a/go.sum b/go.sum index c498839c..205374b1 100644 --- a/go.sum +++ b/go.sum @@ -108,6 +108,7 @@ github.com/hashicorp/go-multierror v1.0.0 h1:iVjPR7a6H0tWELX5NxNe7bYopibicUzc7uP github.com/hashicorp/go-multierror v1.0.0/go.mod h1:dHtQlpGsu+cZNNAkkCN/P3hoUDHhCYQXV3UM06sGGrk= github.com/hashicorp/go-retryablehttp v0.0.0-20180718195005-e651d75abec6 h1:qCv4319q2q7XKn0MQbi8p37hsJ+9Xo8e6yojA73JVxk= github.com/hashicorp/go-retryablehttp v0.0.0-20180718195005-e651d75abec6/go.mod h1:fXcdFsQoipQa7mwORhKad5jmDCeSy/RCGzWA08PO0lM= +github.com/hashicorp/go-rootcerts v1.0.0/go.mod h1:K6zTfqpRlCUIjkwsN4Z+hiSfzSTQa6eBIzfwKfwNnHU= github.com/hashicorp/golang-lru v0.5.0 h1:CL2msUPvZTLb5O648aiLNJw3hnBxN2+1Jq8rCOH9wdo= github.com/hashicorp/golang-lru v0.5.0/go.mod h1:/m3WP610KZHVQ1SGc6re/UDhFvYD7pJ4Ao+sR/qLZy8= github.com/hashicorp/nomad v0.0.0-20190125003214-134391155854 h1:L7WhLZt2ory/kQWxqkMwOiBpIoa4BWoadN7yx8LHEtk= diff --git a/handler/api/api.go b/handler/api/api.go index 1f4b49bc..ae235958 100644 --- a/handler/api/api.go +++ b/handler/api/api.go @@ -1,6 +1,16 @@ -// Copyright 2019 Drone.IO Inc. All rights reserved. -// Use of this source code is governed by the Drone Non-Commercial License -// that can be found in the LICENSE file. +// Copyright 2019 Drone IO, Inc. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. package api diff --git a/handler/api/render/render.go b/handler/api/render/render.go index 077ecaaf..31469c87 100644 --- a/handler/api/render/render.go +++ b/handler/api/render/render.go @@ -45,6 +45,9 @@ var ( // ErrNotFound is returned when a resource is not found. ErrNotFound = errors.New("Not Found") + + // ErrNotImplemented is returned when an endpoint is not implemented. + ErrNotImplemented = errors.New("Not Implemented") ) // ErrorCode writes the json-encoded error message to the response. @@ -64,6 +67,12 @@ func InternalErrorf(w http.ResponseWriter, format string, a ...interface{}) { ErrorCode(w, fmt.Errorf(format, a...), 500) } +// NotImplemented writes the json-encoded error message to the +// response with a 501 not found status code. +func NotImplemented(w http.ResponseWriter, err error) { + ErrorCode(w, err, 501) +} + // NotFound writes the json-encoded error message to the response // with a 404 not found status code. func NotFound(w http.ResponseWriter, err error) { diff --git a/handler/api/repos/builds/logs/delete.go b/handler/api/repos/builds/logs/delete.go index 08f1bade..a26e8e9a 100644 --- a/handler/api/repos/builds/logs/delete.go +++ b/handler/api/repos/builds/logs/delete.go @@ -1,6 +1,16 @@ -// Copyright 2019 Drone.IO Inc. All rights reserved. -// Use of this source code is governed by the Drone Non-Commercial License -// that can be found in the LICENSE file. +// Copyright 2019 Drone IO, Inc. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. package logs @@ -8,8 +18,8 @@ import ( "net/http" "strconv" - "github.com/drone/drone/handler/api/render" "github.com/drone/drone/core" + "github.com/drone/drone/handler/api/render" "github.com/go-chi/chi" ) diff --git a/handler/api/repos/builds/logs/find.go b/handler/api/repos/builds/logs/find.go index a542e4b8..84abb0b2 100644 --- a/handler/api/repos/builds/logs/find.go +++ b/handler/api/repos/builds/logs/find.go @@ -1,6 +1,16 @@ -// Copyright 2019 Drone.IO Inc. All rights reserved. -// Use of this source code is governed by the Drone Non-Commercial License -// that can be found in the LICENSE file. +// Copyright 2019 Drone IO, Inc. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. package logs @@ -9,8 +19,8 @@ import ( "net/http" "strconv" - "github.com/drone/drone/handler/api/render" "github.com/drone/drone/core" + "github.com/drone/drone/handler/api/render" "github.com/go-chi/chi" ) diff --git a/handler/api/repos/chown.go b/handler/api/repos/chown.go index bca3f08d..efd0f399 100644 --- a/handler/api/repos/chown.go +++ b/handler/api/repos/chown.go @@ -1,6 +1,16 @@ -// Copyright 2019 Drone.IO Inc. All rights reserved. -// Use of this source code is governed by the Drone Non-Commercial License -// that can be found in the LICENSE file. +// Copyright 2019 Drone IO, Inc. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. package repos diff --git a/handler/api/repos/collabs/find.go b/handler/api/repos/collabs/find.go index 957d9d0e..e2dd4506 100644 --- a/handler/api/repos/collabs/find.go +++ b/handler/api/repos/collabs/find.go @@ -2,14 +2,16 @@ // Use of this source code is governed by the Drone Non-Commercial License // that can be found in the LICENSE file. +// +build !oss + package collabs import ( "net/http" + "github.com/drone/drone/core" "github.com/drone/drone/handler/api/render" "github.com/drone/drone/logger" - "github.com/drone/drone/core" "github.com/go-chi/chi" ) diff --git a/handler/api/repos/collabs/find_test.go b/handler/api/repos/collabs/find_test.go index aaefb6e5..01586169 100644 --- a/handler/api/repos/collabs/find_test.go +++ b/handler/api/repos/collabs/find_test.go @@ -2,6 +2,8 @@ // Use of this source code is governed by the Drone Non-Commercial License // that can be found in the LICENSE file. +// +build !oss + package collabs import ( @@ -12,9 +14,9 @@ import ( "net/http/httptest" "testing" + "github.com/drone/drone/core" "github.com/drone/drone/handler/api/errors" "github.com/drone/drone/mock" - "github.com/drone/drone/core" "github.com/sirupsen/logrus" "github.com/go-chi/chi" diff --git a/handler/api/repos/collabs/list.go b/handler/api/repos/collabs/list.go index df47921b..4868e685 100644 --- a/handler/api/repos/collabs/list.go +++ b/handler/api/repos/collabs/list.go @@ -2,14 +2,16 @@ // Use of this source code is governed by the Drone Non-Commercial License // that can be found in the LICENSE file. +// +build !oss + package collabs import ( "net/http" + "github.com/drone/drone/core" "github.com/drone/drone/handler/api/render" "github.com/drone/drone/logger" - "github.com/drone/drone/core" "github.com/go-chi/chi" ) diff --git a/handler/api/repos/collabs/list_test.go b/handler/api/repos/collabs/list_test.go index d3055a3e..e8b073a0 100644 --- a/handler/api/repos/collabs/list_test.go +++ b/handler/api/repos/collabs/list_test.go @@ -2,6 +2,8 @@ // Use of this source code is governed by the Drone Non-Commercial License // that can be found in the LICENSE file. +// +build !oss + package collabs import ( @@ -11,9 +13,9 @@ import ( "net/http/httptest" "testing" + "github.com/drone/drone/core" "github.com/drone/drone/handler/api/errors" "github.com/drone/drone/mock" - "github.com/drone/drone/core" "github.com/go-chi/chi" "github.com/golang/mock/gomock" diff --git a/handler/api/repos/collabs/none.go b/handler/api/repos/collabs/none.go new file mode 100644 index 00000000..47c62a78 --- /dev/null +++ b/handler/api/repos/collabs/none.go @@ -0,0 +1,40 @@ +// Copyright 2019 Drone IO, Inc. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +// +build oss + +package collabs + +import ( + "net/http" + + "github.com/drone/drone/core" + "github.com/drone/drone/handler/api/render" +) + +var notImplemented = func(w http.ResponseWriter, r *http.Request) { + render.NotImplemented(w, render.ErrNotImplemented) +} + +func HandleDelete(core.UserStore, core.RepositoryStore, core.PermStore) http.HandlerFunc { + return notImplemented +} + +func HandleFind(core.UserStore, core.RepositoryStore, core.PermStore) http.HandlerFunc { + return notImplemented +} + +func HandleList(core.RepositoryStore, core.PermStore) http.HandlerFunc { + return notImplemented +} diff --git a/handler/api/repos/collabs/remove.go b/handler/api/repos/collabs/remove.go index 415e86f5..dd3328ab 100644 --- a/handler/api/repos/collabs/remove.go +++ b/handler/api/repos/collabs/remove.go @@ -2,14 +2,16 @@ // Use of this source code is governed by the Drone Non-Commercial License // that can be found in the LICENSE file. +// +build !oss + package collabs import ( "net/http" + "github.com/drone/drone/core" "github.com/drone/drone/handler/api/render" "github.com/drone/drone/logger" - "github.com/drone/drone/core" "github.com/go-chi/chi" ) diff --git a/handler/api/repos/collabs/remove_test.go b/handler/api/repos/collabs/remove_test.go index 45c53142..109ed74a 100644 --- a/handler/api/repos/collabs/remove_test.go +++ b/handler/api/repos/collabs/remove_test.go @@ -2,6 +2,8 @@ // Use of this source code is governed by the Drone Non-Commercial License // that can be found in the LICENSE file. +// +build !oss + package collabs import ( diff --git a/handler/api/repos/crons/create.go b/handler/api/repos/crons/create.go index 2aa5ab3d..bffa7678 100644 --- a/handler/api/repos/crons/create.go +++ b/handler/api/repos/crons/create.go @@ -2,14 +2,16 @@ // Use of this source code is governed by the Drone Non-Commercial License // that can be found in the LICENSE file. +// +build !oss + package crons import ( "encoding/json" "net/http" - "github.com/drone/drone/handler/api/render" "github.com/drone/drone/core" + "github.com/drone/drone/handler/api/render" "github.com/go-chi/chi" ) diff --git a/handler/api/repos/crons/create_test.go b/handler/api/repos/crons/create_test.go index f9ce8ed8..113c6ebb 100644 --- a/handler/api/repos/crons/create_test.go +++ b/handler/api/repos/crons/create_test.go @@ -2,6 +2,8 @@ // Use of this source code is governed by the Drone Non-Commercial License // that can be found in the LICENSE file. +// +build !oss + package crons import ( @@ -12,9 +14,9 @@ import ( "net/http/httptest" "testing" + "github.com/drone/drone/core" "github.com/drone/drone/handler/api/errors" "github.com/drone/drone/mock" - "github.com/drone/drone/core" "github.com/go-chi/chi" "github.com/golang/mock/gomock" diff --git a/handler/api/repos/crons/delete.go b/handler/api/repos/crons/delete.go index da716bc3..5a67a90b 100644 --- a/handler/api/repos/crons/delete.go +++ b/handler/api/repos/crons/delete.go @@ -2,13 +2,15 @@ // Use of this source code is governed by the Drone Non-Commercial License // that can be found in the LICENSE file. +// +build !oss + package crons import ( "net/http" - "github.com/drone/drone/handler/api/render" "github.com/drone/drone/core" + "github.com/drone/drone/handler/api/render" "github.com/go-chi/chi" ) diff --git a/handler/api/repos/crons/delete_test.go b/handler/api/repos/crons/delete_test.go index 9546cac6..26a0a89e 100644 --- a/handler/api/repos/crons/delete_test.go +++ b/handler/api/repos/crons/delete_test.go @@ -2,6 +2,8 @@ // Use of this source code is governed by the Drone Non-Commercial License // that can be found in the LICENSE file. +// +build !oss + package crons import ( @@ -11,8 +13,8 @@ import ( "net/http/httptest" "testing" - "github.com/drone/drone/mock" "github.com/drone/drone/handler/api/errors" + "github.com/drone/drone/mock" "github.com/go-chi/chi" "github.com/golang/mock/gomock" diff --git a/handler/api/repos/crons/find.go b/handler/api/repos/crons/find.go index 0037830f..45292c86 100644 --- a/handler/api/repos/crons/find.go +++ b/handler/api/repos/crons/find.go @@ -2,13 +2,15 @@ // Use of this source code is governed by the Drone Non-Commercial License // that can be found in the LICENSE file. +// +build !oss + package crons import ( "net/http" - "github.com/drone/drone/handler/api/render" "github.com/drone/drone/core" + "github.com/drone/drone/handler/api/render" "github.com/go-chi/chi" ) diff --git a/handler/api/repos/crons/find_test.go b/handler/api/repos/crons/find_test.go index d408d6ea..942789f1 100644 --- a/handler/api/repos/crons/find_test.go +++ b/handler/api/repos/crons/find_test.go @@ -2,6 +2,8 @@ // Use of this source code is governed by the Drone Non-Commercial License // that can be found in the LICENSE file. +// +build !oss + package crons import ( @@ -11,9 +13,9 @@ import ( "net/http/httptest" "testing" + "github.com/drone/drone/core" "github.com/drone/drone/handler/api/errors" "github.com/drone/drone/mock" - "github.com/drone/drone/core" "github.com/go-chi/chi" "github.com/golang/mock/gomock" diff --git a/handler/api/repos/crons/list.go b/handler/api/repos/crons/list.go index 46609424..06af147e 100644 --- a/handler/api/repos/crons/list.go +++ b/handler/api/repos/crons/list.go @@ -2,13 +2,15 @@ // Use of this source code is governed by the Drone Non-Commercial License // that can be found in the LICENSE file. +// +build !oss + package crons import ( "net/http" - "github.com/drone/drone/handler/api/render" "github.com/drone/drone/core" + "github.com/drone/drone/handler/api/render" "github.com/go-chi/chi" ) diff --git a/handler/api/repos/crons/list_test.go b/handler/api/repos/crons/list_test.go index 3dfc758b..7762cd52 100644 --- a/handler/api/repos/crons/list_test.go +++ b/handler/api/repos/crons/list_test.go @@ -2,6 +2,8 @@ // Use of this source code is governed by the Drone Non-Commercial License // that can be found in the LICENSE file. +// +build !oss + package crons import ( @@ -11,9 +13,9 @@ import ( "net/http/httptest" "testing" + "github.com/drone/drone/core" "github.com/drone/drone/handler/api/errors" "github.com/drone/drone/mock" - "github.com/drone/drone/core" "github.com/go-chi/chi" "github.com/golang/mock/gomock" diff --git a/handler/api/repos/crons/none.go b/handler/api/repos/crons/none.go new file mode 100644 index 00000000..25093991 --- /dev/null +++ b/handler/api/repos/crons/none.go @@ -0,0 +1,48 @@ +// Copyright 2019 Drone IO, Inc. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +// +build oss + +package crons + +import ( + "net/http" + + "github.com/drone/drone/core" + "github.com/drone/drone/handler/api/render" +) + +var notImplemented = func(w http.ResponseWriter, r *http.Request) { + render.NotImplemented(w, render.ErrNotImplemented) +} + +func HandleCreate(core.RepositoryStore, core.CronStore) http.HandlerFunc { + return notImplemented +} + +func HandleUpdate(core.RepositoryStore, core.CronStore) http.HandlerFunc { + return notImplemented +} + +func HandleDelete(core.RepositoryStore, core.CronStore) http.HandlerFunc { + return notImplemented +} + +func HandleFind(core.RepositoryStore, core.CronStore) http.HandlerFunc { + return notImplemented +} + +func HandleList(core.RepositoryStore, core.CronStore) http.HandlerFunc { + return notImplemented +} diff --git a/handler/api/repos/crons/update.go b/handler/api/repos/crons/update.go index 3022cfae..4cf49baa 100644 --- a/handler/api/repos/crons/update.go +++ b/handler/api/repos/crons/update.go @@ -2,14 +2,16 @@ // Use of this source code is governed by the Drone Non-Commercial License // that can be found in the LICENSE file. +// +build !oss + package crons import ( "encoding/json" "net/http" - "github.com/drone/drone/handler/api/render" "github.com/drone/drone/core" + "github.com/drone/drone/handler/api/render" "github.com/go-chi/chi" ) diff --git a/handler/api/repos/crons/update_test.go b/handler/api/repos/crons/update_test.go index 9ce739ad..01604583 100644 --- a/handler/api/repos/crons/update_test.go +++ b/handler/api/repos/crons/update_test.go @@ -2,6 +2,8 @@ // Use of this source code is governed by the Drone Non-Commercial License // that can be found in the LICENSE file. +// +build !oss + package crons import ( @@ -12,9 +14,9 @@ import ( "net/http/httptest" "testing" + "github.com/drone/drone/core" "github.com/drone/drone/handler/api/errors" "github.com/drone/drone/mock" - "github.com/drone/drone/core" "github.com/go-chi/chi" "github.com/golang/mock/gomock" diff --git a/handler/api/repos/repair.go b/handler/api/repos/repair.go index 8c7cfc8d..683c17d9 100644 --- a/handler/api/repos/repair.go +++ b/handler/api/repos/repair.go @@ -1,15 +1,25 @@ -// Copyright 2019 Drone.IO Inc. All rights reserved. -// Use of this source code is governed by the Drone Non-Commercial License -// that can be found in the LICENSE file. +// Copyright 2019 Drone IO, Inc. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. package repos import ( "net/http" + "github.com/drone/drone/core" "github.com/drone/drone/handler/api/render" "github.com/drone/drone/logger" - "github.com/drone/drone/core" "github.com/go-chi/chi" ) diff --git a/handler/api/repos/secrets/create.go b/handler/api/repos/secrets/create.go index c163fa20..809b883b 100644 --- a/handler/api/repos/secrets/create.go +++ b/handler/api/repos/secrets/create.go @@ -1,16 +1,8 @@ -// Copyright 2019 Drone IO, Inc. -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. +// Copyright 2019 Drone.IO Inc. All rights reserved. +// Use of this source code is governed by the Drone Non-Commercial License +// that can be found in the LICENSE file. + +// +build !oss package secrets diff --git a/handler/api/repos/secrets/create_test.go b/handler/api/repos/secrets/create_test.go index 78b11773..5de51d98 100644 --- a/handler/api/repos/secrets/create_test.go +++ b/handler/api/repos/secrets/create_test.go @@ -2,6 +2,8 @@ // Use of this source code is governed by the Drone Non-Commercial License // that can be found in the LICENSE file. +// +build !oss + package secrets import ( @@ -12,9 +14,9 @@ import ( "net/http/httptest" "testing" + "github.com/drone/drone/core" "github.com/drone/drone/handler/api/errors" "github.com/drone/drone/mock" - "github.com/drone/drone/core" "github.com/go-chi/chi" "github.com/golang/mock/gomock" diff --git a/handler/api/repos/secrets/delete.go b/handler/api/repos/secrets/delete.go index 4fddb326..a88878b7 100644 --- a/handler/api/repos/secrets/delete.go +++ b/handler/api/repos/secrets/delete.go @@ -1,16 +1,8 @@ -// Copyright 2019 Drone IO, Inc. -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. +// Copyright 2019 Drone.IO Inc. All rights reserved. +// Use of this source code is governed by the Drone Non-Commercial License +// that can be found in the LICENSE file. + +// +build !oss package secrets diff --git a/handler/api/repos/secrets/delete_test.go b/handler/api/repos/secrets/delete_test.go index 9db3dbfd..67a982f0 100644 --- a/handler/api/repos/secrets/delete_test.go +++ b/handler/api/repos/secrets/delete_test.go @@ -2,6 +2,8 @@ // Use of this source code is governed by the Drone Non-Commercial License // that can be found in the LICENSE file. +// +build !oss + package secrets import ( diff --git a/handler/api/repos/secrets/find.go b/handler/api/repos/secrets/find.go index b86a41cd..67ae98bb 100644 --- a/handler/api/repos/secrets/find.go +++ b/handler/api/repos/secrets/find.go @@ -1,16 +1,8 @@ -// Copyright 2019 Drone IO, Inc. -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. +// Copyright 2019 Drone.IO Inc. All rights reserved. +// Use of this source code is governed by the Drone Non-Commercial License +// that can be found in the LICENSE file. + +// +build !oss package secrets diff --git a/handler/api/repos/secrets/find_test.go b/handler/api/repos/secrets/find_test.go index b68f395d..dbf8c9de 100644 --- a/handler/api/repos/secrets/find_test.go +++ b/handler/api/repos/secrets/find_test.go @@ -2,6 +2,8 @@ // Use of this source code is governed by the Drone Non-Commercial License // that can be found in the LICENSE file. +// +build !oss + package secrets import ( @@ -11,9 +13,9 @@ import ( "net/http/httptest" "testing" + "github.com/drone/drone/core" "github.com/drone/drone/handler/api/errors" "github.com/drone/drone/mock" - "github.com/drone/drone/core" "github.com/go-chi/chi" "github.com/golang/mock/gomock" diff --git a/handler/api/repos/secrets/list.go b/handler/api/repos/secrets/list.go index 60c3d167..ebdcf4bf 100644 --- a/handler/api/repos/secrets/list.go +++ b/handler/api/repos/secrets/list.go @@ -1,16 +1,8 @@ -// Copyright 2019 Drone IO, Inc. -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. +// Copyright 2019 Drone.IO Inc. All rights reserved. +// Use of this source code is governed by the Drone Non-Commercial License +// that can be found in the LICENSE file. + +// +build !oss package secrets diff --git a/handler/api/repos/secrets/list_test.go b/handler/api/repos/secrets/list_test.go index bc5763a0..cf1b9b6a 100644 --- a/handler/api/repos/secrets/list_test.go +++ b/handler/api/repos/secrets/list_test.go @@ -2,6 +2,8 @@ // Use of this source code is governed by the Drone Non-Commercial License // that can be found in the LICENSE file. +// +build !oss + package secrets import ( @@ -11,9 +13,9 @@ import ( "net/http/httptest" "testing" + "github.com/drone/drone/core" "github.com/drone/drone/handler/api/errors" "github.com/drone/drone/mock" - "github.com/drone/drone/core" "github.com/go-chi/chi" "github.com/golang/mock/gomock" diff --git a/handler/api/repos/secrets/none.go b/handler/api/repos/secrets/none.go new file mode 100644 index 00000000..894e070a --- /dev/null +++ b/handler/api/repos/secrets/none.go @@ -0,0 +1,48 @@ +// Copyright 2019 Drone IO, Inc. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +// +build oss + +package secrets + +import ( + "net/http" + + "github.com/drone/drone/core" + "github.com/drone/drone/handler/api/render" +) + +var notImplemented = func(w http.ResponseWriter, r *http.Request) { + render.NotImplemented(w, render.ErrNotImplemented) +} + +func HandleCreate(core.RepositoryStore, core.SecretStore) http.HandlerFunc { + return notImplemented +} + +func HandleUpdate(core.RepositoryStore, core.SecretStore) http.HandlerFunc { + return notImplemented +} + +func HandleDelete(core.RepositoryStore, core.SecretStore) http.HandlerFunc { + return notImplemented +} + +func HandleFind(core.RepositoryStore, core.SecretStore) http.HandlerFunc { + return notImplemented +} + +func HandleList(core.RepositoryStore, core.SecretStore) http.HandlerFunc { + return notImplemented +} diff --git a/handler/api/repos/secrets/update.go b/handler/api/repos/secrets/update.go index 10503e97..b1e56e60 100644 --- a/handler/api/repos/secrets/update.go +++ b/handler/api/repos/secrets/update.go @@ -1,16 +1,8 @@ -// Copyright 2019 Drone IO, Inc. -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. +// Copyright 2019 Drone.IO Inc. All rights reserved. +// Use of this source code is governed by the Drone Non-Commercial License +// that can be found in the LICENSE file. + +// +build !oss package secrets diff --git a/handler/api/repos/secrets/update_test.go b/handler/api/repos/secrets/update_test.go index ab9f7cf3..2ff79f34 100644 --- a/handler/api/repos/secrets/update_test.go +++ b/handler/api/repos/secrets/update_test.go @@ -2,6 +2,8 @@ // Use of this source code is governed by the Drone Non-Commercial License // that can be found in the LICENSE file. +// +build !oss + package secrets import ( @@ -12,9 +14,9 @@ import ( "net/http/httptest" "testing" + "github.com/drone/drone/core" "github.com/drone/drone/handler/api/errors" "github.com/drone/drone/mock" - "github.com/drone/drone/core" "github.com/go-chi/chi" "github.com/golang/mock/gomock" diff --git a/handler/api/repos/sign/sign.go b/handler/api/repos/sign/sign.go index cd533e2f..ff070acc 100644 --- a/handler/api/repos/sign/sign.go +++ b/handler/api/repos/sign/sign.go @@ -1,6 +1,16 @@ -// Copyright 2019 Drone.IO Inc. All rights reserved. -// Use of this source code is governed by the Drone Non-Commercial License -// that can be found in the LICENSE file. +// Copyright 2019 Drone IO, Inc. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. package sign @@ -9,8 +19,8 @@ import ( "net/http" "github.com/drone/drone-yaml/yaml/signer" - "github.com/drone/drone/handler/api/render" "github.com/drone/drone/core" + "github.com/drone/drone/handler/api/render" "github.com/go-chi/chi" ) diff --git a/handler/api/request/context.go b/handler/api/request/context.go index 7a156607..a1fe086a 100644 --- a/handler/api/request/context.go +++ b/handler/api/request/context.go @@ -1,6 +1,16 @@ -// Copyright 2019 Drone.IO Inc. All rights reserved. -// Use of this source code is governed by the Drone Non-Commercial License -// that can be found in the LICENSE file. +// Copyright 2019 Drone IO, Inc. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. package request diff --git a/handler/web/healthz.go b/handler/web/healthz.go index c1c1936d..61c3d919 100644 --- a/handler/web/healthz.go +++ b/handler/web/healthz.go @@ -1,6 +1,16 @@ -// Copyright 2019 Drone.IO Inc. All rights reserved. -// Use of this source code is governed by the Drone Non-Commercial License -// that can be found in the LICENSE file. +// Copyright 2019 Drone IO, Inc. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. package web diff --git a/handler/web/logout.go b/handler/web/logout.go index 245231d3..a969a32e 100644 --- a/handler/web/logout.go +++ b/handler/web/logout.go @@ -1,6 +1,16 @@ -// Copyright 2019 Drone.IO Inc. All rights reserved. -// Use of this source code is governed by the Drone Non-Commercial License -// that can be found in the LICENSE file. +// Copyright 2019 Drone IO, Inc. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. package web diff --git a/handler/web/version.go b/handler/web/version.go index 494c7759..7c48cf6b 100644 --- a/handler/web/version.go +++ b/handler/web/version.go @@ -1,6 +1,16 @@ -// Copyright 2019 Drone.IO Inc. All rights reserved. -// Use of this source code is governed by the Drone Non-Commercial License -// that can be found in the LICENSE file. +// Copyright 2019 Drone IO, Inc. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. package web diff --git a/handler/web/web.go b/handler/web/web.go index 9c1ede68..2fcf2fc2 100644 --- a/handler/web/web.go +++ b/handler/web/web.go @@ -1,6 +1,16 @@ -// Copyright 2019 Drone.IO Inc. All rights reserved. -// Use of this source code is governed by the Drone Non-Commercial License -// that can be found in the LICENSE file. +// Copyright 2019 Drone IO, Inc. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. package web diff --git a/handler/web/writer.go b/handler/web/writer.go index f2f3f1f1..55fba239 100644 --- a/handler/web/writer.go +++ b/handler/web/writer.go @@ -1,6 +1,16 @@ -// Copyright 2019 Drone.IO Inc. All rights reserved. -// Use of this source code is governed by the Drone Non-Commercial License -// that can be found in the LICENSE file. +// Copyright 2019 Drone IO, Inc. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. package web diff --git a/livelog/livelog.go b/livelog/livelog.go index 099d1114..58b9cd9e 100644 --- a/livelog/livelog.go +++ b/livelog/livelog.go @@ -2,6 +2,8 @@ // Use of this source code is governed by the Drone Non-Commercial License // that can be found in the LICENSE file. +// +build !oss + package livelog import ( diff --git a/livelog/livelog_test.go b/livelog/livelog_test.go index 665dbd08..b857799d 100644 --- a/livelog/livelog_test.go +++ b/livelog/livelog_test.go @@ -2,6 +2,8 @@ // Use of this source code is governed by the Drone Non-Commercial License // that can be found in the LICENSE file. +// +build !oss + package livelog import ( diff --git a/livelog/stream.go b/livelog/stream.go index 8c81d4a1..2fc79a22 100644 --- a/livelog/stream.go +++ b/livelog/stream.go @@ -2,6 +2,8 @@ // Use of this source code is governed by the Drone Non-Commercial License // that can be found in the LICENSE file. +// +build !oss + package livelog import ( diff --git a/livelog/stream_test.go b/livelog/stream_test.go index d182dcc3..9453abe8 100644 --- a/livelog/stream_test.go +++ b/livelog/stream_test.go @@ -2,6 +2,8 @@ // Use of this source code is governed by the Drone Non-Commercial License // that can be found in the LICENSE file. +// +build !oss + package livelog import ( diff --git a/livelog/sub.go b/livelog/sub.go index 8762af66..c7bdb700 100644 --- a/livelog/sub.go +++ b/livelog/sub.go @@ -2,6 +2,8 @@ // Use of this source code is governed by the Drone Non-Commercial License // that can be found in the LICENSE file. +// +build !oss + package livelog import ( diff --git a/livelog/sub_test.go b/livelog/sub_test.go index 4bf697ad..ab9bc072 100644 --- a/livelog/sub_test.go +++ b/livelog/sub_test.go @@ -2,6 +2,8 @@ // Use of this source code is governed by the Drone Non-Commercial License // that can be found in the LICENSE file. +// +build !oss + package livelog import ( diff --git a/logger/handler_test.go b/logger/handler_test.go index f41d667a..71c08ad5 100644 --- a/logger/handler_test.go +++ b/logger/handler_test.go @@ -2,6 +2,8 @@ // Use of this source code is governed by the Drone Non-Commercial License // that can be found in the LICENSE file. +// +build !oss + package logger import "testing" diff --git a/logger/logger_test.go b/logger/logger_test.go index f9e3eeb2..37569fc8 100644 --- a/logger/logger_test.go +++ b/logger/logger_test.go @@ -2,6 +2,8 @@ // Use of this source code is governed by the Drone Non-Commercial License // that can be found in the LICENSE file. +// +build !oss + package logger import ( diff --git a/metric/builds.go b/metric/builds.go index 99750f04..dd04622c 100644 --- a/metric/builds.go +++ b/metric/builds.go @@ -2,6 +2,8 @@ // Use of this source code is governed by the Drone Non-Commercial License // that can be found in the LICENSE file. +// +build !oss + package metric import ( diff --git a/metric/builds_test.go b/metric/builds_test.go index f577703e..33d293a6 100644 --- a/metric/builds_test.go +++ b/metric/builds_test.go @@ -2,13 +2,15 @@ // Use of this source code is governed by the Drone Non-Commercial License // that can be found in the LICENSE file. +// +build !oss + package metric import ( "testing" - "github.com/drone/drone/mock" "github.com/drone/drone/core" + "github.com/drone/drone/mock" "github.com/golang/mock/gomock" "github.com/prometheus/client_golang/prometheus" diff --git a/metric/handler_test.go b/metric/handler_test.go index 5b82344c..27892aaf 100644 --- a/metric/handler_test.go +++ b/metric/handler_test.go @@ -2,6 +2,8 @@ // Use of this source code is governed by the Drone Non-Commercial License // that can be found in the LICENSE file. +// +build !oss + package metric import ( diff --git a/metric/license.go b/metric/license.go index aa9ac79c..a7b0e692 100644 --- a/metric/license.go +++ b/metric/license.go @@ -2,6 +2,8 @@ // Use of this source code is governed by the Drone Non-Commercial License // that can be found in the LICENSE file. +// +build !oss + package metric import "github.com/drone/drone/core" diff --git a/metric/license_test.go b/metric/license_test.go index 2d5ed276..66b058b4 100644 --- a/metric/license_test.go +++ b/metric/license_test.go @@ -2,4 +2,6 @@ // Use of this source code is governed by the Drone Non-Commercial License // that can be found in the LICENSE file. +// +build !oss + package metric diff --git a/metric/metric.go b/metric/metric.go index 2d5ed276..66b058b4 100644 --- a/metric/metric.go +++ b/metric/metric.go @@ -2,4 +2,6 @@ // Use of this source code is governed by the Drone Non-Commercial License // that can be found in the LICENSE file. +// +build !oss + package metric diff --git a/metric/repos.go b/metric/repos.go index b357ddc1..430be9fc 100644 --- a/metric/repos.go +++ b/metric/repos.go @@ -2,6 +2,8 @@ // Use of this source code is governed by the Drone Non-Commercial License // that can be found in the LICENSE file. +// +build !oss + package metric import ( diff --git a/metric/repos_test.go b/metric/repos_test.go index 54234c82..dc012b88 100644 --- a/metric/repos_test.go +++ b/metric/repos_test.go @@ -2,6 +2,8 @@ // Use of this source code is governed by the Drone Non-Commercial License // that can be found in the LICENSE file. +// +build !oss + package metric import ( diff --git a/metric/stages.go b/metric/stages.go index 373bf9af..0cb4a42f 100644 --- a/metric/stages.go +++ b/metric/stages.go @@ -2,6 +2,8 @@ // Use of this source code is governed by the Drone Non-Commercial License // that can be found in the LICENSE file. +// +build !oss + package metric import ( diff --git a/metric/stages_test.go b/metric/stages_test.go index 267ec4ff..d79b6922 100644 --- a/metric/stages_test.go +++ b/metric/stages_test.go @@ -2,13 +2,15 @@ // Use of this source code is governed by the Drone Non-Commercial License // that can be found in the LICENSE file. +// +build !oss + package metric import ( "testing" - "github.com/drone/drone/mock" "github.com/drone/drone/core" + "github.com/drone/drone/mock" "github.com/golang/mock/gomock" "github.com/prometheus/client_golang/prometheus" diff --git a/metric/users.go b/metric/users.go index 5784c708..fd5162df 100644 --- a/metric/users.go +++ b/metric/users.go @@ -2,6 +2,8 @@ // Use of this source code is governed by the Drone Non-Commercial License // that can be found in the LICENSE file. +// +build !oss + package metric import ( diff --git a/metric/users_test.go b/metric/users_test.go index b3b1a06e..646d8c20 100644 --- a/metric/users_test.go +++ b/metric/users_test.go @@ -2,6 +2,8 @@ // Use of this source code is governed by the Drone Non-Commercial License // that can be found in the LICENSE file. +// +build !oss + package metric import ( diff --git a/mock/mock.go b/mock/mock.go index 3e4f2329..4ac556e7 100644 --- a/mock/mock.go +++ b/mock/mock.go @@ -2,6 +2,8 @@ // Use of this source code is governed by the Drone Non-Commercial License // that can be found in the LICENSE file. +// +build !oss + package mock //go:generate mockgen -package=mock -destination=mock_gen.go github.com/drone/drone/core NetrcService,Renewer,HookParser,UserService,RepositoryService,CommitService,StatusService,HookService,FileService,Batcher,BuildStore,CronStore,LogStore,PermStore,SecretStore,StageStore,StepStore,RepositoryStore,UserStore,Scheduler,Session,OrganizationService,SecretService,RegistryService,ConfigService,Triggerer,Syncer,LogStream,WebhookSender,LicenseService diff --git a/operator/runner/runner.go b/operator/runner/runner.go index c67ca13b..97ce6129 100644 --- a/operator/runner/runner.go +++ b/operator/runner/runner.go @@ -401,8 +401,8 @@ func (r *Runner) Run(ctx context.Context, id int64) error { if ok { step.Status = core.StatusPassing step.Stopped = time.Now().Unix() - if s.State.ExitCode != 0 { - step.ExitCode = s.State.ExitCode + step.ExitCode = s.State.ExitCode + if s.State.ExitCode != 0 && s.State.ExitCode != 78 { step.Status = core.StatusFailing } } @@ -470,7 +470,7 @@ func (r *Runner) Run(ctx context.Context, id int64) error { logger.Infoln("runner: start execution") err = runner.Run(timeout) - if err != nil { + if err != nil && err != runtime.ErrInterrupt { logger = logger.WithError(err) logger.Infoln("runner: execution failed") return r.handleError(ctx, m.Stage, err) diff --git a/pubsub/hub_test.go b/pubsub/hub_test.go index ea749469..ac728ab8 100644 --- a/pubsub/hub_test.go +++ b/pubsub/hub_test.go @@ -2,6 +2,8 @@ // Use of this source code is governed by the Drone Non-Commercial License // that can be found in the LICENSE file. +// +build !oss + package pubsub import ( diff --git a/pubsub/sub_test.go b/pubsub/sub_test.go index cb4bd9f5..1ac4f88e 100644 --- a/pubsub/sub_test.go +++ b/pubsub/sub_test.go @@ -2,6 +2,8 @@ // Use of this source code is governed by the Drone Non-Commercial License // that can be found in the LICENSE file. +// +build !oss + package pubsub import ( diff --git a/scheduler/kube/config.go b/scheduler/kube/config.go new file mode 100644 index 00000000..e63ddc96 --- /dev/null +++ b/scheduler/kube/config.go @@ -0,0 +1,46 @@ +// Copyright 2019 Drone IO, Inc. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package kube + +// Config is the configuration for the Kubernetes scheduler. +type Config struct { + Namespace string + ServiceAccount string + ConfigURL string + ConfigPath string + TTL int + Image string + ImagePullPolicy string + ImagePrivileged []string + DockerHost string + DockerHostWin string + LimitMemory int + LimitCompute int + RequestMemory int + RequestCompute int + CallbackHost string + CallbackProto string + CallbackSecret string + SecretToken string + SecretEndpoint string + SecretInsecure bool + RegistryToken string + RegistryEndpoint string + RegistryInsecure bool + LogDebug bool + LogTrace bool + LogPretty bool + LogText bool +} diff --git a/scheduler/kube/kubernetes.go b/scheduler/kube/kube.go similarity index 89% rename from scheduler/kube/kubernetes.go rename to scheduler/kube/kube.go index 3b9357c1..d2566798 100644 --- a/scheduler/kube/kubernetes.go +++ b/scheduler/kube/kube.go @@ -27,37 +27,6 @@ import ( "k8s.io/client-go/tools/clientcmd" ) -// Config is the configuration for the Kubernetes scheduler. -type Config struct { - Namespace string - ServiceAccount string - ConfigURL string - ConfigPath string - TTL int - Image string - ImagePullPolicy string - ImagePrivileged []string - DockerHost string - DockerHostWin string - LimitMemory int - LimitCompute int - RequestMemory int - RequestCompute int - CallbackHost string - CallbackProto string - CallbackSecret string - SecretToken string - SecretEndpoint string - SecretInsecure bool - RegistryToken string - RegistryEndpoint string - RegistryInsecure bool - LogDebug bool - LogTrace bool - LogPretty bool - LogText bool -} - type kubeScheduler struct { client *kubernetes.Clientset config Config diff --git a/scheduler/kube/kube_oss.go b/scheduler/kube/kube_oss.go new file mode 100644 index 00000000..3f935c67 --- /dev/null +++ b/scheduler/kube/kube_oss.go @@ -0,0 +1,50 @@ +// Copyright 2019 Drone IO, Inc. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +// +build oss + +package kube + +import ( + "context" + + "github.com/drone/drone/core" +) + +type noop struct{} + +// FromConfig returns a no-op Kubernetes scheduler. +func FromConfig(conf Config) (core.Scheduler, error) { + return new(noop) +} + +func (noop) Schedule(context.Context, *core.Stage) error { + return nil +} + +func (noop) Request(context.Context, Filter) (*core.Stage, error) { + return nil, nil +} + +func (noop) Cancel(context.Context, int64) error { + return nil +} + +func (noop) Cancelled(context.Context, int64) (bool, error) { + return false, nil +} + +func (noop) Stats(context.Context) (interface{}, error) { + return nil, nil +} diff --git a/scheduler/nomad/config.go b/scheduler/nomad/config.go new file mode 100644 index 00000000..15473683 --- /dev/null +++ b/scheduler/nomad/config.go @@ -0,0 +1,44 @@ +// Copyright 2019 Drone IO, Inc. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package nomad + +// Config is the configuration for the Nomad scheduler. +type Config struct { + Datacenter []string + Namespace string + Region string + DockerImage string + DockerImagePull bool + DockerImagePriv []string + DockerHost string + DockerHostWin string + LimitMemory int + LimitCompute int + RequestMemory int + RequestCompute int + CallbackHost string + CallbackProto string + CallbackSecret string + SecretToken string + SecretEndpoint string + SecretInsecure bool + RegistryToken string + RegistryEndpoint string + RegistryInsecure bool + LogDebug bool + LogTrace bool + LogPretty bool + LogText bool +} diff --git a/scheduler/nomad/nomad.go b/scheduler/nomad/nomad.go index f82ef4eb..dd054398 100644 --- a/scheduler/nomad/nomad.go +++ b/scheduler/nomad/nomad.go @@ -31,35 +31,6 @@ const ( dockerHostWindows = "////./pipe/docker_engine" ) -// Config is the configuration for the Nomad scheduler. -type Config struct { - Datacenter []string - Namespace string - Region string - DockerImage string - DockerImagePull bool - DockerImagePriv []string - DockerHost string - DockerHostWin string - LimitMemory int - LimitCompute int - RequestMemory int - RequestCompute int - CallbackHost string - CallbackProto string - CallbackSecret string - SecretToken string - SecretEndpoint string - SecretInsecure bool - RegistryToken string - RegistryEndpoint string - RegistryInsecure bool - LogDebug bool - LogTrace bool - LogPretty bool - LogText bool -} - type nomadScheduler struct { client *api.Client config Config diff --git a/scheduler/nomad/nomad_oss.go b/scheduler/nomad/nomad_oss.go new file mode 100644 index 00000000..edbb9c8f --- /dev/null +++ b/scheduler/nomad/nomad_oss.go @@ -0,0 +1,50 @@ +// Copyright 2019 Drone IO, Inc. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +// +build oss + +package nomad + +import ( + "context" + + "github.com/drone/drone/core" +) + +type noop struct{} + +// FromConfig returns a no-op Nomad scheduler. +func FromConfig(conf Config) (core.Scheduler, error) { + return new(noop) +} + +func (noop) Schedule(context.Context, *core.Stage) error { + return nil +} + +func (noop) Request(context.Context, Filter) (*core.Stage, error) { + return nil, nil +} + +func (noop) Cancel(context.Context, int64) error { + return nil +} + +func (noop) Cancelled(context.Context, int64) (bool, error) { + return false, nil +} + +func (noop) Stats(context.Context) (interface{}, error) { + return nil, nil +} diff --git a/scheduler/scheduler.go b/scheduler/scheduler.go index 874a75d9..4aba165f 100644 --- a/scheduler/scheduler.go +++ b/scheduler/scheduler.go @@ -2,4 +2,6 @@ // Use of this source code is governed by the Drone Non-Commercial License // that can be found in the LICENSE file. +// +build !oss + package scheduler diff --git a/service/content/cache/contents.go b/service/content/cache/contents.go index 3ca16c0a..e10ce49a 100644 --- a/service/content/cache/contents.go +++ b/service/content/cache/contents.go @@ -1,16 +1,8 @@ -// Copyright 2019 Drone IO, Inc. -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. +// Copyright 2019 Drone.IO Inc. All rights reserved. +// Use of this source code is governed by the Drone Non-Commercial License +// that can be found in the LICENSE file. + +// +build !oss package cache diff --git a/service/content/cache/contents_oss.go b/service/content/cache/contents_oss.go new file mode 100644 index 00000000..4fa87349 --- /dev/null +++ b/service/content/cache/contents_oss.go @@ -0,0 +1,25 @@ +// Copyright 2019 Drone IO, Inc. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +// +build oss + +package cache + +import "github.com/drone/drone/core" + +// Contents returns the default FileService with no caching +// enabled. +func Contents(base core.FileService) core.FileService { + return base +} diff --git a/service/content/cache/contents_test.go b/service/content/cache/contents_test.go index c6326f67..b623c1be 100644 --- a/service/content/cache/contents_test.go +++ b/service/content/cache/contents_test.go @@ -2,6 +2,8 @@ // Use of this source code is governed by the Drone Non-Commercial License // that can be found in the LICENSE file. +// +build !oss + package cache import ( @@ -9,8 +11,8 @@ import ( "fmt" "testing" - "github.com/drone/drone/mock" "github.com/drone/drone/core" + "github.com/drone/drone/mock" "github.com/drone/go-scm/scm" "github.com/golang/mock/gomock" diff --git a/service/syncer/filter.go b/service/syncer/filter.go index 7f5ee3c4..2a403e85 100644 --- a/service/syncer/filter.go +++ b/service/syncer/filter.go @@ -2,6 +2,8 @@ // Use of this source code is governed by the Drone Non-Commercial License // that can be found in the LICENSE file. +// +build !oss + package syncer import ( diff --git a/session/session_test.go b/session/session_test.go index 8edc6222..da2b028a 100644 --- a/session/session_test.go +++ b/session/session_test.go @@ -2,6 +2,8 @@ // Use of this source code is governed by the Drone Non-Commercial License // that can be found in the LICENSE file. +// +build !oss + package session import ( diff --git a/store/batch/batch.go b/store/batch/batch.go index 7629c5db..65b92519 100644 --- a/store/batch/batch.go +++ b/store/batch/batch.go @@ -1,5 +1,4 @@ // Copyright 2019 Drone IO, Inc. -// Copyright 2016 The Linux Foundation // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. diff --git a/store/build/build.go b/store/build/build.go index 2adb83c0..7f4e1647 100644 --- a/store/build/build.go +++ b/store/build/build.go @@ -1,5 +1,4 @@ // Copyright 2019 Drone IO, Inc. -// Copyright 2016 The Linux Foundation // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. diff --git a/store/build/scan.go b/store/build/scan.go index f9365f3e..d2e08a4a 100644 --- a/store/build/scan.go +++ b/store/build/scan.go @@ -1,5 +1,4 @@ // Copyright 2019 Drone IO, Inc. -// Copyright 2016 The Linux Foundation // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. diff --git a/store/cron/cron.go b/store/cron/cron.go index b8ba3f21..b4abe4f8 100644 --- a/store/cron/cron.go +++ b/store/cron/cron.go @@ -2,14 +2,16 @@ // Use of this source code is governed by the Drone Non-Commercial License // that can be found in the LICENSE file. +// +build !oss + package cron // NewCronStore returns a new CronStore. import ( "context" - "github.com/drone/drone/store/shared/db" "github.com/drone/drone/core" + "github.com/drone/drone/store/shared/db" ) // New returns a new Cron database store. diff --git a/store/cron/cron_oss.go b/store/cron/cron_oss.go new file mode 100644 index 00000000..6fed59ba --- /dev/null +++ b/store/cron/cron_oss.go @@ -0,0 +1,60 @@ +// Copyright 2019 Drone IO, Inc. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +// +build oss + +package cron + +import ( + "context" + + "github.com/drone/drone/core" + "github.com/drone/drone/store/shared/db" + "github.com/drone/drone/store/shared/encrypt" +) + +// New returns a new Secret database store. +func New(db *db.DB, enc encrypt.Encrypter) core.CronStore { + return new(noop) +} + +type noop struct{} + +func (noop) List(ctx context.Context, id int64) ([]*core.Cron, error) { + return nil, nil +} + +func (noop) Ready(ctx context.Context, id int64) ([]*core.Cron, error) { + return nil, nil +} + +func (noop) Find(ctx context.Context, id int64) (*core.Cron, error) { + return nil, nil +} + +func (noop) FindName(ctx context.Context, id int64, name string) (*core.Cron, error) { + return nil, nil +} + +func (noop) Create(ctx context.Context, secret *core.Cron) error { + return nil +} + +func (noop) Update(context.Context, *core.Cron) error { + return nil +} + +func (noop) Delete(context.Context, *core.Cron) error { + return nil +} diff --git a/store/cron/cron_test.go b/store/cron/cron_test.go index 252d7525..bb185c04 100644 --- a/store/cron/cron_test.go +++ b/store/cron/cron_test.go @@ -2,6 +2,8 @@ // Use of this source code is governed by the Drone Non-Commercial License // that can be found in the LICENSE file. +// +build !oss + package cron import ( @@ -9,9 +11,9 @@ import ( "database/sql" "testing" - "github.com/drone/drone/store/shared/db/dbtest" "github.com/drone/drone/core" "github.com/drone/drone/store/repos" + "github.com/drone/drone/store/shared/db/dbtest" ) var noContext = context.TODO() diff --git a/store/cron/scan.go b/store/cron/scan.go index 0a149c62..68a73b20 100644 --- a/store/cron/scan.go +++ b/store/cron/scan.go @@ -2,13 +2,15 @@ // Use of this source code is governed by the Drone Non-Commercial License // that can be found in the LICENSE file. +// +build !oss + package cron import ( "database/sql" - "github.com/drone/drone/store/shared/db" "github.com/drone/drone/core" + "github.com/drone/drone/store/shared/db" ) // helper function converts the User structure to a set diff --git a/store/logs/logs.go b/store/logs/logs.go index 21608ea8..9b9c7853 100644 --- a/store/logs/logs.go +++ b/store/logs/logs.go @@ -1,5 +1,4 @@ // Copyright 2019 Drone IO, Inc. -// Copyright 2016 The Linux Foundation // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. diff --git a/store/logs/s3.go b/store/logs/s3.go index 320305ea..82a2cf0e 100644 --- a/store/logs/s3.go +++ b/store/logs/s3.go @@ -2,6 +2,8 @@ // Use of this source code is governed by the Drone Non-Commercial License // that can be found in the LICENSE file. +// +build !oss + package logs import ( diff --git a/store/logs/s3_test.go b/store/logs/s3_test.go index 6f24f3a2..a7530834 100644 --- a/store/logs/s3_test.go +++ b/store/logs/s3_test.go @@ -2,6 +2,8 @@ // Use of this source code is governed by the Drone Non-Commercial License // that can be found in the LICENSE file. +// +build !oss + package logs import "testing" diff --git a/store/logs/scan.go b/store/logs/scan.go index ab3ab5fe..651b9662 100644 --- a/store/logs/scan.go +++ b/store/logs/scan.go @@ -1,5 +1,4 @@ // Copyright 2019 Drone IO, Inc. -// Copyright 2016 The Linux Foundation // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. diff --git a/store/perm/perm.go b/store/perm/perm.go index 4657e4e9..b2bca074 100644 --- a/store/perm/perm.go +++ b/store/perm/perm.go @@ -1,5 +1,4 @@ // Copyright 2019 Drone IO, Inc. -// Copyright 2016 The Linux Foundation // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. diff --git a/store/perm/scan.go b/store/perm/scan.go index 18b23328..d56c09d2 100644 --- a/store/perm/scan.go +++ b/store/perm/scan.go @@ -1,5 +1,4 @@ // Copyright 2019 Drone IO, Inc. -// Copyright 2016 The Linux Foundation // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. diff --git a/store/repos/repos.go b/store/repos/repos.go index ebf50d4f..80669967 100644 --- a/store/repos/repos.go +++ b/store/repos/repos.go @@ -1,5 +1,4 @@ // Copyright 2019 Drone IO, Inc. -// Copyright 2016 The Linux Foundation // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. diff --git a/store/repos/repos_test.go b/store/repos/repos_test.go index 9be89375..2506a7a6 100644 --- a/store/repos/repos_test.go +++ b/store/repos/repos_test.go @@ -2,6 +2,8 @@ // Use of this source code is governed by the Drone Non-Commercial License // that can be found in the LICENSE file. +// +build !oss + package repos import ( @@ -10,9 +12,9 @@ import ( "io/ioutil" "testing" + "github.com/drone/drone/core" "github.com/drone/drone/store/shared/db" "github.com/drone/drone/store/shared/db/dbtest" - "github.com/drone/drone/core" "github.com/google/go-cmp/cmp" "github.com/google/go-cmp/cmp/cmpopts" diff --git a/store/repos/scan.go b/store/repos/scan.go index 93815cf8..c1cda5a9 100644 --- a/store/repos/scan.go +++ b/store/repos/scan.go @@ -1,5 +1,4 @@ // Copyright 2019 Drone IO, Inc. -// Copyright 2016 The Linux Foundation // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. diff --git a/store/repos/type.go b/store/repos/type.go index 2a28eb8f..f00ad118 100644 --- a/store/repos/type.go +++ b/store/repos/type.go @@ -1,5 +1,4 @@ // Copyright 2019 Drone IO, Inc. -// Copyright 2016 The Linux Foundation // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. diff --git a/store/secret/scan.go b/store/secret/scan.go index 5ab56469..f83df2ac 100644 --- a/store/secret/scan.go +++ b/store/secret/scan.go @@ -1,17 +1,8 @@ -// Copyright 2019 Drone IO, Inc. -// Copyright 2016 The Linux Foundation -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. +// Copyright 2019 Drone.IO Inc. All rights reserved. +// Use of this source code is governed by the Drone Non-Commercial License +// that can be found in the LICENSE file. + +// +build !oss package secret diff --git a/store/secret/secret.go b/store/secret/secret.go index c29ec9ed..062eb3c4 100644 --- a/store/secret/secret.go +++ b/store/secret/secret.go @@ -1,17 +1,8 @@ -// Copyright 2019 Drone IO, Inc. -// Copyright 2016 The Linux Foundation -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. +// Copyright 2019 Drone.IO Inc. All rights reserved. +// Use of this source code is governed by the Drone Non-Commercial License +// that can be found in the LICENSE file. + +// +build !oss package secret diff --git a/store/secret/secret_oss.go b/store/secret/secret_oss.go new file mode 100644 index 00000000..dff34864 --- /dev/null +++ b/store/secret/secret_oss.go @@ -0,0 +1,56 @@ +// Copyright 2019 Drone IO, Inc. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +// +build oss + +package secret + +import ( + "context" + + "github.com/drone/drone/core" + "github.com/drone/drone/store/shared/db" + "github.com/drone/drone/store/shared/encrypt" +) + +// New returns a new Secret database store. +func New(db *db.DB, enc encrypt.Encrypter) core.SecretStore { + return new(noop) +} + +type noop struct{} + +func (noop) List(ctx context.Context, id int64) ([]*core.Secret, error) { + return nil, nil +} + +func (noop) Find(ctx context.Context, id int64) (*core.Secret, error) { + return nil, nil +} + +func (noop) FindName(ctx context.Context, id int64, name string) (*core.Secret, error) { + return nil, nil +} + +func (noop) Create(ctx context.Context, secret *core.Secret) error { + return nil +} + +func (noop) Update(context.Context, *core.Secret) error { + return nil +} + +func (noop) Delete(context.Context, *core.Secret) error { + return nil +} diff --git a/store/secret/secret_test.go b/store/secret/secret_test.go index 39664527..9a983f95 100644 --- a/store/secret/secret_test.go +++ b/store/secret/secret_test.go @@ -2,6 +2,8 @@ // Use of this source code is governed by the Drone Non-Commercial License // that can be found in the LICENSE file. +// +build !oss + package secret import ( @@ -9,10 +11,10 @@ import ( "database/sql" "testing" - "github.com/drone/drone/store/shared/db/dbtest" - "github.com/drone/drone/store/shared/encrypt" "github.com/drone/drone/core" "github.com/drone/drone/store/repos" + "github.com/drone/drone/store/shared/db/dbtest" + "github.com/drone/drone/store/shared/encrypt" ) var noContext = context.TODO() diff --git a/store/stage/scan.go b/store/stage/scan.go index 722bcacb..cee0051e 100644 --- a/store/stage/scan.go +++ b/store/stage/scan.go @@ -1,5 +1,4 @@ // Copyright 2019 Drone IO, Inc. -// Copyright 2016 The Linux Foundation // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. diff --git a/store/stage/stage.go b/store/stage/stage.go index 46808256..33a40715 100644 --- a/store/stage/stage.go +++ b/store/stage/stage.go @@ -1,5 +1,4 @@ // Copyright 2019 Drone IO, Inc. -// Copyright 2016 The Linux Foundation // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. diff --git a/store/stage/stage_test.go b/store/stage/stage_test.go index dba75568..9a6b82ec 100644 --- a/store/stage/stage_test.go +++ b/store/stage/stage_test.go @@ -2,17 +2,19 @@ // Use of this source code is governed by the Drone Non-Commercial License // that can be found in the LICENSE file. +// +build !oss + package stage import ( "context" "testing" - "github.com/drone/drone/store/shared/db" - "github.com/drone/drone/store/shared/db/dbtest" "github.com/drone/drone/core" "github.com/drone/drone/store/build" "github.com/drone/drone/store/repos" + "github.com/drone/drone/store/shared/db" + "github.com/drone/drone/store/shared/db/dbtest" ) var noContext = context.TODO() diff --git a/store/stage/type.go b/store/stage/type.go index 24391762..baa00d39 100644 --- a/store/stage/type.go +++ b/store/stage/type.go @@ -1,5 +1,4 @@ // Copyright 2019 Drone IO, Inc. -// Copyright 2016 The Linux Foundation // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. diff --git a/store/step/scan.go b/store/step/scan.go index 799ac363..d5e014f5 100644 --- a/store/step/scan.go +++ b/store/step/scan.go @@ -1,5 +1,4 @@ // Copyright 2019 Drone IO, Inc. -// Copyright 2016 The Linux Foundation // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. diff --git a/store/step/step.go b/store/step/step.go index b1ff8b8e..e43350bd 100644 --- a/store/step/step.go +++ b/store/step/step.go @@ -1,5 +1,4 @@ // Copyright 2019 Drone IO, Inc. -// Copyright 2016 The Linux Foundation // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. diff --git a/store/step/step_test.go b/store/step/step_test.go index 28aa8b20..92906cfd 100644 --- a/store/step/step_test.go +++ b/store/step/step_test.go @@ -2,17 +2,19 @@ // Use of this source code is governed by the Drone Non-Commercial License // that can be found in the LICENSE file. +// +build !oss + package step import ( "context" "testing" - "github.com/drone/drone/store/shared/db" - "github.com/drone/drone/store/shared/db/dbtest" "github.com/drone/drone/core" "github.com/drone/drone/store/build" "github.com/drone/drone/store/repos" + "github.com/drone/drone/store/shared/db" + "github.com/drone/drone/store/shared/db/dbtest" ) var noContext = context.TODO() diff --git a/store/store.go b/store/store.go index 433638d8..46800812 100644 --- a/store/store.go +++ b/store/store.go @@ -1,5 +1,15 @@ -// Copyright 2019 Drone.IO Inc. All rights reserved. -// Use of this source code is governed by the Drone Non-Commercial License -// that can be found in the LICENSE file. +// Copyright 2019 Drone IO, Inc. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. package store diff --git a/store/user/scan.go b/store/user/scan.go index 63049f41..54a1ce29 100644 --- a/store/user/scan.go +++ b/store/user/scan.go @@ -1,5 +1,4 @@ // Copyright 2019 Drone IO, Inc. -// Copyright 2016 The Linux Foundation // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. diff --git a/store/user/user.go b/store/user/user.go index c2ea78b0..dfa7d62c 100644 --- a/store/user/user.go +++ b/store/user/user.go @@ -1,5 +1,4 @@ // Copyright 2019 Drone IO, Inc. -// Copyright 2016 The Linux Foundation // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. diff --git a/store/user/user_test.go b/store/user/user_test.go index 157ef091..778067ab 100644 --- a/store/user/user_test.go +++ b/store/user/user_test.go @@ -2,6 +2,8 @@ // Use of this source code is governed by the Drone Non-Commercial License // that can be found in the LICENSE file. +// +build !oss + package user import ( diff --git a/trigger/change.go b/trigger/change.go index 72e63521..7fd42b29 100644 --- a/trigger/change.go +++ b/trigger/change.go @@ -2,6 +2,8 @@ // Use of this source code is governed by the Drone Non-Commercial License // that can be found in the LICENSE file. +// +build !oss + package trigger // import ( diff --git a/trigger/change_test.go b/trigger/change_test.go index 7b19741b..423fc231 100644 --- a/trigger/change_test.go +++ b/trigger/change_test.go @@ -2,6 +2,8 @@ // Use of this source code is governed by the Drone Non-Commercial License // that can be found in the LICENSE file. +// +build !oss + package trigger // import ( diff --git a/trigger/cron/cron.go b/trigger/cron/cron.go index 72061649..5b93a62c 100644 --- a/trigger/cron/cron.go +++ b/trigger/cron/cron.go @@ -2,6 +2,8 @@ // Use of this source code is governed by the Drone Non-Commercial License // that can be found in the LICENSE file. +// +build !oss + package cron import ( diff --git a/trigger/cron/cron_oss.go b/trigger/cron/cron_oss.go new file mode 100644 index 00000000..cc9b5c90 --- /dev/null +++ b/trigger/cron/cron_oss.go @@ -0,0 +1,41 @@ +// Copyright 2019 Drone IO, Inc. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +// +build oss + +package cron + +import ( + "context" + "time" + + "github.com/drone/drone/core" +) + +// New returns a noop Cron scheduler. +func New( + core.CommitService, + core.CronStore, + core.RepositoryStore, + core.UserStore, + core.Triggerer, +) *noop { + return &noop{} +} + +type noop struct{} + +func (noop) Start(context.Context, time.Duration) error { + return nil +} diff --git a/trigger/cron/cron_test.go b/trigger/cron/cron_test.go index 09e9e1ee..a979f8da 100644 --- a/trigger/cron/cron_test.go +++ b/trigger/cron/cron_test.go @@ -2,6 +2,8 @@ // Use of this source code is governed by the Drone Non-Commercial License // that can be found in the LICENSE file. +// +build !oss + package cron import ( diff --git a/trigger/skip.go b/trigger/skip.go index 9670cea8..c9da6e45 100644 --- a/trigger/skip.go +++ b/trigger/skip.go @@ -2,6 +2,8 @@ // Use of this source code is governed by the Drone Non-Commercial License // that can be found in the LICENSE file. +// +build !oss + package trigger import ( diff --git a/trigger/skip_test.go b/trigger/skip_test.go index 3164942e..8d77e22a 100644 --- a/trigger/skip_test.go +++ b/trigger/skip_test.go @@ -2,6 +2,8 @@ // Use of this source code is governed by the Drone Non-Commercial License // that can be found in the LICENSE file. +// +build !oss + package trigger import ( @@ -203,14 +205,17 @@ func Test_skipMessageEval(t *testing.T) { {"foo [ci skip] bar", true}, {"foo [CI SKIP] bar", true}, {"foo [CI Skip] bar", true}, + {"foo [CI SKIP]", true}, // test [SKIP CI] {"foo [skip ci] bar", true}, {"foo [SKIP CI] bar", true}, {"foo [Skip CI] bar", true}, + {"foo [SKIP CI]", true}, // test ***NO_CI*** {"foo ***NO_CI*** bar", true}, {"foo ***NO_CI*** bar", true}, {"foo ***NO_CI*** bar", true}, + {"foo ***NO_CI***", true}, } for _, test := range tests { got, want := skipMessageEval(test.eval), test.want diff --git a/trigger/trigger.go b/trigger/trigger.go index 7f5b0298..da137105 100644 --- a/trigger/trigger.go +++ b/trigger/trigger.go @@ -2,6 +2,8 @@ // Use of this source code is governed by the Drone Non-Commercial License // that can be found in the LICENSE file. +// +build !oss + package trigger import ( diff --git a/trigger/trigger_test.go b/trigger/trigger_test.go index 06930a52..04cf6f47 100644 --- a/trigger/trigger_test.go +++ b/trigger/trigger_test.go @@ -2,6 +2,8 @@ // Use of this source code is governed by the Drone Non-Commercial License // that can be found in the LICENSE file. +// +build !oss + package trigger import ( diff --git a/version/version_test.go b/version/version_test.go index 313a9bd8..fcefa806 100644 --- a/version/version_test.go +++ b/version/version_test.go @@ -2,6 +2,8 @@ // Use of this source code is governed by the Drone Non-Commercial License // that can be found in the LICENSE file. +// +build !oss + package version import "testing"