add build tags

This commit is contained in:
Brad Rydzewski 2019-02-27 23:07:13 -08:00
parent 7c1f21d872
commit d04647e75f
137 changed files with 941 additions and 266 deletions

1
.gitignore vendored
View file

@ -6,3 +6,4 @@
.env
.env.*
release/
scripts/

14
LICENSE
View file

@ -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.
-----------------------------------------------------------------

View file

@ -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 (

View file

@ -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 (

View file

@ -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 (

View file

@ -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 (

View file

@ -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

View file

@ -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

View file

@ -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

View file

@ -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

View file

@ -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

View file

@ -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"

View file

@ -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"

View file

@ -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"

View file

@ -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

View file

@ -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 (

1
go.sum
View file

@ -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=

View file

@ -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

View file

@ -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) {

View file

@ -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"
)

View file

@ -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"
)

View file

@ -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

View file

@ -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"
)

View file

@ -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"

View file

@ -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"
)

View file

@ -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"

View file

@ -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
}

View file

@ -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"
)

View file

@ -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 (

View file

@ -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"
)

View file

@ -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"

View file

@ -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"
)

View file

@ -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"

View file

@ -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"
)

View file

@ -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"

View file

@ -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"
)

View file

@ -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"

View file

@ -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
}

View file

@ -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"
)

View file

@ -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"

View file

@ -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"
)

View file

@ -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

View file

@ -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"

View file

@ -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

View file

@ -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 (

View file

@ -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

View file

@ -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"

View file

@ -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

View file

@ -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"

View file

@ -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
}

View file

@ -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

View file

@ -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"

View file

@ -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"
)

View file

@ -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

View file

@ -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

View file

@ -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

View file

@ -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

View file

@ -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

View file

@ -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

View file

@ -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 (

View file

@ -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 (

View file

@ -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 (

View file

@ -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 (

View file

@ -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 (

View file

@ -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 (

View file

@ -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"

View file

@ -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 (

View file

@ -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 (

View file

@ -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"

View file

@ -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 (

View file

@ -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"

View file

@ -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

View file

@ -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

View file

@ -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 (

View file

@ -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 (

View file

@ -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 (

View file

@ -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"

View file

@ -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 (

View file

@ -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 (

View file

@ -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

View file

@ -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)

View file

@ -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 (

View file

@ -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 (

46
scheduler/kube/config.go Normal file
View file

@ -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
}

View file

@ -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

View file

@ -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
}

44
scheduler/nomad/config.go Normal file
View file

@ -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
}

View file

@ -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

View file

@ -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
}

View file

@ -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

View file

@ -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

25
service/content/cache/contents_oss.go vendored Normal file
View file

@ -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
}

View file

@ -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"

View file

@ -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 (

View file

@ -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 (

View file

@ -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.

View file

@ -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.

View file

@ -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.

View file

@ -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.

60
store/cron/cron_oss.go Normal file
View file

@ -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
}

Some files were not shown because too many files have changed in this diff Show more