Skip to content

Commit

Permalink
wip enable CE
Browse files Browse the repository at this point in the history
  • Loading branch information
bradrydzewski committed Feb 20, 2019
1 parent 26d2fc6 commit 6621f4c
Show file tree
Hide file tree
Showing 43 changed files with 670 additions and 126 deletions.
13 changes: 7 additions & 6 deletions .drone.jsonnet
Original file line number Diff line number Diff line change
Expand Up @@ -23,11 +23,11 @@ local mounts = [

# defines a pipeline step that builds and publishes
# a docker image to a docker remote registry.
local docker(name, os, arch) = {
local docker(name, image, os, arch) = {
name: "publish_" + name,
image: "plugins/docker",
settings: {
repo: "drone/" + name,
repo: "drone/" + image,
auto_tag: true,
auto_tag_suffix: os + "-" + arch,
username: { from_secret: "docker_username" },
Expand All @@ -45,6 +45,7 @@ local manifest(name) = {
name: name,
image: "plugins/manifest:1",
settings: {
auto_tag: true,
ignore_missing: true,
spec: "docker/manifest." + name + ".tmpl",
username: { from_secret: "docker_username" },
Expand Down Expand Up @@ -85,9 +86,9 @@ local pipeline(name, os, arch) = {
event: [ "push", "tag" ],
},
},
docker("agent", os, arch),
docker("controller", os, arch),
docker("server", os, arch),
docker("agent", "agent", os, arch),
docker("controller", "controller", os, arch),
docker("server", "drone", os, arch),
],
};

Expand All @@ -99,7 +100,7 @@ local pipeline(name, os, arch) = {
kind: "pipeline",
name: "manifest",
steps: [
manifest("server"),
manifest("drone"),
manifest("agent"),
manifest("controller"),
],
Expand Down
110 changes: 110 additions & 0 deletions .drone.script
Original file line number Diff line number Diff line change
@@ -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 changes: 8 additions & 5 deletions .drone.yml
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ steps:
dockerfile: docker/Dockerfile.server.linux.amd64
password:
from_secret: docker_password
repo: drone/server
repo: drone/drone
username:
from_secret: docker_username
when:
Expand Down Expand Up @@ -152,7 +152,7 @@ steps:
dockerfile: docker/Dockerfile.server.linux.arm
password:
from_secret: docker_password
repo: drone/server
repo: drone/drone
username:
from_secret: docker_username
when:
Expand Down Expand Up @@ -235,7 +235,7 @@ steps:
dockerfile: docker/Dockerfile.server.linux.arm64
password:
from_secret: docker_password
repo: drone/server
repo: drone/drone
username:
from_secret: docker_username
when:
Expand All @@ -256,13 +256,14 @@ platform:
arch: amd64

steps:
- name: server
- name: drone
image: plugins/manifest:1
settings:
auto_tag: true
ignore_missing: true
password:
from_secret: docker_password
spec: docker/manifest.server.tmpl
spec: docker/manifest.drone.tmpl
username:
from_secret: docker_username
when:
Expand All @@ -273,6 +274,7 @@ steps:
- name: agent
image: plugins/manifest:1
settings:
auto_tag: true
ignore_missing: true
password:
from_secret: docker_password
Expand All @@ -287,6 +289,7 @@ steps:
- name: controller
image: plugins/manifest:1
settings:
auto_tag: true
ignore_missing: true
password:
from_secret: docker_password
Expand Down
3 changes: 3 additions & 0 deletions .github/code_of_conduct.md
Original file line number Diff line number Diff line change
@@ -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).
18 changes: 14 additions & 4 deletions cmd/drone-server/bootstrap/bootstrap.go
Original file line number Diff line number Diff line change
@@ -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 bootstrap

Expand All @@ -10,8 +20,8 @@ import (
"time"

"github.com/dchest/uniuri"
"github.com/drone/drone/logger"
"github.com/drone/drone/core"
"github.com/drone/drone/logger"

"github.com/sirupsen/logrus"
)
Expand Down
2 changes: 2 additions & 0 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -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-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 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/go.mod h1:/m3WP610KZHVQ1SGc6re/UDhFvYD7pJ4Ao+sR/qLZy8=
github.com/hashicorp/nomad v0.0.0-20190125003214-134391155854 h1:L7WhLZt2ory/kQWxqkMwOiBpIoa4BWoadN7yx8LHEtk=
Expand Down
16 changes: 13 additions & 3 deletions handler/api/acl/acl.go
Original file line number Diff line number Diff line change
@@ -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 acl

Expand Down
18 changes: 14 additions & 4 deletions handler/api/acl/check.go
Original file line number Diff line number Diff line change
@@ -1,17 +1,27 @@
// 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 acl

import (
"net/http"

"github.com/drone/drone/core"
"github.com/drone/drone/handler/api/errors"
"github.com/drone/drone/handler/api/render"
"github.com/drone/drone/handler/api/request"
"github.com/drone/drone/logger"
"github.com/drone/drone/core"

"github.com/go-chi/chi"
"github.com/sirupsen/logrus"
Expand Down
18 changes: 14 additions & 4 deletions handler/api/acl/repo.go
Original file line number Diff line number Diff line change
@@ -1,18 +1,28 @@
// 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 acl

import (
"net/http"
"time"

"github.com/drone/drone/core"
"github.com/drone/drone/handler/api/errors"
"github.com/drone/drone/handler/api/render"
"github.com/drone/drone/handler/api/request"
"github.com/drone/drone/logger"
"github.com/drone/drone/core"

"github.com/go-chi/chi"
"github.com/sirupsen/logrus"
Expand Down
18 changes: 14 additions & 4 deletions handler/api/auth/auth.go
Original file line number Diff line number Diff line change
@@ -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 auth

import (
"net/http"

"github.com/drone/drone/core"
"github.com/drone/drone/handler/api/request"
"github.com/drone/drone/logger"
"github.com/drone/drone/core"
)

// HandleAuthentication returns an http.HandlerFunc middlewrae that authenticates
Expand Down
16 changes: 13 additions & 3 deletions handler/api/errors/errors.go
Original file line number Diff line number Diff line change
@@ -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 errors

Expand Down
Loading

0 comments on commit 6621f4c

Please sign in to comment.