From 3a7ae654fc66b41ec1ecdfbcf23e8b4262c3cb24 Mon Sep 17 00:00:00 2001 From: kaitoy Date: Mon, 16 Sep 2019 16:50:05 +0900 Subject: [PATCH] fix OSS build for v1.4.0. --- BUILDING_OSS | 2 +- handler/api/repos/builds/rollback_oss.go | 4 ++-- plugin/converter/legacy_oss.go | 27 ++++++++++++++++++++++ plugin/converter/memoize.go | 2 ++ plugin/converter/memoize_oss.go | 29 ++++++++++++++++++++++++ plugin/converter/remote_oss.go | 27 ++++++++++++++++++++++ plugin/validator/noop.go | 2 +- 7 files changed, 89 insertions(+), 4 deletions(-) create mode 100644 plugin/converter/legacy_oss.go create mode 100644 plugin/converter/memoize_oss.go create mode 100644 plugin/converter/remote_oss.go diff --git a/BUILDING_OSS b/BUILDING_OSS index 94107314..b7ed226f 100644 --- a/BUILDING_OSS +++ b/BUILDING_OSS @@ -2,7 +2,7 @@ 2. Install go 1.11 or later with Go modules enabled 3. Install binaries to $GOPATH/bin - go install -tags oss,nolimit github.com/drone/drone/cmd/drone-server + go install -tags "oss nolimit" github.com/drone/drone/cmd/drone-server 4. Start the server at localhost:8080 diff --git a/handler/api/repos/builds/rollback_oss.go b/handler/api/repos/builds/rollback_oss.go index b7065331..3f1c3217 100644 --- a/handler/api/repos/builds/rollback_oss.go +++ b/handler/api/repos/builds/rollback_oss.go @@ -23,7 +23,7 @@ import ( "github.com/drone/drone/handler/api/render" ) -var notImplemented = func(w http.ResponseWriter, r *http.Request) { +var rollbackNotImplemented = func(w http.ResponseWriter, r *http.Request) { render.NotImplemented(w, render.ErrNotImplemented) } @@ -33,5 +33,5 @@ func HandleRollback( core.BuildStore, core.Triggerer, ) http.HandlerFunc { - return notImplemented + return rollbackNotImplemented } diff --git a/plugin/converter/legacy_oss.go b/plugin/converter/legacy_oss.go new file mode 100644 index 00000000..e5aa43e9 --- /dev/null +++ b/plugin/converter/legacy_oss.go @@ -0,0 +1,27 @@ +// 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 converter + +import ( + "github.com/drone/drone/core" +) + +// Legacy returns a conversion service that converts the +// legacy 0.8 file to a yaml file. +func Legacy(enabled bool) core.ConvertService { + return new(noop) +} diff --git a/plugin/converter/memoize.go b/plugin/converter/memoize.go index e556cff7..935cdb87 100644 --- a/plugin/converter/memoize.go +++ b/plugin/converter/memoize.go @@ -12,6 +12,8 @@ // See the License for the specific language governing permissions and // limitations under the License. +// +build !oss + package converter import ( diff --git a/plugin/converter/memoize_oss.go b/plugin/converter/memoize_oss.go new file mode 100644 index 00000000..6ac86c27 --- /dev/null +++ b/plugin/converter/memoize_oss.go @@ -0,0 +1,29 @@ +// 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 converter + +import ( + "github.com/drone/drone/core" +) + +// Memoize caches the conversion results for subsequent calls. +// This micro-optimization is intended for multi-pipeline +// projects that would otherwise covert the file for each +// pipeline execution. +func Memoize(base core.ConvertService) core.ConvertService { + return new(noop) +} diff --git a/plugin/converter/remote_oss.go b/plugin/converter/remote_oss.go new file mode 100644 index 00000000..0df95e93 --- /dev/null +++ b/plugin/converter/remote_oss.go @@ -0,0 +1,27 @@ +// 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 converter + +import ( + "github.com/drone/drone/core" +) + +// Remote returns a conversion service that converts the +// configuration file using a remote http service. +func Remote(endpoint, signer string, skipVerify bool) core.ConvertService { + return new(noop) +} diff --git a/plugin/validator/noop.go b/plugin/validator/noop.go index 7260efdd..50103010 100644 --- a/plugin/validator/noop.go +++ b/plugin/validator/noop.go @@ -24,4 +24,4 @@ import ( type noop struct{} -func (noop) Validate(context.Context, *core.ConvertArgs) error { return nil } +func (noop) Validate(context.Context, *core.ValidateArgs) error { return nil }