From d04647e75f0e0d5cc90943ed44b9852d66824543 Mon Sep 17 00:00:00 2001 From: Brad Rydzewski Date: Wed, 27 Feb 2019 23:07:13 -0800 Subject: [PATCH] add build tags --- .gitignore | 1 + LICENSE | 14 ++++-- cmd/drone-agent/config/config.go | 2 + cmd/drone-agent/main.go | 2 + cmd/drone-controller/config/config.go | 2 + cmd/drone-controller/main.go | 2 + core/build_test.go | 2 + core/cron_test.go | 2 + core/hook_test.go | 2 + core/license_test.go | 2 + core/netrc_test.go | 2 + core/secret_test.go | 2 + core/stage_test.go | 2 + core/step_test.go | 2 + core/trigger_test.go | 2 + core/user_test.go | 2 + go.sum | 1 + handler/api/api.go | 16 ++++-- handler/api/render/render.go | 9 ++++ handler/api/repos/builds/logs/delete.go | 18 +++++-- handler/api/repos/builds/logs/find.go | 18 +++++-- handler/api/repos/chown.go | 16 ++++-- handler/api/repos/collabs/find.go | 4 +- handler/api/repos/collabs/find_test.go | 4 +- handler/api/repos/collabs/list.go | 4 +- handler/api/repos/collabs/list_test.go | 4 +- handler/api/repos/collabs/none.go | 40 +++++++++++++++ handler/api/repos/collabs/remove.go | 4 +- handler/api/repos/collabs/remove_test.go | 2 + handler/api/repos/crons/create.go | 4 +- handler/api/repos/crons/create_test.go | 4 +- handler/api/repos/crons/delete.go | 4 +- handler/api/repos/crons/delete_test.go | 4 +- handler/api/repos/crons/find.go | 4 +- handler/api/repos/crons/find_test.go | 4 +- handler/api/repos/crons/list.go | 4 +- handler/api/repos/crons/list_test.go | 4 +- handler/api/repos/crons/none.go | 48 ++++++++++++++++++ handler/api/repos/crons/update.go | 4 +- handler/api/repos/crons/update_test.go | 4 +- handler/api/repos/repair.go | 18 +++++-- handler/api/repos/secrets/create.go | 18 ++----- handler/api/repos/secrets/create_test.go | 4 +- handler/api/repos/secrets/delete.go | 18 ++----- handler/api/repos/secrets/delete_test.go | 2 + handler/api/repos/secrets/find.go | 18 ++----- handler/api/repos/secrets/find_test.go | 4 +- handler/api/repos/secrets/list.go | 18 ++----- handler/api/repos/secrets/list_test.go | 4 +- handler/api/repos/secrets/none.go | 48 ++++++++++++++++++ handler/api/repos/secrets/update.go | 18 ++----- handler/api/repos/secrets/update_test.go | 4 +- handler/api/repos/sign/sign.go | 18 +++++-- handler/api/request/context.go | 16 ++++-- handler/web/healthz.go | 16 ++++-- handler/web/logout.go | 16 ++++-- handler/web/version.go | 16 ++++-- handler/web/web.go | 16 ++++-- handler/web/writer.go | 16 ++++-- livelog/livelog.go | 2 + livelog/livelog_test.go | 2 + livelog/stream.go | 2 + livelog/stream_test.go | 2 + livelog/sub.go | 2 + livelog/sub_test.go | 2 + logger/handler_test.go | 2 + logger/logger_test.go | 2 + metric/builds.go | 2 + metric/builds_test.go | 4 +- metric/handler_test.go | 2 + metric/license.go | 2 + metric/license_test.go | 2 + metric/metric.go | 2 + metric/repos.go | 2 + metric/repos_test.go | 2 + metric/stages.go | 2 + metric/stages_test.go | 4 +- metric/users.go | 2 + metric/users_test.go | 2 + mock/mock.go | 2 + operator/runner/runner.go | 6 +-- pubsub/hub_test.go | 2 + pubsub/sub_test.go | 2 + scheduler/kube/config.go | 46 +++++++++++++++++ scheduler/kube/{kubernetes.go => kube.go} | 31 ------------ scheduler/kube/kube_oss.go | 50 +++++++++++++++++++ scheduler/nomad/config.go | 44 +++++++++++++++++ scheduler/nomad/nomad.go | 29 ----------- scheduler/nomad/nomad_oss.go | 50 +++++++++++++++++++ scheduler/scheduler.go | 2 + service/content/cache/contents.go | 18 ++----- service/content/cache/contents_oss.go | 25 ++++++++++ service/content/cache/contents_test.go | 4 +- service/syncer/filter.go | 2 + session/session_test.go | 2 + store/batch/batch.go | 1 - store/build/build.go | 1 - store/build/scan.go | 1 - store/cron/cron.go | 4 +- store/cron/cron_oss.go | 60 +++++++++++++++++++++++ store/cron/cron_test.go | 4 +- store/cron/scan.go | 4 +- store/logs/logs.go | 1 - store/logs/s3.go | 2 + store/logs/s3_test.go | 2 + store/logs/scan.go | 1 - store/perm/perm.go | 1 - store/perm/scan.go | 1 - store/repos/repos.go | 1 - store/repos/repos_test.go | 4 +- store/repos/scan.go | 1 - store/repos/type.go | 1 - store/secret/scan.go | 19 ++----- store/secret/secret.go | 19 ++----- store/secret/secret_oss.go | 56 +++++++++++++++++++++ store/secret/secret_test.go | 6 ++- store/stage/scan.go | 1 - store/stage/stage.go | 1 - store/stage/stage_test.go | 6 ++- store/stage/type.go | 1 - store/step/scan.go | 1 - store/step/step.go | 1 - store/step/step_test.go | 6 ++- store/store.go | 16 ++++-- store/user/scan.go | 1 - store/user/user.go | 1 - store/user/user_test.go | 2 + trigger/change.go | 2 + trigger/change_test.go | 2 + trigger/cron/cron.go | 2 + trigger/cron/cron_oss.go | 41 ++++++++++++++++ trigger/cron/cron_test.go | 2 + trigger/skip.go | 2 + trigger/skip_test.go | 5 ++ trigger/trigger.go | 2 + trigger/trigger_test.go | 2 + version/version_test.go | 2 + 137 files changed, 941 insertions(+), 266 deletions(-) create mode 100644 handler/api/repos/collabs/none.go create mode 100644 handler/api/repos/crons/none.go create mode 100644 handler/api/repos/secrets/none.go create mode 100644 scheduler/kube/config.go rename scheduler/kube/{kubernetes.go => kube.go} (89%) create mode 100644 scheduler/kube/kube_oss.go create mode 100644 scheduler/nomad/config.go create mode 100644 scheduler/nomad/nomad_oss.go create mode 100644 service/content/cache/contents_oss.go create mode 100644 store/cron/cron_oss.go create mode 100644 store/secret/secret_oss.go create mode 100644 trigger/cron/cron_oss.go diff --git a/.gitignore b/.gitignore index 7c3bc8f7e8..301503123f 100644 --- a/.gitignore +++ b/.gitignore @@ -6,3 +6,4 @@ .env .env.* release/ +scripts/ diff --git a/LICENSE b/LICENSE index 0e3e172e79..5c0b049bb4 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 e577cacffa..6d276cde37 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 0b16df573e..9b9fcec0ec 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 7f809e1bd2..2e2ae9bbb3 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 138dd172db..91a67424f4 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 3e670ff63b..0912528b2f 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 3e670ff63b..0912528b2f 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 3e670ff63b..0912528b2f 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 3e670ff63b..0912528b2f 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 3e670ff63b..0912528b2f 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 3a8f218d5e..c9400844d2 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 fb82adeca4..b00c91c987 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 78881f72a2..b7d689a466 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 3e670ff63b..0912528b2f 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 97482b8b3f..7d7d0eeca5 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 c498839c56..205374b19f 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 1f4b49bc94..ae2359588c 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 077ecaaf94..31469c8771 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 08f1badec3..a26e8e9a30 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 a542e4b8a3..84abb0b2cc 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 bca3f08d6d..efd0f39950 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 957d9d0eb9..e2dd450663 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 aaefb6e51c..015861696a 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 df47921b44..4868e685c7 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 d3055a3edf..e8b073a0af 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 0000000000..47c62a78d7 --- /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 415e86f5e5..dd3328abf4 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 45c5314215..109ed74abf 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 2aa5ab3d14..bffa767887 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 f9ce8ed81c..113c6ebb77 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 da716bc318..5a67a90b69 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 9546cac615..26a0a89efb 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 0037830f96..45292c8616 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 d408d6eaf6..942789f1f5 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 466094248c..06af147e8a 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 3dfc758b3c..7762cd52cf 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 0000000000..2509399132 --- /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 3022cfaeb1..4cf49baa11 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 9ce739ad37..0160458358 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 8c7cfc8dff..683c17d987 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 c163fa2096..809b883b19 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 78b1177331..5de51d98b9 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 4fddb32662..a88878b7b0 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 9db3dbfd40..67a982f0c5 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 b86a41cd64..67ae98bb62 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 b68f395d50..dbf8c9defd 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 60c3d167a2..ebdcf4bfe9 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 bc5763a042..cf1b9b6a3a 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 0000000000..894e070a5b --- /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 10503e9744..b1e56e6033 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 ab9f7cf329..2ff79f34b8 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 cd533e2fe2..ff070acc96 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 7a15660723..a1fe086a4c 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 c1c1936d58..61c3d919c3 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 245231d369..a969a32ef8 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 494c775976..7c48cf6b57 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 9c1ede686f..2fcf2fc200 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 f2f3f1f1bb..55fba239cb 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 099d11144f..58b9cd9e74 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 665dbd0868..b857799d2a 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 8c81d4a154..2fc79a22e7 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 d182dcc307..9453abe8c0 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 8762af66b0..c7bdb7006c 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 4bf697adf1..ab9bc07213 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 f41d667a3c..71c08ad5af 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 f9e3eeb280..37569fc8c6 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 99750f0482..dd04622c81 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 f577703eb5..33d293a6f6 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 5b82344ced..27892aaf10 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 aa9ac79c80..a7b0e6929c 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 2d5ed2761a..66b058b4ec 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 2d5ed2761a..66b058b4ec 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 b357ddc13c..430be9fcc8 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 54234c8242..dc012b884d 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 373bf9afcc..0cb4a42f42 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 267ec4ff9b..d79b6922cd 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 5784c70821..fd5162df8e 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 b3b1a06e14..646d8c2035 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 3e4f232955..4ac556e78f 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 c67ca13b56..97ce612919 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 ea74946907..ac728ab841 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 cb4bd9f558..1ac4f88e71 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 0000000000..e63ddc96be --- /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 3b9357c1cd..d2566798d1 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 0000000000..3f935c67ff --- /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 0000000000..15473683d9 --- /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 f82ef4eb53..dd054398a1 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 0000000000..edbb9c8f19 --- /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 874a75d926..4aba165f90 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 3ca16c0ac7..e10ce49a52 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 0000000000..4fa8734990 --- /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 c6326f679d..b623c1be60 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 7f5ee3c4f0..2a403e85cd 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 8edc6222e9..da2b028abc 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 7629c5dbee..65b9251972 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 2adb83c086..7f4e1647d6 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 f9365f3ea5..d2e08a4aff 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 b8ba3f2110..b4abe4f821 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 0000000000..6fed59ba85 --- /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 252d7525c1..bb185c040f 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 0a149c627f..68a73b20ba 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 21608ea8cc..9b9c78535f 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 320305ea89..82a2cf0e90 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 6f24f3a2d9..a7530834a6 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 ab3ab5fe3b..651b966248 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 4657e4e9e9..b2bca074b2 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 18b233283d..d56c09d20f 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 ebf50d4f8b..8066996724 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 9be89375b0..2506a7a6c4 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 93815cf8ca..c1cda5a92e 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 2a28eb8f65..f00ad11836 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 5ab56469bf..f83df2ac8e 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 c29ec9ed13..062eb3c47d 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 0000000000..dff3486433 --- /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 39664527ad..9a983f957d 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 722bcacb66..cee0051ed9 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 46808256bc..33a40715b9 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 dba7556857..9a6b82ec88 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 2439176289..baa00d3962 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 799ac36349..d5e014f52c 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 b1ff8b8e69..e43350bdc3 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 28aa8b2039..92906cfde8 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 433638d854..46800812a9 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 63049f4146..54a1ce2973 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 c2ea78b08f..dfa7d62c28 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 157ef0919b..778067ab2c 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 72e63521b1..7fd42b298f 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 7b19741b76..423fc23187 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 720616490d..5b93a62ce8 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 0000000000..cc9b5c900f --- /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 09e9e1ee85..a979f8dab6 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 9670cea862..c9da6e45ff 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 3164942e05..8d77e22a34 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 7f5b02981d..da1371050e 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 06930a528d..04cf6f47d8 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 313a9bd85b..fcefa8068c 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"