mirror of
https://github.com/harness/drone.git
synced 2025-05-31 11:43:15 +00:00
wip enable CE
This commit is contained in:
parent
26d2fc6ef8
commit
6621f4c7f7
@ -23,11 +23,11 @@ local mounts = [
|
|||||||
|
|
||||||
# defines a pipeline step that builds and publishes
|
# defines a pipeline step that builds and publishes
|
||||||
# a docker image to a docker remote registry.
|
# a docker image to a docker remote registry.
|
||||||
local docker(name, os, arch) = {
|
local docker(name, image, os, arch) = {
|
||||||
name: "publish_" + name,
|
name: "publish_" + name,
|
||||||
image: "plugins/docker",
|
image: "plugins/docker",
|
||||||
settings: {
|
settings: {
|
||||||
repo: "drone/" + name,
|
repo: "drone/" + image,
|
||||||
auto_tag: true,
|
auto_tag: true,
|
||||||
auto_tag_suffix: os + "-" + arch,
|
auto_tag_suffix: os + "-" + arch,
|
||||||
username: { from_secret: "docker_username" },
|
username: { from_secret: "docker_username" },
|
||||||
@ -45,6 +45,7 @@ local manifest(name) = {
|
|||||||
name: name,
|
name: name,
|
||||||
image: "plugins/manifest:1",
|
image: "plugins/manifest:1",
|
||||||
settings: {
|
settings: {
|
||||||
|
auto_tag: true,
|
||||||
ignore_missing: true,
|
ignore_missing: true,
|
||||||
spec: "docker/manifest." + name + ".tmpl",
|
spec: "docker/manifest." + name + ".tmpl",
|
||||||
username: { from_secret: "docker_username" },
|
username: { from_secret: "docker_username" },
|
||||||
@ -85,9 +86,9 @@ local pipeline(name, os, arch) = {
|
|||||||
event: [ "push", "tag" ],
|
event: [ "push", "tag" ],
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
docker("agent", os, arch),
|
docker("agent", "agent", os, arch),
|
||||||
docker("controller", os, arch),
|
docker("controller", "controller", os, arch),
|
||||||
docker("server", os, arch),
|
docker("server", "drone", os, arch),
|
||||||
],
|
],
|
||||||
};
|
};
|
||||||
|
|
||||||
@ -99,7 +100,7 @@ local pipeline(name, os, arch) = {
|
|||||||
kind: "pipeline",
|
kind: "pipeline",
|
||||||
name: "manifest",
|
name: "manifest",
|
||||||
steps: [
|
steps: [
|
||||||
manifest("server"),
|
manifest("drone"),
|
||||||
manifest("agent"),
|
manifest("agent"),
|
||||||
manifest("controller"),
|
manifest("controller"),
|
||||||
],
|
],
|
||||||
|
110
.drone.script
Normal file
110
.drone.script
Normal file
@ -0,0 +1,110 @@
|
|||||||
|
def main():
|
||||||
|
return [
|
||||||
|
pipeline('linux-amd64', 'linux', 'amd64'),
|
||||||
|
pipeline('linux-arm64', 'linux', 'arm64'),
|
||||||
|
pipeline('linux-arm', 'linux', 'arm'),
|
||||||
|
manifest(),
|
||||||
|
]
|
||||||
|
|
||||||
|
# defines a pipeline step that builds and publishes a docker
|
||||||
|
# image to a docker remote registry.
|
||||||
|
def docker_step(name, os, arch):
|
||||||
|
repo = 'drone/%s' % name
|
||||||
|
if repo == 'server':
|
||||||
|
repo = 'drone/drone'
|
||||||
|
return {
|
||||||
|
'name': 'publish_%s' % name,
|
||||||
|
'image': 'plugins/docker',
|
||||||
|
'settings': {
|
||||||
|
'repo': repo,
|
||||||
|
'auto_tag': True,
|
||||||
|
'auto_tag_suffix': '%s-%s' % (os, arch),
|
||||||
|
'username': 'drone',
|
||||||
|
'password': { 'from_secret': 'docker_password' },
|
||||||
|
'dockerfile': 'docker/Dockerfile.%s.%s.%s' % (name, os, arch),
|
||||||
|
},
|
||||||
|
'when': {
|
||||||
|
'event': [ 'push', 'tag' ],
|
||||||
|
},
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
# defines a pipeline step that creates and publishes
|
||||||
|
# a docker manifest to a docker remote registry.
|
||||||
|
def manifest_step(name):
|
||||||
|
return {
|
||||||
|
'name': 'publish_%s' % name,
|
||||||
|
'image': 'plugins/manifest:1',
|
||||||
|
'settings': {
|
||||||
|
'auto_tag': True,
|
||||||
|
'ignore_missing': True,
|
||||||
|
'spec': 'docker/manifest.%s.tmpl' % name,
|
||||||
|
'username': 'drone',
|
||||||
|
'password': { 'from_secret': 'docker_password' },
|
||||||
|
},
|
||||||
|
'when': {
|
||||||
|
'event': [ 'push', 'tag' ],
|
||||||
|
},
|
||||||
|
}
|
||||||
|
|
||||||
|
# defines a pipeline step that executes the Go unit tests.
|
||||||
|
# this will also download dependencies and cache in /go
|
||||||
|
def test_step():
|
||||||
|
return {
|
||||||
|
'name': 'test',
|
||||||
|
'image': 'golang:1.11',
|
||||||
|
'commands': [
|
||||||
|
'go test ./...',
|
||||||
|
],
|
||||||
|
}
|
||||||
|
|
||||||
|
# defines a pipeline step that executes the Go unit tests.
|
||||||
|
# this will also download dependencies and cache in /go
|
||||||
|
def build_step(os, arch):
|
||||||
|
return {
|
||||||
|
'name': 'build',
|
||||||
|
'image': 'golang:1.11',
|
||||||
|
'commands': [
|
||||||
|
'go build -ldflags \"-extldflags \\\\\"-static\\\\\"\" -o release/%s/%s/drone-server github.com/drone/drone/cmd/drone-server' % (os, arch),
|
||||||
|
'CGO_ENABLED=0 go build -o release/%s/%s/drone-agent github.com/drone/drone/cmd/drone-agent' % (os, arch),
|
||||||
|
'CGO_ENABLED=0 go build -o release/%s/%s/drone-controller github.com/drone/drone/cmd/drone-controller' % (os, arch),
|
||||||
|
]
|
||||||
|
}
|
||||||
|
|
||||||
|
# defines a pipeline that builds, tests and publishes
|
||||||
|
# docker images for the Drone agent, server and controller.
|
||||||
|
def pipeline(name, os, arch):
|
||||||
|
return {
|
||||||
|
'kind': 'pipeline',
|
||||||
|
'name': 'default',
|
||||||
|
'platform': {
|
||||||
|
'os': os,
|
||||||
|
'arch': arch,
|
||||||
|
},
|
||||||
|
'steps': [
|
||||||
|
test_step(),
|
||||||
|
build_step(os, arch),
|
||||||
|
docker_step('drone', os, arch),
|
||||||
|
docker_step('agent', os, arch),
|
||||||
|
docker_step('controller', os, arch),
|
||||||
|
],
|
||||||
|
}
|
||||||
|
|
||||||
|
# defines a pipeline that updates the docker manifest
|
||||||
|
# for the architecture-specific images previously published
|
||||||
|
# to dockerhub.
|
||||||
|
def manifest():
|
||||||
|
return {
|
||||||
|
'kind': 'pipeline',
|
||||||
|
'name': 'manifest',
|
||||||
|
'steps': [
|
||||||
|
manifest_step('server'),
|
||||||
|
manifest_step('agent'),
|
||||||
|
manifest_step('controller'),
|
||||||
|
],
|
||||||
|
'depends_on': [
|
||||||
|
'linux-amd64',
|
||||||
|
'linux-arm64',
|
||||||
|
'linux-arm',
|
||||||
|
],
|
||||||
|
}
|
13
.drone.yml
13
.drone.yml
@ -69,7 +69,7 @@ steps:
|
|||||||
dockerfile: docker/Dockerfile.server.linux.amd64
|
dockerfile: docker/Dockerfile.server.linux.amd64
|
||||||
password:
|
password:
|
||||||
from_secret: docker_password
|
from_secret: docker_password
|
||||||
repo: drone/server
|
repo: drone/drone
|
||||||
username:
|
username:
|
||||||
from_secret: docker_username
|
from_secret: docker_username
|
||||||
when:
|
when:
|
||||||
@ -152,7 +152,7 @@ steps:
|
|||||||
dockerfile: docker/Dockerfile.server.linux.arm
|
dockerfile: docker/Dockerfile.server.linux.arm
|
||||||
password:
|
password:
|
||||||
from_secret: docker_password
|
from_secret: docker_password
|
||||||
repo: drone/server
|
repo: drone/drone
|
||||||
username:
|
username:
|
||||||
from_secret: docker_username
|
from_secret: docker_username
|
||||||
when:
|
when:
|
||||||
@ -235,7 +235,7 @@ steps:
|
|||||||
dockerfile: docker/Dockerfile.server.linux.arm64
|
dockerfile: docker/Dockerfile.server.linux.arm64
|
||||||
password:
|
password:
|
||||||
from_secret: docker_password
|
from_secret: docker_password
|
||||||
repo: drone/server
|
repo: drone/drone
|
||||||
username:
|
username:
|
||||||
from_secret: docker_username
|
from_secret: docker_username
|
||||||
when:
|
when:
|
||||||
@ -256,13 +256,14 @@ platform:
|
|||||||
arch: amd64
|
arch: amd64
|
||||||
|
|
||||||
steps:
|
steps:
|
||||||
- name: server
|
- name: drone
|
||||||
image: plugins/manifest:1
|
image: plugins/manifest:1
|
||||||
settings:
|
settings:
|
||||||
|
auto_tag: true
|
||||||
ignore_missing: true
|
ignore_missing: true
|
||||||
password:
|
password:
|
||||||
from_secret: docker_password
|
from_secret: docker_password
|
||||||
spec: docker/manifest.server.tmpl
|
spec: docker/manifest.drone.tmpl
|
||||||
username:
|
username:
|
||||||
from_secret: docker_username
|
from_secret: docker_username
|
||||||
when:
|
when:
|
||||||
@ -273,6 +274,7 @@ steps:
|
|||||||
- name: agent
|
- name: agent
|
||||||
image: plugins/manifest:1
|
image: plugins/manifest:1
|
||||||
settings:
|
settings:
|
||||||
|
auto_tag: true
|
||||||
ignore_missing: true
|
ignore_missing: true
|
||||||
password:
|
password:
|
||||||
from_secret: docker_password
|
from_secret: docker_password
|
||||||
@ -287,6 +289,7 @@ steps:
|
|||||||
- name: controller
|
- name: controller
|
||||||
image: plugins/manifest:1
|
image: plugins/manifest:1
|
||||||
settings:
|
settings:
|
||||||
|
auto_tag: true
|
||||||
ignore_missing: true
|
ignore_missing: true
|
||||||
password:
|
password:
|
||||||
from_secret: docker_password
|
from_secret: docker_password
|
||||||
|
3
.github/code_of_conduct.md
vendored
Normal file
3
.github/code_of_conduct.md
vendored
Normal file
@ -0,0 +1,3 @@
|
|||||||
|
## Drone Community Code of Conduct
|
||||||
|
|
||||||
|
Drone follows the [CNCF Code of Conduct](https://github.com/cncf/foundation/blob/master/code-of-conduct.md).
|
@ -1,6 +1,16 @@
|
|||||||
// Copyright 2019 Drone.IO Inc. All rights reserved.
|
// Copyright 2019 Drone IO, Inc.
|
||||||
// Use of this source code is governed by the Drone Non-Commercial License
|
//
|
||||||
// that can be found in the LICENSE file.
|
// 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 bootstrap
|
package bootstrap
|
||||||
|
|
||||||
@ -10,8 +20,8 @@ import (
|
|||||||
"time"
|
"time"
|
||||||
|
|
||||||
"github.com/dchest/uniuri"
|
"github.com/dchest/uniuri"
|
||||||
"github.com/drone/drone/logger"
|
|
||||||
"github.com/drone/drone/core"
|
"github.com/drone/drone/core"
|
||||||
|
"github.com/drone/drone/logger"
|
||||||
|
|
||||||
"github.com/sirupsen/logrus"
|
"github.com/sirupsen/logrus"
|
||||||
)
|
)
|
||||||
|
2
go.sum
2
go.sum
@ -89,6 +89,8 @@ 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-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 h1:qCv4319q2q7XKn0MQbi8p37hsJ+9Xo8e6yojA73JVxk=
|
||||||
github.com/hashicorp/go-retryablehttp v0.0.0-20180718195005-e651d75abec6/go.mod h1:fXcdFsQoipQa7mwORhKad5jmDCeSy/RCGzWA08PO0lM=
|
github.com/hashicorp/go-retryablehttp v0.0.0-20180718195005-e651d75abec6/go.mod h1:fXcdFsQoipQa7mwORhKad5jmDCeSy/RCGzWA08PO0lM=
|
||||||
|
github.com/hashicorp/go-rootcerts v1.0.0 h1:ueI78wUjYExhCvMLow4icJnayNNFRgy0d9EGs/a1T44=
|
||||||
|
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 h1:CL2msUPvZTLb5O648aiLNJw3hnBxN2+1Jq8rCOH9wdo=
|
||||||
github.com/hashicorp/golang-lru v0.5.0/go.mod h1:/m3WP610KZHVQ1SGc6re/UDhFvYD7pJ4Ao+sR/qLZy8=
|
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=
|
github.com/hashicorp/nomad v0.0.0-20190125003214-134391155854 h1:L7WhLZt2ory/kQWxqkMwOiBpIoa4BWoadN7yx8LHEtk=
|
||||||
|
@ -1,6 +1,16 @@
|
|||||||
// Copyright 2019 Drone.IO Inc. All rights reserved.
|
// Copyright 2019 Drone IO, Inc.
|
||||||
// Use of this source code is governed by the Drone Non-Commercial License
|
//
|
||||||
// that can be found in the LICENSE file.
|
// 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 acl
|
package acl
|
||||||
|
|
||||||
|
@ -1,17 +1,27 @@
|
|||||||
// Copyright 2019 Drone.IO Inc. All rights reserved.
|
// Copyright 2019 Drone IO, Inc.
|
||||||
// Use of this source code is governed by the Drone Non-Commercial License
|
//
|
||||||
// that can be found in the LICENSE file.
|
// 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 acl
|
package acl
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"net/http"
|
"net/http"
|
||||||
|
|
||||||
|
"github.com/drone/drone/core"
|
||||||
"github.com/drone/drone/handler/api/errors"
|
"github.com/drone/drone/handler/api/errors"
|
||||||
"github.com/drone/drone/handler/api/render"
|
"github.com/drone/drone/handler/api/render"
|
||||||
"github.com/drone/drone/handler/api/request"
|
"github.com/drone/drone/handler/api/request"
|
||||||
"github.com/drone/drone/logger"
|
"github.com/drone/drone/logger"
|
||||||
"github.com/drone/drone/core"
|
|
||||||
|
|
||||||
"github.com/go-chi/chi"
|
"github.com/go-chi/chi"
|
||||||
"github.com/sirupsen/logrus"
|
"github.com/sirupsen/logrus"
|
||||||
|
@ -1,6 +1,16 @@
|
|||||||
// Copyright 2019 Drone.IO Inc. All rights reserved.
|
// Copyright 2019 Drone IO, Inc.
|
||||||
// Use of this source code is governed by the Drone Non-Commercial License
|
//
|
||||||
// that can be found in the LICENSE file.
|
// 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 acl
|
package acl
|
||||||
|
|
||||||
@ -8,11 +18,11 @@ import (
|
|||||||
"net/http"
|
"net/http"
|
||||||
"time"
|
"time"
|
||||||
|
|
||||||
|
"github.com/drone/drone/core"
|
||||||
"github.com/drone/drone/handler/api/errors"
|
"github.com/drone/drone/handler/api/errors"
|
||||||
"github.com/drone/drone/handler/api/render"
|
"github.com/drone/drone/handler/api/render"
|
||||||
"github.com/drone/drone/handler/api/request"
|
"github.com/drone/drone/handler/api/request"
|
||||||
"github.com/drone/drone/logger"
|
"github.com/drone/drone/logger"
|
||||||
"github.com/drone/drone/core"
|
|
||||||
|
|
||||||
"github.com/go-chi/chi"
|
"github.com/go-chi/chi"
|
||||||
"github.com/sirupsen/logrus"
|
"github.com/sirupsen/logrus"
|
||||||
|
@ -1,15 +1,25 @@
|
|||||||
// Copyright 2019 Drone.IO Inc. All rights reserved.
|
// Copyright 2019 Drone IO, Inc.
|
||||||
// Use of this source code is governed by the Drone Non-Commercial License
|
//
|
||||||
// that can be found in the LICENSE file.
|
// 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 auth
|
package auth
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"net/http"
|
"net/http"
|
||||||
|
|
||||||
|
"github.com/drone/drone/core"
|
||||||
"github.com/drone/drone/handler/api/request"
|
"github.com/drone/drone/handler/api/request"
|
||||||
"github.com/drone/drone/logger"
|
"github.com/drone/drone/logger"
|
||||||
"github.com/drone/drone/core"
|
|
||||||
)
|
)
|
||||||
|
|
||||||
// HandleAuthentication returns an http.HandlerFunc middlewrae that authenticates
|
// HandleAuthentication returns an http.HandlerFunc middlewrae that authenticates
|
||||||
|
@ -1,6 +1,16 @@
|
|||||||
// Copyright 2019 Drone.IO Inc. All rights reserved.
|
// Copyright 2019 Drone IO, Inc.
|
||||||
// Use of this source code is governed by the Drone Non-Commercial License
|
//
|
||||||
// that can be found in the LICENSE file.
|
// 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 errors
|
package errors
|
||||||
|
|
||||||
|
@ -1,6 +1,16 @@
|
|||||||
// Copyright 2019 Drone.IO Inc. All rights reserved.
|
// Copyright 2019 Drone IO, Inc.
|
||||||
// Use of this source code is governed by the Drone Non-Commercial License
|
//
|
||||||
// that can be found in the LICENSE file.
|
// 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 render
|
package render
|
||||||
|
|
||||||
|
@ -1,6 +1,16 @@
|
|||||||
// Copyright 2019 Drone.IO Inc. All rights reserved.
|
// Copyright 2019 Drone IO, Inc.
|
||||||
// Use of this source code is governed by the Drone Non-Commercial License
|
//
|
||||||
// that can be found in the LICENSE file.
|
// 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 builds
|
package builds
|
||||||
|
|
||||||
|
@ -1,6 +1,16 @@
|
|||||||
// Copyright 2019 Drone.IO Inc. All rights reserved.
|
// Copyright 2019 Drone IO, Inc.
|
||||||
// Use of this source code is governed by the Drone Non-Commercial License
|
//
|
||||||
// that can be found in the LICENSE file.
|
// 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 builds
|
package builds
|
||||||
|
|
||||||
@ -8,8 +18,8 @@ import (
|
|||||||
"net/http"
|
"net/http"
|
||||||
"strconv"
|
"strconv"
|
||||||
|
|
||||||
"github.com/drone/drone/handler/api/render"
|
|
||||||
"github.com/drone/drone/core"
|
"github.com/drone/drone/core"
|
||||||
|
"github.com/drone/drone/handler/api/render"
|
||||||
|
|
||||||
"github.com/go-chi/chi"
|
"github.com/go-chi/chi"
|
||||||
)
|
)
|
||||||
|
@ -1,6 +1,16 @@
|
|||||||
// Copyright 2019 Drone.IO Inc. All rights reserved.
|
// Copyright 2019 Drone IO, Inc.
|
||||||
// Use of this source code is governed by the Drone Non-Commercial License
|
//
|
||||||
// that can be found in the LICENSE file.
|
// 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 builds
|
package builds
|
||||||
|
|
||||||
@ -8,8 +18,8 @@ import (
|
|||||||
"fmt"
|
"fmt"
|
||||||
"net/http"
|
"net/http"
|
||||||
|
|
||||||
"github.com/drone/drone/handler/api/render"
|
|
||||||
"github.com/drone/drone/core"
|
"github.com/drone/drone/core"
|
||||||
|
"github.com/drone/drone/handler/api/render"
|
||||||
|
|
||||||
"github.com/go-chi/chi"
|
"github.com/go-chi/chi"
|
||||||
)
|
)
|
||||||
|
@ -1,6 +1,16 @@
|
|||||||
// Copyright 2019 Drone.IO Inc. All rights reserved.
|
// Copyright 2019 Drone IO, Inc.
|
||||||
// Use of this source code is governed by the Drone Non-Commercial License
|
//
|
||||||
// that can be found in the LICENSE file.
|
// 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 builds
|
package builds
|
||||||
|
|
||||||
@ -8,9 +18,9 @@ import (
|
|||||||
"net/http"
|
"net/http"
|
||||||
"strconv"
|
"strconv"
|
||||||
|
|
||||||
|
"github.com/drone/drone/core"
|
||||||
"github.com/drone/drone/handler/api/render"
|
"github.com/drone/drone/handler/api/render"
|
||||||
"github.com/drone/drone/logger"
|
"github.com/drone/drone/logger"
|
||||||
"github.com/drone/drone/core"
|
|
||||||
|
|
||||||
"github.com/go-chi/chi"
|
"github.com/go-chi/chi"
|
||||||
)
|
)
|
||||||
|
@ -1,6 +1,16 @@
|
|||||||
// Copyright 2019 Drone.IO Inc. All rights reserved.
|
// Copyright 2019 Drone IO, Inc.
|
||||||
// Use of this source code is governed by the Drone Non-Commercial License
|
//
|
||||||
// that can be found in the LICENSE file.
|
// 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 builds
|
package builds
|
||||||
|
|
||||||
@ -8,9 +18,9 @@ import (
|
|||||||
"net/http"
|
"net/http"
|
||||||
"strconv"
|
"strconv"
|
||||||
|
|
||||||
|
"github.com/drone/drone/core"
|
||||||
"github.com/drone/drone/handler/api/render"
|
"github.com/drone/drone/handler/api/render"
|
||||||
"github.com/drone/drone/handler/api/request"
|
"github.com/drone/drone/handler/api/request"
|
||||||
"github.com/drone/drone/core"
|
|
||||||
|
|
||||||
"github.com/go-chi/chi"
|
"github.com/go-chi/chi"
|
||||||
)
|
)
|
||||||
|
@ -7,10 +7,10 @@ package repos
|
|||||||
import (
|
import (
|
||||||
"net/http"
|
"net/http"
|
||||||
|
|
||||||
|
"github.com/drone/drone/core"
|
||||||
"github.com/drone/drone/handler/api/render"
|
"github.com/drone/drone/handler/api/render"
|
||||||
"github.com/drone/drone/handler/api/request"
|
"github.com/drone/drone/handler/api/request"
|
||||||
"github.com/drone/drone/logger"
|
"github.com/drone/drone/logger"
|
||||||
"github.com/drone/drone/core"
|
|
||||||
|
|
||||||
"github.com/go-chi/chi"
|
"github.com/go-chi/chi"
|
||||||
)
|
)
|
||||||
|
@ -1,15 +1,25 @@
|
|||||||
// Copyright 2019 Drone.IO Inc. All rights reserved.
|
// Copyright 2019 Drone IO, Inc.
|
||||||
// Use of this source code is governed by the Drone Non-Commercial License
|
//
|
||||||
// that can be found in the LICENSE file.
|
// 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
|
package repos
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"net/http"
|
"net/http"
|
||||||
|
|
||||||
|
"github.com/drone/drone/core"
|
||||||
"github.com/drone/drone/handler/api/render"
|
"github.com/drone/drone/handler/api/render"
|
||||||
"github.com/drone/drone/logger"
|
"github.com/drone/drone/logger"
|
||||||
"github.com/drone/drone/core"
|
|
||||||
|
|
||||||
"github.com/go-chi/chi"
|
"github.com/go-chi/chi"
|
||||||
)
|
)
|
||||||
|
@ -1,6 +1,16 @@
|
|||||||
// Copyright 2019 Drone.IO Inc. All rights reserved.
|
// Copyright 2019 Drone IO, Inc.
|
||||||
// Use of this source code is governed by the Drone Non-Commercial License
|
//
|
||||||
// that can be found in the LICENSE file.
|
// 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
|
package repos
|
||||||
|
|
||||||
|
@ -1,6 +1,16 @@
|
|||||||
// Copyright 2019 Drone.IO Inc. All rights reserved.
|
// Copyright 2019 Drone IO, Inc.
|
||||||
// Use of this source code is governed by the Drone Non-Commercial License
|
//
|
||||||
// that can be found in the LICENSE file.
|
// 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
|
package repos
|
||||||
|
|
||||||
|
@ -1,6 +1,16 @@
|
|||||||
// Copyright 2019 Drone.IO Inc. All rights reserved.
|
// Copyright 2019 Drone IO, Inc.
|
||||||
// Use of this source code is governed by the Drone Non-Commercial License
|
//
|
||||||
// that can be found in the LICENSE file.
|
// 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 secrets
|
package secrets
|
||||||
|
|
||||||
@ -8,8 +18,8 @@ import (
|
|||||||
"encoding/json"
|
"encoding/json"
|
||||||
"net/http"
|
"net/http"
|
||||||
|
|
||||||
"github.com/drone/drone/handler/api/render"
|
|
||||||
"github.com/drone/drone/core"
|
"github.com/drone/drone/core"
|
||||||
|
"github.com/drone/drone/handler/api/render"
|
||||||
|
|
||||||
"github.com/go-chi/chi"
|
"github.com/go-chi/chi"
|
||||||
)
|
)
|
||||||
|
@ -1,14 +1,24 @@
|
|||||||
// Copyright 2019 Drone.IO Inc. All rights reserved.
|
// Copyright 2019 Drone IO, Inc.
|
||||||
// Use of this source code is governed by the Drone Non-Commercial License
|
//
|
||||||
// that can be found in the LICENSE file.
|
// 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 secrets
|
package secrets
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"net/http"
|
"net/http"
|
||||||
|
|
||||||
"github.com/drone/drone/handler/api/render"
|
|
||||||
"github.com/drone/drone/core"
|
"github.com/drone/drone/core"
|
||||||
|
"github.com/drone/drone/handler/api/render"
|
||||||
|
|
||||||
"github.com/go-chi/chi"
|
"github.com/go-chi/chi"
|
||||||
)
|
)
|
||||||
|
@ -1,14 +1,24 @@
|
|||||||
// Copyright 2019 Drone.IO Inc. All rights reserved.
|
// Copyright 2019 Drone IO, Inc.
|
||||||
// Use of this source code is governed by the Drone Non-Commercial License
|
//
|
||||||
// that can be found in the LICENSE file.
|
// 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 secrets
|
package secrets
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"net/http"
|
"net/http"
|
||||||
|
|
||||||
"github.com/drone/drone/handler/api/render"
|
|
||||||
"github.com/drone/drone/core"
|
"github.com/drone/drone/core"
|
||||||
|
"github.com/drone/drone/handler/api/render"
|
||||||
|
|
||||||
"github.com/go-chi/chi"
|
"github.com/go-chi/chi"
|
||||||
)
|
)
|
||||||
|
@ -1,14 +1,24 @@
|
|||||||
// Copyright 2019 Drone.IO Inc. All rights reserved.
|
// Copyright 2019 Drone IO, Inc.
|
||||||
// Use of this source code is governed by the Drone Non-Commercial License
|
//
|
||||||
// that can be found in the LICENSE file.
|
// 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 secrets
|
package secrets
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"net/http"
|
"net/http"
|
||||||
|
|
||||||
"github.com/drone/drone/handler/api/render"
|
|
||||||
"github.com/drone/drone/core"
|
"github.com/drone/drone/core"
|
||||||
|
"github.com/drone/drone/handler/api/render"
|
||||||
|
|
||||||
"github.com/go-chi/chi"
|
"github.com/go-chi/chi"
|
||||||
)
|
)
|
||||||
|
@ -1,6 +1,16 @@
|
|||||||
// Copyright 2019 Drone.IO Inc. All rights reserved.
|
// Copyright 2019 Drone IO, Inc.
|
||||||
// Use of this source code is governed by the Drone Non-Commercial License
|
//
|
||||||
// that can be found in the LICENSE file.
|
// 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 secrets
|
package secrets
|
||||||
|
|
||||||
@ -8,8 +18,8 @@ import (
|
|||||||
"encoding/json"
|
"encoding/json"
|
||||||
"net/http"
|
"net/http"
|
||||||
|
|
||||||
"github.com/drone/drone/handler/api/render"
|
|
||||||
"github.com/drone/drone/core"
|
"github.com/drone/drone/core"
|
||||||
|
"github.com/drone/drone/handler/api/render"
|
||||||
|
|
||||||
"github.com/go-chi/chi"
|
"github.com/go-chi/chi"
|
||||||
)
|
)
|
||||||
|
@ -1,6 +1,16 @@
|
|||||||
// Copyright 2019 Drone.IO Inc. All rights reserved.
|
// Copyright 2019 Drone IO, Inc.
|
||||||
// Use of this source code is governed by the Drone Non-Commercial License
|
//
|
||||||
// that can be found in the LICENSE file.
|
// 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
|
package repos
|
||||||
|
|
||||||
@ -8,10 +18,10 @@ import (
|
|||||||
"encoding/json"
|
"encoding/json"
|
||||||
"net/http"
|
"net/http"
|
||||||
|
|
||||||
|
"github.com/drone/drone/core"
|
||||||
"github.com/drone/drone/handler/api/render"
|
"github.com/drone/drone/handler/api/render"
|
||||||
"github.com/drone/drone/handler/api/request"
|
"github.com/drone/drone/handler/api/request"
|
||||||
"github.com/drone/drone/logger"
|
"github.com/drone/drone/logger"
|
||||||
"github.com/drone/drone/core"
|
|
||||||
|
|
||||||
"github.com/go-chi/chi"
|
"github.com/go-chi/chi"
|
||||||
)
|
)
|
||||||
|
@ -1,16 +1,26 @@
|
|||||||
// Copyright 2019 Drone.IO Inc. All rights reserved.
|
// Copyright 2019 Drone IO, Inc.
|
||||||
// Use of this source code is governed by the Drone Non-Commercial License
|
//
|
||||||
// that can be found in the LICENSE file.
|
// 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 user
|
package user
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"net/http"
|
"net/http"
|
||||||
|
|
||||||
|
"github.com/drone/drone/core"
|
||||||
"github.com/drone/drone/handler/api/render"
|
"github.com/drone/drone/handler/api/render"
|
||||||
"github.com/drone/drone/handler/api/request"
|
"github.com/drone/drone/handler/api/request"
|
||||||
"github.com/drone/drone/logger"
|
"github.com/drone/drone/logger"
|
||||||
"github.com/drone/drone/core"
|
|
||||||
)
|
)
|
||||||
|
|
||||||
// HandleRecent returns an http.HandlerFunc that write a json-encoded
|
// HandleRecent returns an http.HandlerFunc that write a json-encoded
|
||||||
|
@ -1,6 +1,16 @@
|
|||||||
// Copyright 2019 Drone.IO Inc. All rights reserved.
|
// Copyright 2019 Drone IO, Inc.
|
||||||
// Use of this source code is governed by the Drone Non-Commercial License
|
//
|
||||||
// that can be found in the LICENSE file.
|
// 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 user
|
package user
|
||||||
|
|
||||||
|
@ -1,16 +1,26 @@
|
|||||||
// Copyright 2019 Drone.IO Inc. All rights reserved.
|
// Copyright 2019 Drone IO, Inc.
|
||||||
// Use of this source code is governed by the Drone Non-Commercial License
|
//
|
||||||
// that can be found in the LICENSE file.
|
// 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 user
|
package user
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"net/http"
|
"net/http"
|
||||||
|
|
||||||
|
"github.com/drone/drone/core"
|
||||||
"github.com/drone/drone/handler/api/render"
|
"github.com/drone/drone/handler/api/render"
|
||||||
"github.com/drone/drone/handler/api/request"
|
"github.com/drone/drone/handler/api/request"
|
||||||
"github.com/drone/drone/logger"
|
"github.com/drone/drone/logger"
|
||||||
"github.com/drone/drone/core"
|
|
||||||
)
|
)
|
||||||
|
|
||||||
// HandleRepos returns an http.HandlerFunc that write a json-encoded
|
// HandleRepos returns an http.HandlerFunc that write a json-encoded
|
||||||
|
@ -1,6 +1,16 @@
|
|||||||
// Copyright 2019 Drone.IO Inc. All rights reserved.
|
// Copyright 2019 Drone IO, Inc.
|
||||||
// Use of this source code is governed by the Drone Non-Commercial License
|
//
|
||||||
// that can be found in the LICENSE file.
|
// 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 user
|
package user
|
||||||
|
|
||||||
@ -8,10 +18,10 @@ import (
|
|||||||
"context"
|
"context"
|
||||||
"net/http"
|
"net/http"
|
||||||
|
|
||||||
|
"github.com/drone/drone/core"
|
||||||
"github.com/drone/drone/handler/api/render"
|
"github.com/drone/drone/handler/api/render"
|
||||||
"github.com/drone/drone/handler/api/request"
|
"github.com/drone/drone/handler/api/request"
|
||||||
"github.com/drone/drone/logger"
|
"github.com/drone/drone/logger"
|
||||||
"github.com/drone/drone/core"
|
|
||||||
)
|
)
|
||||||
|
|
||||||
// HandleSync returns an http.HandlerFunc synchronizes and then
|
// HandleSync returns an http.HandlerFunc synchronizes and then
|
||||||
|
@ -1,6 +1,16 @@
|
|||||||
// Copyright 2019 Drone.IO Inc. All rights reserved.
|
// Copyright 2019 Drone IO, Inc.
|
||||||
// Use of this source code is governed by the Drone Non-Commercial License
|
//
|
||||||
// that can be found in the LICENSE file.
|
// 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 user
|
package user
|
||||||
|
|
||||||
@ -8,9 +18,9 @@ import (
|
|||||||
"net/http"
|
"net/http"
|
||||||
|
|
||||||
"github.com/dchest/uniuri"
|
"github.com/dchest/uniuri"
|
||||||
|
"github.com/drone/drone/core"
|
||||||
"github.com/drone/drone/handler/api/render"
|
"github.com/drone/drone/handler/api/render"
|
||||||
"github.com/drone/drone/handler/api/request"
|
"github.com/drone/drone/handler/api/request"
|
||||||
"github.com/drone/drone/core"
|
|
||||||
)
|
)
|
||||||
|
|
||||||
type userWithToken struct {
|
type userWithToken struct {
|
||||||
|
@ -1,6 +1,16 @@
|
|||||||
// Copyright 2019 Drone.IO Inc. All rights reserved.
|
// Copyright 2019 Drone IO, Inc.
|
||||||
// Use of this source code is governed by the Drone Non-Commercial License
|
//
|
||||||
// that can be found in the LICENSE file.
|
// 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 user
|
package user
|
||||||
|
|
||||||
@ -8,10 +18,10 @@ import (
|
|||||||
"encoding/json"
|
"encoding/json"
|
||||||
"net/http"
|
"net/http"
|
||||||
|
|
||||||
|
"github.com/drone/drone/core"
|
||||||
"github.com/drone/drone/handler/api/render"
|
"github.com/drone/drone/handler/api/render"
|
||||||
"github.com/drone/drone/handler/api/request"
|
"github.com/drone/drone/handler/api/request"
|
||||||
"github.com/drone/drone/logger"
|
"github.com/drone/drone/logger"
|
||||||
"github.com/drone/drone/core"
|
|
||||||
)
|
)
|
||||||
|
|
||||||
// HandleUpdate returns an http.HandlerFunc that processes an http.Request
|
// HandleUpdate returns an http.HandlerFunc that processes an http.Request
|
||||||
|
@ -2,6 +2,8 @@
|
|||||||
// Use of this source code is governed by the Drone Non-Commercial License
|
// Use of this source code is governed by the Drone Non-Commercial License
|
||||||
// that can be found in the LICENSE file.
|
// that can be found in the LICENSE file.
|
||||||
|
|
||||||
|
// +build !oss
|
||||||
|
|
||||||
package server
|
package server
|
||||||
|
|
||||||
import (
|
import (
|
||||||
|
53
server/server_oss.go
Normal file
53
server/server_oss.go
Normal file
@ -0,0 +1,53 @@
|
|||||||
|
// 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 server
|
||||||
|
|
||||||
|
import (
|
||||||
|
"context"
|
||||||
|
"net/http"
|
||||||
|
|
||||||
|
"golang.org/x/sync/errgroup"
|
||||||
|
)
|
||||||
|
|
||||||
|
// A Server defines parameters for running an HTTP server.
|
||||||
|
type Server struct {
|
||||||
|
Acme bool
|
||||||
|
Addr string
|
||||||
|
Cert string
|
||||||
|
Key string
|
||||||
|
Host string
|
||||||
|
Handler http.Handler
|
||||||
|
}
|
||||||
|
|
||||||
|
// ListenAndServe initializes a server to respond to HTTP network requests.
|
||||||
|
func (s Server) ListenAndServe(ctx context.Context) error {
|
||||||
|
var g errgroup.Group
|
||||||
|
s1 := &http.Server{
|
||||||
|
Addr: s.Addr,
|
||||||
|
Handler: s.Handler,
|
||||||
|
}
|
||||||
|
g.Go(func() error {
|
||||||
|
select {
|
||||||
|
case <-ctx.Done():
|
||||||
|
return s1.Shutdown(ctx)
|
||||||
|
}
|
||||||
|
})
|
||||||
|
g.Go(func() error {
|
||||||
|
return s1.ListenAndServe()
|
||||||
|
})
|
||||||
|
return g.Wait()
|
||||||
|
}
|
16
service/content/cache/contents.go
vendored
16
service/content/cache/contents.go
vendored
@ -1,6 +1,16 @@
|
|||||||
// Copyright 2019 Drone.IO Inc. All rights reserved.
|
// Copyright 2019 Drone IO, Inc.
|
||||||
// Use of this source code is governed by the Drone Non-Commercial License
|
//
|
||||||
// that can be found in the LICENSE file.
|
// 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 cache
|
package cache
|
||||||
|
|
||||||
|
@ -17,6 +17,7 @@ package contents
|
|||||||
import (
|
import (
|
||||||
"context"
|
"context"
|
||||||
"strings"
|
"strings"
|
||||||
|
"time"
|
||||||
|
|
||||||
"github.com/drone/drone/core"
|
"github.com/drone/drone/core"
|
||||||
"github.com/drone/go-scm/scm"
|
"github.com/drone/go-scm/scm"
|
||||||
@ -60,7 +61,7 @@ func (s *service) Find(ctx context.Context, user *core.User, repo, commit, ref,
|
|||||||
Token: user.Token,
|
Token: user.Token,
|
||||||
Refresh: user.Refresh,
|
Refresh: user.Refresh,
|
||||||
})
|
})
|
||||||
content, _, err := s.client.Contents.Find(ctx, repo, path, commit)
|
content, err := s.findRetry(ctx, repo, path, commit)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
@ -69,3 +70,21 @@ func (s *service) Find(ctx context.Context, user *core.User, repo, commit, ref,
|
|||||||
Hash: []byte{},
|
Hash: []byte{},
|
||||||
}, nil
|
}, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// helper function attempts to get the yaml configuration file
|
||||||
|
// with backoff on failure. This may be required due to eventual
|
||||||
|
// consistency issues with the github datastore.
|
||||||
|
func (s *service) findRetry(ctx context.Context, repo, path, commit string) (content *scm.Content, err error) {
|
||||||
|
for i := 0; i < 3; i++ {
|
||||||
|
content, _, err = s.client.Contents.Find(ctx, repo, path, commit)
|
||||||
|
// if no error is returned we can exit immediately.
|
||||||
|
if err == nil {
|
||||||
|
return
|
||||||
|
}
|
||||||
|
// wait a few seconds before retry. according to github
|
||||||
|
// support 30 seconds total should be enough time. we
|
||||||
|
// try 3 x 15 seconds, giving a total of 45 seconds.
|
||||||
|
time.Sleep(time.Second * 15)
|
||||||
|
}
|
||||||
|
return
|
||||||
|
}
|
||||||
|
@ -1,6 +1,16 @@
|
|||||||
// Copyright 2019 Drone.IO Inc. All rights reserved.
|
// Copyright 2019 Drone IO, Inc.
|
||||||
// Use of this source code is governed by the Drone Non-Commercial License
|
//
|
||||||
// that can be found in the LICENSE file.
|
// 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 parser
|
package parser
|
||||||
|
|
||||||
|
@ -1,6 +1,16 @@
|
|||||||
// Copyright 2019 Drone.IO Inc. All rights reserved.
|
// Copyright 2019 Drone IO, Inc.
|
||||||
// Use of this source code is governed by the Drone Non-Commercial License
|
//
|
||||||
// that can be found in the LICENSE file.
|
// 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 syncer
|
package syncer
|
||||||
|
|
||||||
|
@ -1,6 +1,16 @@
|
|||||||
// Copyright 2019 Drone.IO Inc. All rights reserved.
|
// Copyright 2019 Drone IO, Inc.
|
||||||
// Use of this source code is governed by the Drone Non-Commercial License
|
//
|
||||||
// that can be found in the LICENSE file.
|
// 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 syncer
|
package syncer
|
||||||
|
|
||||||
|
@ -2,6 +2,8 @@
|
|||||||
// Use of this source code is governed by the Drone Non-Commercial License
|
// Use of this source code is governed by the Drone Non-Commercial License
|
||||||
// that can be found in the LICENSE file.
|
// that can be found in the LICENSE file.
|
||||||
|
|
||||||
|
// +build !oss
|
||||||
|
|
||||||
package token
|
package token
|
||||||
|
|
||||||
import (
|
import (
|
||||||
|
37
service/token/renew_oss.go
Normal file
37
service/token/renew_oss.go
Normal file
@ -0,0 +1,37 @@
|
|||||||
|
// 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 token
|
||||||
|
|
||||||
|
import (
|
||||||
|
"context"
|
||||||
|
|
||||||
|
"github.com/drone/drone/core"
|
||||||
|
|
||||||
|
"github.com/drone/go-scm/scm/transport/oauth2"
|
||||||
|
)
|
||||||
|
|
||||||
|
type renewer struct {
|
||||||
|
}
|
||||||
|
|
||||||
|
// Renewer returns a new Renewer.
|
||||||
|
func Renewer(refresh *oauth2.Refresher, store core.UserStore) core.Renewer {
|
||||||
|
return &renewer{}
|
||||||
|
}
|
||||||
|
|
||||||
|
func (r *renewer) Renew(ctx context.Context, user *core.User, force bool) error {
|
||||||
|
return nil // no-op
|
||||||
|
}
|
@ -2,4 +2,6 @@
|
|||||||
// Use of this source code is governed by the Drone Non-Commercial License
|
// Use of this source code is governed by the Drone Non-Commercial License
|
||||||
// that can be found in the LICENSE file.
|
// that can be found in the LICENSE file.
|
||||||
|
|
||||||
|
// +build !oss
|
||||||
|
|
||||||
package token
|
package token
|
||||||
|
Loading…
x
Reference in New Issue
Block a user