mirror of
https://github.com/woodpecker-ci/woodpecker.git
synced 2025-01-10 17:45:36 +00:00
commit
e120c6fce6
119 changed files with 280 additions and 984 deletions
|
@ -1,2 +1,4 @@
|
|||
*
|
||||
!release/*
|
||||
.env
|
||||
|
||||
|
|
26
.drone.sh
26
.drone.sh
|
@ -1,28 +1,28 @@
|
|||
#!/bin/sh
|
||||
|
||||
# only execute this script as part of the pipeline.
|
||||
[ -z "$CI" ] && echo "missing ci environment variable" && exit 2
|
||||
# [ -z "$CI" ] && echo "missing ci environment variable" && exit 2
|
||||
|
||||
# only execute the script when github token exists.
|
||||
[ -z "$SSH_KEY" ] && echo "missing ssh key" && exit 3
|
||||
# [ -z "$SSH_KEY" ] && echo "missing ssh key" && exit 3
|
||||
|
||||
# write the ssh key.
|
||||
mkdir /root/.ssh
|
||||
echo -n "$SSH_KEY" > /root/.ssh/id_rsa
|
||||
chmod 600 /root/.ssh/id_rsa
|
||||
# mkdir /root/.ssh
|
||||
# echo -n "$SSH_KEY" > /root/.ssh/id_rsa
|
||||
# chmod 600 /root/.ssh/id_rsa
|
||||
|
||||
# add github.com to our known hosts.
|
||||
touch /root/.ssh/known_hosts
|
||||
chmod 600 /root/.ssh/known_hosts
|
||||
ssh-keyscan -H github.com > /etc/ssh/ssh_known_hosts 2> /dev/null
|
||||
# touch /root/.ssh/known_hosts
|
||||
# chmod 600 /root/.ssh/known_hosts
|
||||
# ssh-keyscan -H github.com > /etc/ssh/ssh_known_hosts 2> /dev/null
|
||||
|
||||
# clone the extras project.
|
||||
set -e
|
||||
set -x
|
||||
git clone git@github.com:drone/drone-enterprise.git extras
|
||||
# git clone git@github.com:drone/drone-enterprise.git extras
|
||||
|
||||
# build a static binary with the build number and extra features.
|
||||
go build -ldflags '-extldflags "-static" -X github.com/drone/drone/version.VersionDev=build.'${DRONE_BUILD_NUMBER} -o release/drone-server github.com/drone/drone/extras/cmd/drone-server
|
||||
GOOS=linux GOARCH=amd64 CGO_ENABLED=0 go build -ldflags '-X github.com/drone/drone/version.VersionDev=build.'${DRONE_BUILD_NUMBER} -o release/drone-agent github.com/drone/drone/cmd/drone-agent
|
||||
GOOS=linux GOARCH=arm64 CGO_ENABLED=0 go build -ldflags '-X github.com/drone/drone/version.VersionDev=build.'${DRONE_BUILD_NUMBER} -o release/linux/arm64/drone-agent github.com/drone/drone/cmd/drone-agent
|
||||
GOOS=linux GOARCH=arm CGO_ENABLED=0 GOARM=7 go build -ldflags '-X github.com/drone/drone/version.VersionDev=build.'${DRONE_BUILD_NUMBER} -o release/linux/arm/drone-agent github.com/drone/drone/cmd/drone-agent
|
||||
go build -ldflags '-extldflags "-static" -X github.com/laszlocph/drone-oss-08/version.VersionDev=build.'${DRONE_BUILD_NUMBER} -o release/drone-server github.com/laszlocph/drone-oss-08/cmd/drone-server
|
||||
GOOS=linux GOARCH=amd64 CGO_ENABLED=0 go build -ldflags '-X github.com/laszlocph/drone-oss-08/version.VersionDev=build.'${DRONE_BUILD_NUMBER} -o release/drone-agent github.com/laszlocph/drone-oss-08/cmd/drone-agent
|
||||
GOOS=linux GOARCH=arm64 CGO_ENABLED=0 go build -ldflags '-X github.com/laszlocph/drone-oss-08/version.VersionDev=build.'${DRONE_BUILD_NUMBER} -o release/linux/arm64/drone-agent github.com/laszlocph/drone-oss-08/cmd/drone-agent
|
||||
GOOS=linux GOARCH=arm CGO_ENABLED=0 GOARM=7 go build -ldflags '-X github.com/laszlocph/drone-oss-08/version.VersionDev=build.'${DRONE_BUILD_NUMBER} -o release/linux/arm/drone-agent github.com/laszlocph/drone-oss-08/cmd/drone-agent
|
||||
|
|
47
.drone.yml
47
.drone.yml
|
@ -1,12 +1,12 @@
|
|||
workspace:
|
||||
base: /go
|
||||
path: src/github.com/drone/drone
|
||||
path: src/github.com/laszlocph/drone-oss-08
|
||||
|
||||
pipeline:
|
||||
test:
|
||||
image: golang:1.8
|
||||
commands:
|
||||
- go get -u github.com/drone/drone-ui/dist
|
||||
- go get -u github.com/laszlocph/drone-ui/dist
|
||||
- go get -u golang.org/x/tools/cmd/cover
|
||||
- go get -u golang.org/x/net/context
|
||||
- go get -u golang.org/x/net/context/ctxhttp
|
||||
|
@ -20,7 +20,7 @@ pipeline:
|
|||
- DATABASE_DRIVER=postgres
|
||||
- DATABASE_CONFIG=host=postgres user=postgres dbname=postgres sslmode=disable
|
||||
commands:
|
||||
- go test github.com/drone/drone/store/datastore
|
||||
- go test github.com/laszlocph/drone-oss-08/store/datastore
|
||||
|
||||
test_mysql:
|
||||
image: golang:1.8
|
||||
|
@ -28,18 +28,17 @@ pipeline:
|
|||
- DATABASE_DRIVER=mysql
|
||||
- DATABASE_CONFIG=root@tcp(mysql:3306)/test?parseTime=true
|
||||
commands:
|
||||
- go test github.com/drone/drone/store/datastore
|
||||
- go test github.com/laszlocph/drone-oss-08/store/datastore
|
||||
|
||||
build:
|
||||
image: golang:1.8
|
||||
commands: sh .drone.sh
|
||||
secrets: [ ssh_key ]
|
||||
when:
|
||||
event: [ push, tag ]
|
||||
|
||||
publish_server_alpine:
|
||||
image: plugins/docker
|
||||
repo: drone/drone
|
||||
repo: laszlocloud/drone-oss-08-server
|
||||
dockerfile: Dockerfile.alpine
|
||||
secrets: [ docker_username, docker_password ]
|
||||
tag: [ alpine ]
|
||||
|
@ -49,7 +48,17 @@ pipeline:
|
|||
|
||||
publish_server:
|
||||
image: plugins/docker
|
||||
repo: drone/drone
|
||||
repo: laszlocloud/drone-oss-08-server
|
||||
secrets: [ docker_username, docker_password ]
|
||||
tag: [ latest ]
|
||||
when:
|
||||
branch: master
|
||||
event: push
|
||||
|
||||
publish_agent:
|
||||
image: plugins/docker
|
||||
repo: laszlocloud/drone-oss-08-agent
|
||||
dockerfile: Dockerfile.agent
|
||||
secrets: [ docker_username, docker_password ]
|
||||
tag: [ latest ]
|
||||
when:
|
||||
|
@ -58,7 +67,7 @@ pipeline:
|
|||
|
||||
publish_agent_alpine:
|
||||
image: plugins/docker
|
||||
repo: drone/agent
|
||||
repo: laszlocloud/drone-oss-08-agent
|
||||
dockerfile: Dockerfile.agent.alpine
|
||||
secrets: [ docker_username, docker_password ]
|
||||
tag: [ alpine ]
|
||||
|
@ -68,7 +77,7 @@ pipeline:
|
|||
|
||||
publish_agent_arm:
|
||||
image: plugins/docker
|
||||
repo: drone/agent
|
||||
repo: laszlocloud/drone-oss-08-agent
|
||||
dockerfile: Dockerfile.agent.linux.arm
|
||||
secrets: [ docker_username, docker_password ]
|
||||
tag: [ linux-arm ]
|
||||
|
@ -78,7 +87,7 @@ pipeline:
|
|||
|
||||
publish_agent_arm64:
|
||||
image: plugins/docker
|
||||
repo: drone/agent
|
||||
repo: laszlocloud/drone-oss-08-agent
|
||||
dockerfile: Dockerfile.agent.linux.arm64
|
||||
secrets: [ docker_username, docker_password ]
|
||||
tag: [ linux-arm64 ]
|
||||
|
@ -88,7 +97,7 @@ pipeline:
|
|||
|
||||
publish_agent_amd64:
|
||||
image: plugins/docker
|
||||
repo: drone/agent
|
||||
repo: laszlocloud/drone-oss-08-agent
|
||||
dockerfile: Dockerfile.agent
|
||||
secrets: [ docker_username, docker_password ]
|
||||
tag: [ latest ]
|
||||
|
@ -98,36 +107,36 @@ pipeline:
|
|||
|
||||
release_server_alpine:
|
||||
image: plugins/docker
|
||||
repo: drone/drone
|
||||
repo: laszlocloud/drone-oss-08-server
|
||||
dockerfile: Dockerfile.alpine
|
||||
secrets: [ docker_username, docker_password ]
|
||||
tag: [ 0.8-alpine ]
|
||||
tag: [ 0.8.91-alpine ]
|
||||
when:
|
||||
event: tag
|
||||
|
||||
release_agent_alpine:
|
||||
image: plugins/docker
|
||||
repo: drone/agent
|
||||
repo: laszlocloud/drone-oss-08-agent
|
||||
dockerfile: Dockerfile.agent.alpine
|
||||
secrets: [ docker_username, docker_password ]
|
||||
tag: [ 0.8-alpine ]
|
||||
tag: [ 0.8.91-alpine ]
|
||||
when:
|
||||
event: tag
|
||||
|
||||
release_server:
|
||||
image: plugins/docker
|
||||
repo: drone/drone
|
||||
repo: laszlocloud/drone-oss-08-server
|
||||
secrets: [ docker_username, docker_password ]
|
||||
tag: [ 0.8, 0.8.9 ]
|
||||
tag: [ 0.8.91 ]
|
||||
when:
|
||||
event: tag
|
||||
|
||||
release_agent:
|
||||
image: plugins/docker
|
||||
repo: drone/agent
|
||||
repo: laszlocloud/drone-oss-08-agent
|
||||
dockerfile: Dockerfile.agent
|
||||
secrets: [ docker_username, docker_password ]
|
||||
tag: [ 0.8, 0.8.9 ]
|
||||
tag: [ 0.8.91 ]
|
||||
when:
|
||||
event: tag
|
||||
|
||||
|
|
6
BUILDING
6
BUILDING
|
@ -1,7 +1,7 @@
|
|||
1. Install go 1.9 or later
|
||||
2. Install dependencies
|
||||
|
||||
go get -u github.com/drone/drone-ui/dist
|
||||
go get -u github.com/laszlocph/drone-ui/dist
|
||||
go get -u golang.org/x/net/context
|
||||
go get -u golang.org/x/net/context/ctxhttp
|
||||
go get -u github.com/golang/protobuf/proto
|
||||
|
@ -9,5 +9,5 @@
|
|||
|
||||
3. Install binaries to $GOPATH/bin
|
||||
|
||||
go install github.com/drone/drone/cmd/drone-agent
|
||||
go install github.com/drone/drone/cmd/drone-server
|
||||
go install github.com/laszlocph/drone-oss-08/cmd/drone-agent
|
||||
go install github.com/laszlocph/drone-oss-08/cmd/drone-server
|
||||
|
|
|
@ -22,7 +22,7 @@ import (
|
|||
"sync"
|
||||
"time"
|
||||
|
||||
"github.com/drone/drone/version"
|
||||
"github.com/laszlocph/drone-oss-08/version"
|
||||
"github.com/urfave/cli"
|
||||
)
|
||||
|
||||
|
@ -48,7 +48,7 @@ func handleVersion(w http.ResponseWriter, r *http.Request) {
|
|||
w.WriteHeader(200)
|
||||
w.Header().Add("Content-Type", "text/json")
|
||||
json.NewEncoder(w).Encode(versionResp{
|
||||
Source: "https://github.com/drone/drone",
|
||||
Source: "https://github.com/laszlocph/drone-oss-08",
|
||||
Version: version.Version.String(),
|
||||
})
|
||||
}
|
||||
|
|
|
@ -19,7 +19,7 @@ import (
|
|||
"os"
|
||||
"time"
|
||||
|
||||
"github.com/drone/drone/version"
|
||||
"github.com/laszlocph/drone-oss-08/version"
|
||||
|
||||
_ "github.com/joho/godotenv/autoload"
|
||||
"github.com/urfave/cli"
|
||||
|
|
|
@ -18,7 +18,7 @@ import (
|
|||
"fmt"
|
||||
"os"
|
||||
|
||||
"github.com/drone/drone/version"
|
||||
"github.com/laszlocph/drone-oss-08/version"
|
||||
|
||||
_ "github.com/joho/godotenv/autoload"
|
||||
"github.com/urfave/cli"
|
||||
|
|
|
@ -36,12 +36,12 @@ import (
|
|||
"github.com/cncd/logging"
|
||||
"github.com/cncd/pipeline/pipeline/rpc/proto"
|
||||
"github.com/cncd/pubsub"
|
||||
"github.com/drone/drone/plugins/sender"
|
||||
"github.com/drone/drone/remote"
|
||||
"github.com/drone/drone/router"
|
||||
"github.com/drone/drone/router/middleware"
|
||||
droneserver "github.com/drone/drone/server"
|
||||
"github.com/drone/drone/store"
|
||||
"github.com/laszlocph/drone-oss-08/plugins/sender"
|
||||
"github.com/laszlocph/drone-oss-08/remote"
|
||||
"github.com/laszlocph/drone-oss-08/router"
|
||||
"github.com/laszlocph/drone-oss-08/router/middleware"
|
||||
droneserver "github.com/laszlocph/drone-oss-08/server"
|
||||
"github.com/laszlocph/drone-oss-08/store"
|
||||
|
||||
"github.com/Sirupsen/logrus"
|
||||
"github.com/gin-gonic/contrib/ginrus"
|
||||
|
|
|
@ -20,21 +20,21 @@ import (
|
|||
|
||||
"github.com/cncd/queue"
|
||||
"github.com/dimfeld/httptreemux"
|
||||
"github.com/drone/drone/model"
|
||||
"github.com/drone/drone/plugins/registry"
|
||||
"github.com/drone/drone/plugins/secrets"
|
||||
"github.com/drone/drone/remote"
|
||||
"github.com/drone/drone/remote/bitbucket"
|
||||
"github.com/drone/drone/remote/bitbucketserver"
|
||||
"github.com/drone/drone/remote/coding"
|
||||
"github.com/drone/drone/remote/gitea"
|
||||
"github.com/drone/drone/remote/github"
|
||||
"github.com/drone/drone/remote/gitlab"
|
||||
"github.com/drone/drone/remote/gitlab3"
|
||||
"github.com/drone/drone/remote/gogs"
|
||||
"github.com/drone/drone/server/web"
|
||||
"github.com/drone/drone/store"
|
||||
"github.com/drone/drone/store/datastore"
|
||||
"github.com/laszlocph/drone-oss-08/model"
|
||||
"github.com/laszlocph/drone-oss-08/plugins/registry"
|
||||
"github.com/laszlocph/drone-oss-08/plugins/secrets"
|
||||
"github.com/laszlocph/drone-oss-08/remote"
|
||||
"github.com/laszlocph/drone-oss-08/remote/bitbucket"
|
||||
"github.com/laszlocph/drone-oss-08/remote/bitbucketserver"
|
||||
"github.com/laszlocph/drone-oss-08/remote/coding"
|
||||
"github.com/laszlocph/drone-oss-08/remote/gitea"
|
||||
"github.com/laszlocph/drone-oss-08/remote/github"
|
||||
"github.com/laszlocph/drone-oss-08/remote/gitlab"
|
||||
"github.com/laszlocph/drone-oss-08/remote/gitlab3"
|
||||
"github.com/laszlocph/drone-oss-08/remote/gogs"
|
||||
"github.com/laszlocph/drone-oss-08/server/web"
|
||||
"github.com/laszlocph/drone-oss-08/store"
|
||||
"github.com/laszlocph/drone-oss-08/store/datastore"
|
||||
|
||||
"github.com/urfave/cli"
|
||||
)
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
package registry
|
||||
|
||||
import (
|
||||
"github.com/drone/drone/model"
|
||||
"github.com/laszlocph/drone-oss-08/model"
|
||||
)
|
||||
|
||||
type builtin struct {
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
package secrets
|
||||
|
||||
import (
|
||||
"github.com/drone/drone/model"
|
||||
"github.com/laszlocph/drone-oss-08/model"
|
||||
)
|
||||
|
||||
type builtin struct {
|
||||
|
|
|
@ -1,48 +0,0 @@
|
|||
// Copyright 2018 Drone.IO Inc
|
||||
// Use of this software is governed by the Drone Enterpise License
|
||||
// that can be found in the LICENSE file.
|
||||
|
||||
package secrets
|
||||
|
||||
import (
|
||||
"github.com/drone/drone/model"
|
||||
"github.com/drone/drone/store"
|
||||
)
|
||||
|
||||
// NewDefault returns the Store wrapped as a Service.
|
||||
func NewDefault(store store.Store) model.SecretService {
|
||||
return New(store)
|
||||
}
|
||||
|
||||
// Plugin defines the required interface for implementing a remote
|
||||
// secret plugin and sourcing secrets from an external source.
|
||||
type Plugin interface {
|
||||
SecretListBuild(*model.Repo, *model.Build) ([]*model.Secret, error)
|
||||
}
|
||||
|
||||
// Extend exetends the base secret service with the plugin.
|
||||
func Extend(base model.SecretService, with Plugin) model.SecretService {
|
||||
return &extender{base, with}
|
||||
}
|
||||
|
||||
type extender struct {
|
||||
model.SecretService
|
||||
plugin Plugin
|
||||
}
|
||||
|
||||
// extends the base secret service and combines the secret list with the
|
||||
// secret list returned by the plugin.
|
||||
func (e *extender) SecretListBuild(repo *model.Repo, build *model.Build) ([]*model.Secret, error) {
|
||||
base, err := e.SecretService.SecretListBuild(repo, build)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
with, err := e.plugin.SecretListBuild(repo, build)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
for _, secret := range base {
|
||||
with = append(with, secret)
|
||||
}
|
||||
return with, nil
|
||||
}
|
|
@ -1,68 +0,0 @@
|
|||
// Copyright 2018 Drone.IO Inc
|
||||
// Use of this software is governed by the Drone Enterpise License
|
||||
// that can be found in the LICENSE file.
|
||||
|
||||
package secrets
|
||||
|
||||
import (
|
||||
"testing"
|
||||
|
||||
"github.com/drone/drone/model"
|
||||
)
|
||||
|
||||
func TestExtends(t *testing.T) {
|
||||
base := &mocker{}
|
||||
base.list = []*model.Secret{
|
||||
{Name: "foo"},
|
||||
{Name: "bar"},
|
||||
}
|
||||
|
||||
with := &mocker{}
|
||||
with.list = []*model.Secret{
|
||||
{Name: "baz"},
|
||||
{Name: "qux"},
|
||||
}
|
||||
|
||||
extended := Extend(base, with)
|
||||
list, err := extended.SecretListBuild(nil, nil)
|
||||
if err != nil {
|
||||
t.Errorf("Expected combined secret list, got error %q", err)
|
||||
}
|
||||
|
||||
if got, want := list[0], with.list[0]; got != want {
|
||||
t.Errorf("Expected correct precedence. Want %s, got %s", want.Name, got.Name)
|
||||
}
|
||||
if got, want := list[1], with.list[1]; got != want {
|
||||
t.Errorf("Expected correct precedence. Want %s, got %s", want.Name, got.Name)
|
||||
}
|
||||
if got, want := list[2], base.list[0]; got != want {
|
||||
t.Errorf("Expected correct precedence. Want %s, got %s", want.Name, got.Name)
|
||||
}
|
||||
if got, want := list[3], base.list[1]; got != want {
|
||||
t.Errorf("Expected correct precedence. Want %s, got %s", want.Name, got.Name)
|
||||
}
|
||||
}
|
||||
|
||||
type mocker struct {
|
||||
list []*model.Secret
|
||||
error error
|
||||
}
|
||||
|
||||
func (m *mocker) SecretFind(*model.Repo, string) (*model.Secret, error) {
|
||||
return nil, nil
|
||||
}
|
||||
func (m *mocker) SecretList(*model.Repo) ([]*model.Secret, error) {
|
||||
return nil, nil
|
||||
}
|
||||
func (m *mocker) SecretListBuild(*model.Repo, *model.Build) ([]*model.Secret, error) {
|
||||
return m.list, m.error
|
||||
}
|
||||
func (m *mocker) SecretCreate(*model.Repo, *model.Secret) error {
|
||||
return nil
|
||||
}
|
||||
func (m *mocker) SecretUpdate(*model.Repo, *model.Secret) error {
|
||||
return nil
|
||||
}
|
||||
func (m *mocker) SecretDelete(*model.Repo, string) error {
|
||||
return nil
|
||||
}
|
|
@ -1 +0,0 @@
|
|||
fakeJwt
|
|
@ -1,48 +0,0 @@
|
|||
package vault
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"github.com/drone/drone/plugins/internal"
|
||||
"io/ioutil"
|
||||
"time"
|
||||
)
|
||||
|
||||
/*
|
||||
Vault JSON Response
|
||||
{
|
||||
"auth": {
|
||||
"client_token" = "token",
|
||||
"lease_duration" = 1234
|
||||
}
|
||||
}
|
||||
*/
|
||||
type vaultAuth struct {
|
||||
Token string `json:"client_token"`
|
||||
Lease int `json:"lease_duration"`
|
||||
}
|
||||
type vaultResp struct {
|
||||
Auth vaultAuth
|
||||
}
|
||||
|
||||
func getKubernetesToken(addr, role, mount, tokenFile string) (string, time.Duration, error) {
|
||||
b, err := ioutil.ReadFile(tokenFile)
|
||||
if err != nil {
|
||||
return "", 0, err
|
||||
}
|
||||
|
||||
var resp vaultResp
|
||||
path := fmt.Sprintf("%s/v1/auth/%s/login", addr, mount)
|
||||
data := map[string]string{
|
||||
"jwt": string(b),
|
||||
"role": role,
|
||||
}
|
||||
|
||||
err = internal.Send("POST", path, data, &resp)
|
||||
if err != nil {
|
||||
return "", 0, err
|
||||
}
|
||||
|
||||
ttl := time.Duration(resp.Auth.Lease) * time.Second
|
||||
|
||||
return resp.Auth.Token, ttl, nil
|
||||
}
|
|
@ -1,69 +0,0 @@
|
|||
package vault
|
||||
|
||||
import (
|
||||
"encoding/json"
|
||||
"fmt"
|
||||
"io/ioutil"
|
||||
"net/http"
|
||||
"net/http/httptest"
|
||||
"testing"
|
||||
"time"
|
||||
)
|
||||
|
||||
func TestGetKubernetesToken(t *testing.T) {
|
||||
fakeRole := "fakeRole"
|
||||
fakeMountPoint := "kubernetes"
|
||||
fakeJwtFile := "fixtures/fakeJwt"
|
||||
b, _ := ioutil.ReadFile(fakeJwtFile)
|
||||
fakeJwt := string(b)
|
||||
fakeClientToken := "fakeClientToken"
|
||||
fakeLeaseSeconds := 86400
|
||||
fakeLeaseDuration := time.Duration(fakeLeaseSeconds) * time.Second
|
||||
fakeResp := fmt.Sprintf("{\"auth\": {\"client_token\": \"%s\", \"lease_duration\": %d}}", fakeClientToken, fakeLeaseSeconds)
|
||||
expectedPath := "/v1/auth/kubernetes/login"
|
||||
|
||||
ts := httptest.NewServer(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {
|
||||
w.WriteHeader(http.StatusOK)
|
||||
if r.Method != "POST" {
|
||||
t.Errorf("Expected 'POST' request, got '%s'", r.Method)
|
||||
}
|
||||
if r.URL.EscapedPath() != expectedPath {
|
||||
t.Errorf("Expected request to '%s', got '%s'", expectedPath, r.URL.EscapedPath())
|
||||
}
|
||||
|
||||
var postdata struct {
|
||||
Jwt string
|
||||
Role string
|
||||
}
|
||||
err := json.NewDecoder(r.Body).Decode(&postdata)
|
||||
if err != nil {
|
||||
t.Errorf("Encountered error parsing request JSON: %s", err)
|
||||
}
|
||||
|
||||
jwt := postdata.Jwt
|
||||
|
||||
if jwt != fakeJwt {
|
||||
t.Errorf("Expected request to have jwt with value '%s', got: '%s'", fakeJwt, jwt)
|
||||
}
|
||||
role := postdata.Role
|
||||
if role != fakeRole {
|
||||
t.Errorf("Expected request to have role with value '%s', got: '%s'", fakeRole, role)
|
||||
}
|
||||
|
||||
fmt.Fprintf(w, fakeResp)
|
||||
}))
|
||||
defer ts.Close()
|
||||
|
||||
url := ts.URL
|
||||
token, ttl, err := getKubernetesToken(url, fakeRole, fakeMountPoint, fakeJwtFile)
|
||||
if err != nil {
|
||||
t.Errorf("getKubernetesToken returned an error: %s", err)
|
||||
}
|
||||
|
||||
if token != fakeClientToken {
|
||||
t.Errorf("Expected returned token to have value '%s', got: '%s'", fakeClientToken, token)
|
||||
}
|
||||
if ttl != fakeLeaseDuration {
|
||||
t.Errorf("Expected TTL to have value '%s', got: '%s'", fakeLeaseDuration.Seconds(), ttl.Seconds())
|
||||
}
|
||||
}
|
|
@ -1,45 +0,0 @@
|
|||
// Copyright 2018 Drone.IO Inc
|
||||
// Use of this software is governed by the Drone Enterpise License
|
||||
// that can be found in the LICENSE file.
|
||||
|
||||
package vault
|
||||
|
||||
import "time"
|
||||
|
||||
// Opts sets custom options for the vault client.
|
||||
type Opts func(v *vault)
|
||||
|
||||
// WithTTL returns an options that sets a TTL used to
|
||||
// refresh periodic tokens.
|
||||
func WithTTL(d time.Duration) Opts {
|
||||
return func(v *vault) {
|
||||
v.ttl = d
|
||||
}
|
||||
}
|
||||
|
||||
// WithRenewal returns an options that sets the renewal
|
||||
// period used to refresh periodic tokens
|
||||
func WithRenewal(d time.Duration) Opts {
|
||||
return func(v *vault) {
|
||||
v.renew = d
|
||||
}
|
||||
}
|
||||
|
||||
// WithAuth returns an options that sets the vault
|
||||
// method to use for authentication
|
||||
func WithAuth(method string) Opts {
|
||||
return func(v *vault) {
|
||||
v.auth = method
|
||||
}
|
||||
}
|
||||
|
||||
// WithKubernetes returns an options that sets
|
||||
// kubernetes-auth parameters required to retrieve
|
||||
// an initial vault token
|
||||
func WithKubernetesAuth(addr, role, mount string) Opts {
|
||||
return func(v *vault) {
|
||||
v.kubeAuth.addr = addr
|
||||
v.kubeAuth.role = role
|
||||
v.kubeAuth.mount = mount
|
||||
}
|
||||
}
|
|
@ -1,56 +0,0 @@
|
|||
// Copyright 2018 Drone.IO Inc
|
||||
// Use of this software is governed by the Drone Enterpise License
|
||||
// that can be found in the LICENSE file.
|
||||
|
||||
package vault
|
||||
|
||||
import (
|
||||
"testing"
|
||||
"time"
|
||||
)
|
||||
|
||||
func TestWithTTL(t *testing.T) {
|
||||
v := new(vault)
|
||||
opt := WithTTL(time.Hour)
|
||||
opt(v)
|
||||
if got, want := v.ttl, time.Hour; got != want {
|
||||
t.Errorf("Want ttl %v, got %v", want, got)
|
||||
}
|
||||
}
|
||||
|
||||
func TestWithRenewal(t *testing.T) {
|
||||
v := new(vault)
|
||||
opt := WithRenewal(time.Hour)
|
||||
opt(v)
|
||||
if got, want := v.renew, time.Hour; got != want {
|
||||
t.Errorf("Want renewal %v, got %v", want, got)
|
||||
}
|
||||
}
|
||||
|
||||
func TestWithAuth(t *testing.T) {
|
||||
v := new(vault)
|
||||
method := "kubernetes"
|
||||
opt := WithAuth(method)
|
||||
opt(v)
|
||||
if got, want := v.auth, method; got != want {
|
||||
t.Errorf("Want auth %v, got %v", want, got)
|
||||
}
|
||||
}
|
||||
|
||||
func TestWithKubernetesAuth(t *testing.T) {
|
||||
v := new(vault)
|
||||
addr := "https://address.fake"
|
||||
role := "fakeRole"
|
||||
mount := "kubernetes"
|
||||
opt := WithKubernetesAuth(addr, role, mount)
|
||||
opt(v)
|
||||
if got, want := v.kubeAuth.addr, addr; got != want {
|
||||
t.Errorf("Want addr %v, got %v", want, got)
|
||||
}
|
||||
if got, want := v.kubeAuth.role, role; got != want {
|
||||
t.Errorf("Want role %v, got %v", want, got)
|
||||
}
|
||||
if got, want := v.kubeAuth.mount, mount; got != want {
|
||||
t.Errorf("Want mount %v, got %v", want, got)
|
||||
}
|
||||
}
|
|
@ -1,272 +0,0 @@
|
|||
// Copyright 2018 Drone.IO Inc
|
||||
// Use of this software is governed by the Drone Enterpise License
|
||||
// that can be found in the LICENSE file.
|
||||
|
||||
package vault
|
||||
|
||||
import (
|
||||
"errors"
|
||||
"path"
|
||||
"strings"
|
||||
"time"
|
||||
|
||||
"github.com/Sirupsen/logrus"
|
||||
"github.com/drone/drone/model"
|
||||
"github.com/drone/drone/plugins/secrets"
|
||||
|
||||
"github.com/hashicorp/vault/api"
|
||||
"gopkg.in/yaml.v2"
|
||||
)
|
||||
|
||||
// yaml configuration representation
|
||||
//
|
||||
// secrets:
|
||||
// docker_username:
|
||||
// file: path/to/docker/username
|
||||
// docker_password:
|
||||
// file: path/to/docker/password
|
||||
//
|
||||
type vaultConfig struct {
|
||||
Secrets map[string]struct {
|
||||
Driver string
|
||||
DriverOpts struct {
|
||||
Path string
|
||||
Key string
|
||||
} `yaml:"driver_opts"`
|
||||
|
||||
// deprecated. do not use.
|
||||
Vault string
|
||||
Path string
|
||||
File string
|
||||
}
|
||||
}
|
||||
|
||||
type vault struct {
|
||||
store model.ConfigStore
|
||||
client *api.Client
|
||||
ttl time.Duration
|
||||
renew time.Duration
|
||||
auth string
|
||||
kubeAuth kubeAuth
|
||||
done chan struct{}
|
||||
}
|
||||
|
||||
type kubeAuth struct {
|
||||
addr, role, mount string
|
||||
}
|
||||
|
||||
// New returns a new store with secrets loaded from vault.
|
||||
func New(store model.ConfigStore, opts ...Opts) (secrets.Plugin, error) {
|
||||
client, err := api.NewClient(nil)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
v := &vault{
|
||||
store: store,
|
||||
client: client,
|
||||
}
|
||||
for _, opt := range opts {
|
||||
opt(v)
|
||||
}
|
||||
if v.auth == "kubernetes" {
|
||||
err = v.initKubernetes()
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
}
|
||||
v.start() // start the refresh process.
|
||||
return v, nil
|
||||
}
|
||||
|
||||
func (v *vault) initKubernetes() error {
|
||||
if v.renew == 0 {
|
||||
return errors.New("vault: token renewal not configured")
|
||||
}
|
||||
token, ttl, err := getKubernetesToken(
|
||||
v.kubeAuth.addr,
|
||||
v.kubeAuth.role,
|
||||
v.kubeAuth.mount,
|
||||
"/var/run/secrets/kubernetes.io/serviceaccount/token",
|
||||
)
|
||||
if err != nil {
|
||||
logrus.Debugf("vault: failed to obtain token via kubernetes-auth backend: %s", err)
|
||||
return err
|
||||
}
|
||||
|
||||
v.client.SetToken(token)
|
||||
v.ttl = ttl
|
||||
return nil
|
||||
}
|
||||
|
||||
func (v *vault) SecretListBuild(repo *model.Repo, build *model.Build) ([]*model.Secret, error) {
|
||||
return v.list(repo, build)
|
||||
}
|
||||
|
||||
func (v *vault) list(repo *model.Repo, build *model.Build) ([]*model.Secret, error) {
|
||||
conf, err := v.store.ConfigLoad(build.ConfigID)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
var (
|
||||
in = []byte(conf.Data)
|
||||
out = new(vaultConfig)
|
||||
|
||||
secrets []*model.Secret
|
||||
)
|
||||
err = yaml.Unmarshal(in, out)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
for key, val := range out.Secrets {
|
||||
var path, field string
|
||||
switch {
|
||||
case val.Path != "":
|
||||
path = val.Path
|
||||
case val.File != "":
|
||||
path = val.File
|
||||
case val.Vault != "":
|
||||
path = val.Vault
|
||||
case val.DriverOpts.Path != "":
|
||||
path = val.DriverOpts.Path
|
||||
field = val.DriverOpts.Key
|
||||
}
|
||||
if field == "" {
|
||||
field = "value"
|
||||
}
|
||||
|
||||
if path == "" {
|
||||
continue
|
||||
}
|
||||
|
||||
logrus.Debugf("vault: read secret: %s", path)
|
||||
|
||||
vaultSecret, err := v.get(path, field)
|
||||
if err != nil {
|
||||
logrus.Debugf("vault: read secret failed: %s: %s", path, err)
|
||||
return nil, err
|
||||
}
|
||||
if vaultSecret == nil {
|
||||
logrus.Debugf("vault: read secret failed: %s: not found or empty value", path)
|
||||
continue
|
||||
}
|
||||
if !vaultSecret.Match(repo.FullName) {
|
||||
logrus.Debugf("vault: read secret: %s: restricted: %s", path, repo.FullName)
|
||||
continue
|
||||
}
|
||||
|
||||
logrus.Debugf("vault: read secret success: %s", err)
|
||||
|
||||
secrets = append(secrets, &model.Secret{
|
||||
Name: key,
|
||||
Value: vaultSecret.Value,
|
||||
Events: vaultSecret.Event,
|
||||
Images: vaultSecret.Image,
|
||||
})
|
||||
}
|
||||
return secrets, nil
|
||||
}
|
||||
|
||||
func (v *vault) get(path, key string) (*vaultSecret, error) {
|
||||
secret, err := v.client.Logical().Read(path)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
if secret == nil || secret.Data == nil {
|
||||
return nil, nil
|
||||
}
|
||||
return parseVaultSecret(secret.Data, key), nil
|
||||
}
|
||||
|
||||
// start starts the renewal loop.
|
||||
func (v *vault) start() {
|
||||
if v.renew == 0 || v.ttl == 0 {
|
||||
logrus.Debugf("vault: token renewal disabled")
|
||||
return
|
||||
}
|
||||
if v.done != nil {
|
||||
close(v.done)
|
||||
}
|
||||
logrus.Infof("vault: token renewal enabled: renew every %v", v.renew)
|
||||
v.done = make(chan struct{})
|
||||
if v.renew != 0 {
|
||||
go v.renewLoop()
|
||||
}
|
||||
}
|
||||
|
||||
// stop stops the renewal loop.
|
||||
func (v *vault) stop() {
|
||||
close(v.done)
|
||||
}
|
||||
|
||||
func (v *vault) renewLoop() {
|
||||
for {
|
||||
select {
|
||||
case <-time.After(v.renew):
|
||||
incr := int(v.ttl / time.Second)
|
||||
|
||||
logrus.Debugf("vault: refreshing token: increment %v", v.ttl)
|
||||
_, err := v.client.Auth().Token().RenewSelf(incr)
|
||||
if err != nil {
|
||||
logrus.Errorf("vault: refreshing token failed: %s", err)
|
||||
} else {
|
||||
logrus.Debugf("vault: refreshing token succeeded")
|
||||
}
|
||||
case <-v.done:
|
||||
return
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
type vaultSecret struct {
|
||||
Value string
|
||||
Image []string
|
||||
Event []string
|
||||
Repo []string
|
||||
}
|
||||
|
||||
func parseVaultSecret(data map[string]interface{}, key string) *vaultSecret {
|
||||
secret := new(vaultSecret)
|
||||
|
||||
if vvalue, ok := data[key]; ok {
|
||||
if svalue, ok := vvalue.(string); ok {
|
||||
secret.Value = svalue
|
||||
}
|
||||
}
|
||||
if vimage, ok := data["image"]; ok {
|
||||
if simage, ok := vimage.(string); ok {
|
||||
secret.Image = strings.Split(simage, ",")
|
||||
}
|
||||
}
|
||||
if vevent, ok := data["event"]; ok {
|
||||
if sevent, ok := vevent.(string); ok {
|
||||
secret.Event = strings.Split(sevent, ",")
|
||||
}
|
||||
}
|
||||
if vrepo, ok := data["repo"]; ok {
|
||||
if srepo, ok := vrepo.(string); ok {
|
||||
secret.Repo = strings.Split(srepo, ",")
|
||||
}
|
||||
}
|
||||
if secret.Event == nil {
|
||||
secret.Event = []string{}
|
||||
}
|
||||
if secret.Image == nil {
|
||||
secret.Image = []string{}
|
||||
}
|
||||
if secret.Repo == nil {
|
||||
secret.Repo = []string{}
|
||||
}
|
||||
return secret
|
||||
}
|
||||
|
||||
func (v *vaultSecret) Match(name string) bool {
|
||||
if len(v.Repo) == 0 {
|
||||
return true
|
||||
}
|
||||
for _, pattern := range v.Repo {
|
||||
if ok, _ := path.Match(pattern, name); ok {
|
||||
return true
|
||||
}
|
||||
}
|
||||
return false
|
||||
}
|
|
@ -1,108 +0,0 @@
|
|||
// Copyright 2018 Drone.IO Inc
|
||||
// Use of this software is governed by the Drone Enterpise License
|
||||
// that can be found in the LICENSE file.
|
||||
|
||||
package vault
|
||||
|
||||
import (
|
||||
"os"
|
||||
"reflect"
|
||||
"testing"
|
||||
|
||||
"github.com/hashicorp/vault/api"
|
||||
"github.com/kr/pretty"
|
||||
)
|
||||
|
||||
// Use the following snippet to spin up a local vault
|
||||
// server for integration testing:
|
||||
//
|
||||
// docker run --cap-add=IPC_LOCK -e 'VAULT_DEV_ROOT_TOKEN_ID=dummy' -p 8200:8200 vault
|
||||
// export VAULT_ADDR=http://127.0.0.1:8200
|
||||
// export VAULT_TOKEN=dummy
|
||||
|
||||
func TestVaultGet(t *testing.T) {
|
||||
if os.Getenv("VAULT_TOKEN") == "" {
|
||||
t.SkipNow()
|
||||
return
|
||||
}
|
||||
|
||||
client, err := api.NewClient(nil)
|
||||
if err != nil {
|
||||
t.Error(err)
|
||||
return
|
||||
}
|
||||
|
||||
_, err = client.Logical().Write("secret/testing/drone/a", map[string]interface{}{
|
||||
"value": "hello",
|
||||
"fr": "bonjour",
|
||||
"image": "golang",
|
||||
"event": "push,pull_request",
|
||||
"repo": "octocat/hello-world,github/*",
|
||||
})
|
||||
if err != nil {
|
||||
t.Error(err)
|
||||
return
|
||||
}
|
||||
|
||||
plugin := vault{client: client}
|
||||
secret, err := plugin.get("secret/testing/drone/a", "value")
|
||||
if err != nil {
|
||||
t.Error(err)
|
||||
return
|
||||
}
|
||||
if got, want := secret.Value, "hello"; got != want {
|
||||
t.Errorf("Expect secret value %s, got %s", want, got)
|
||||
}
|
||||
|
||||
secret, err = plugin.get("secret/testing/drone/a", "fr")
|
||||
if err != nil {
|
||||
t.Error(err)
|
||||
return
|
||||
}
|
||||
if got, want := secret.Value, "bonjour"; got != want {
|
||||
t.Errorf("Expect secret value %s, got %s", want, got)
|
||||
}
|
||||
|
||||
secret, err = plugin.get("secret/testing/drone/404", "value")
|
||||
if err != nil {
|
||||
t.Errorf("Expect silent failure when secret does not exist, got %s", err)
|
||||
}
|
||||
if secret != nil {
|
||||
t.Errorf("Expect nil secret when path does not exist")
|
||||
}
|
||||
}
|
||||
|
||||
func TestVaultSecretParse(t *testing.T) {
|
||||
data := map[string]interface{}{
|
||||
"value": "password",
|
||||
"event": "push,tag",
|
||||
"image": "plugins/s3,plugins/ec2",
|
||||
"repo": "octocat/hello-world,github/*",
|
||||
}
|
||||
want := vaultSecret{
|
||||
Value: "password",
|
||||
Event: []string{"push", "tag"},
|
||||
Image: []string{"plugins/s3", "plugins/ec2"},
|
||||
Repo: []string{"octocat/hello-world", "github/*"},
|
||||
}
|
||||
got := parseVaultSecret(data, "value")
|
||||
if !reflect.DeepEqual(want, *got) {
|
||||
t.Errorf("Failed read Secret.Data")
|
||||
pretty.Fdiff(os.Stderr, want, got)
|
||||
}
|
||||
}
|
||||
|
||||
func TestVaultSecretMatch(t *testing.T) {
|
||||
secret := vaultSecret{
|
||||
Repo: []string{"octocat/hello-world", "github/*"},
|
||||
}
|
||||
if secret.Match("octocat/*") {
|
||||
t.Errorf("Expect octocat/* does not match")
|
||||
}
|
||||
if !secret.Match("octocat/hello-world") {
|
||||
t.Errorf("Expect octocat/hello-world does match")
|
||||
}
|
||||
if !secret.Match("github/hello-world") {
|
||||
t.Errorf("Expect github/hello-world does match wildcard")
|
||||
}
|
||||
}
|
|
@ -1,7 +1,7 @@
|
|||
package sender
|
||||
|
||||
import (
|
||||
"github.com/drone/drone/model"
|
||||
"github.com/laszlocph/drone-oss-08/model"
|
||||
)
|
||||
|
||||
type builtin struct {
|
||||
|
|
|
@ -3,8 +3,8 @@ package sender
|
|||
import (
|
||||
"fmt"
|
||||
|
||||
"github.com/drone/drone/model"
|
||||
"github.com/drone/drone/plugins/internal"
|
||||
"github.com/laszlocph/drone-oss-08/model"
|
||||
"github.com/laszlocph/drone-oss-08/plugins/internal"
|
||||
)
|
||||
|
||||
type plugin struct {
|
||||
|
|
|
@ -19,10 +19,10 @@ import (
|
|||
"net/http"
|
||||
"net/url"
|
||||
|
||||
"github.com/drone/drone/model"
|
||||
"github.com/drone/drone/remote"
|
||||
"github.com/drone/drone/remote/bitbucket/internal"
|
||||
"github.com/drone/drone/shared/httputil"
|
||||
"github.com/laszlocph/drone-oss-08/model"
|
||||
"github.com/laszlocph/drone-oss-08/remote"
|
||||
"github.com/laszlocph/drone-oss-08/remote/bitbucket/internal"
|
||||
"github.com/laszlocph/drone-oss-08/shared/httputil"
|
||||
|
||||
"golang.org/x/oauth2"
|
||||
)
|
||||
|
|
|
@ -20,9 +20,9 @@ import (
|
|||
"net/http/httptest"
|
||||
"testing"
|
||||
|
||||
"github.com/drone/drone/model"
|
||||
"github.com/drone/drone/remote/bitbucket/fixtures"
|
||||
"github.com/drone/drone/remote/bitbucket/internal"
|
||||
"github.com/laszlocph/drone-oss-08/model"
|
||||
"github.com/laszlocph/drone-oss-08/remote/bitbucket/fixtures"
|
||||
"github.com/laszlocph/drone-oss-08/remote/bitbucket/internal"
|
||||
|
||||
"github.com/franela/goblin"
|
||||
"github.com/gin-gonic/gin"
|
||||
|
|
|
@ -20,8 +20,8 @@ import (
|
|||
"regexp"
|
||||
"strings"
|
||||
|
||||
"github.com/drone/drone/model"
|
||||
"github.com/drone/drone/remote/bitbucket/internal"
|
||||
"github.com/laszlocph/drone-oss-08/model"
|
||||
"github.com/laszlocph/drone-oss-08/remote/bitbucket/internal"
|
||||
|
||||
"golang.org/x/oauth2"
|
||||
)
|
||||
|
|
|
@ -18,8 +18,8 @@ import (
|
|||
"testing"
|
||||
"time"
|
||||
|
||||
"github.com/drone/drone/model"
|
||||
"github.com/drone/drone/remote/bitbucket/internal"
|
||||
"github.com/laszlocph/drone-oss-08/model"
|
||||
"github.com/laszlocph/drone-oss-08/remote/bitbucket/internal"
|
||||
|
||||
"github.com/franela/goblin"
|
||||
"golang.org/x/oauth2"
|
||||
|
|
|
@ -19,8 +19,8 @@ import (
|
|||
"io/ioutil"
|
||||
"net/http"
|
||||
|
||||
"github.com/drone/drone/model"
|
||||
"github.com/drone/drone/remote/bitbucket/internal"
|
||||
"github.com/laszlocph/drone-oss-08/model"
|
||||
"github.com/laszlocph/drone-oss-08/remote/bitbucket/internal"
|
||||
)
|
||||
|
||||
const (
|
||||
|
|
|
@ -19,7 +19,7 @@ import (
|
|||
"net/http"
|
||||
"testing"
|
||||
|
||||
"github.com/drone/drone/remote/bitbucket/fixtures"
|
||||
"github.com/laszlocph/drone-oss-08/remote/bitbucket/fixtures"
|
||||
|
||||
"github.com/franela/goblin"
|
||||
)
|
||||
|
|
|
@ -28,9 +28,9 @@ import (
|
|||
"net/url"
|
||||
"strings"
|
||||
|
||||
"github.com/drone/drone/model"
|
||||
"github.com/drone/drone/remote"
|
||||
"github.com/drone/drone/remote/bitbucketserver/internal"
|
||||
"github.com/laszlocph/drone-oss-08/model"
|
||||
"github.com/laszlocph/drone-oss-08/remote"
|
||||
"github.com/laszlocph/drone-oss-08/remote/bitbucketserver/internal"
|
||||
"github.com/mrjones/oauth"
|
||||
)
|
||||
|
||||
|
|
|
@ -22,8 +22,8 @@ import (
|
|||
"strings"
|
||||
"time"
|
||||
|
||||
"github.com/drone/drone/model"
|
||||
"github.com/drone/drone/remote/bitbucketserver/internal"
|
||||
"github.com/laszlocph/drone-oss-08/model"
|
||||
"github.com/laszlocph/drone-oss-08/remote/bitbucketserver/internal"
|
||||
"github.com/mrjones/oauth"
|
||||
)
|
||||
|
||||
|
|
|
@ -17,8 +17,8 @@ package bitbucketserver
|
|||
import (
|
||||
"testing"
|
||||
|
||||
"github.com/drone/drone/model"
|
||||
"github.com/drone/drone/remote/bitbucketserver/internal"
|
||||
"github.com/laszlocph/drone-oss-08/model"
|
||||
"github.com/laszlocph/drone-oss-08/remote/bitbucketserver/internal"
|
||||
"github.com/franela/goblin"
|
||||
"github.com/mrjones/oauth"
|
||||
)
|
||||
|
|
|
@ -26,7 +26,7 @@ import (
|
|||
"strings"
|
||||
|
||||
log "github.com/Sirupsen/logrus"
|
||||
"github.com/drone/drone/model"
|
||||
"github.com/laszlocph/drone-oss-08/model"
|
||||
"github.com/mrjones/oauth"
|
||||
)
|
||||
|
||||
|
|
|
@ -17,8 +17,8 @@ package bitbucketserver
|
|||
import (
|
||||
"encoding/json"
|
||||
"fmt"
|
||||
"github.com/drone/drone/model"
|
||||
"github.com/drone/drone/remote/bitbucketserver/internal"
|
||||
"github.com/laszlocph/drone-oss-08/model"
|
||||
"github.com/laszlocph/drone-oss-08/remote/bitbucketserver/internal"
|
||||
"net/http"
|
||||
)
|
||||
|
||||
|
|
|
@ -20,10 +20,10 @@ import (
|
|||
"net/http"
|
||||
"strings"
|
||||
|
||||
"github.com/drone/drone/model"
|
||||
"github.com/drone/drone/remote"
|
||||
"github.com/drone/drone/remote/coding/internal"
|
||||
"github.com/drone/drone/shared/httputil"
|
||||
"github.com/laszlocph/drone-oss-08/model"
|
||||
"github.com/laszlocph/drone-oss-08/remote"
|
||||
"github.com/laszlocph/drone-oss-08/remote/coding/internal"
|
||||
"github.com/laszlocph/drone-oss-08/shared/httputil"
|
||||
|
||||
"golang.org/x/net/context"
|
||||
"golang.org/x/oauth2"
|
||||
|
|
|
@ -20,8 +20,8 @@ import (
|
|||
"net/http/httptest"
|
||||
"testing"
|
||||
|
||||
"github.com/drone/drone/model"
|
||||
"github.com/drone/drone/remote/coding/fixtures"
|
||||
"github.com/laszlocph/drone-oss-08/model"
|
||||
"github.com/laszlocph/drone-oss-08/remote/coding/fixtures"
|
||||
|
||||
"github.com/franela/goblin"
|
||||
"github.com/gin-gonic/gin"
|
||||
|
|
|
@ -22,7 +22,7 @@ import (
|
|||
"regexp"
|
||||
"strings"
|
||||
|
||||
"github.com/drone/drone/model"
|
||||
"github.com/laszlocph/drone-oss-08/model"
|
||||
)
|
||||
|
||||
const (
|
||||
|
|
|
@ -20,8 +20,8 @@ import (
|
|||
"strings"
|
||||
"testing"
|
||||
|
||||
"github.com/drone/drone/model"
|
||||
"github.com/drone/drone/remote/coding/fixtures"
|
||||
"github.com/laszlocph/drone-oss-08/model"
|
||||
"github.com/laszlocph/drone-oss-08/remote/coding/fixtures"
|
||||
|
||||
"github.com/franela/goblin"
|
||||
)
|
||||
|
|
|
@ -20,8 +20,8 @@ import (
|
|||
"net/http"
|
||||
"net/url"
|
||||
|
||||
"github.com/drone/drone/model"
|
||||
"github.com/drone/drone/remote"
|
||||
"github.com/laszlocph/drone-oss-08/model"
|
||||
"github.com/laszlocph/drone-oss-08/remote"
|
||||
)
|
||||
|
||||
// IMPORTANT Gerrit support is not yet implemented. This file is a placeholder
|
||||
|
|
|
@ -22,8 +22,8 @@ import (
|
|||
"net/url"
|
||||
|
||||
"code.gitea.io/sdk/gitea"
|
||||
"github.com/drone/drone/model"
|
||||
"github.com/drone/drone/remote"
|
||||
"github.com/laszlocph/drone-oss-08/model"
|
||||
"github.com/laszlocph/drone-oss-08/remote"
|
||||
)
|
||||
|
||||
// Opts defines configuration options.
|
||||
|
|
|
@ -18,8 +18,8 @@ import (
|
|||
"net/http/httptest"
|
||||
"testing"
|
||||
|
||||
"github.com/drone/drone/model"
|
||||
"github.com/drone/drone/remote/gitea/fixtures"
|
||||
"github.com/laszlocph/drone-oss-08/model"
|
||||
"github.com/laszlocph/drone-oss-08/remote/gitea/fixtures"
|
||||
"github.com/franela/goblin"
|
||||
"github.com/gin-gonic/gin"
|
||||
)
|
||||
|
|
|
@ -23,7 +23,7 @@ import (
|
|||
"time"
|
||||
|
||||
"code.gitea.io/sdk/gitea"
|
||||
"github.com/drone/drone/model"
|
||||
"github.com/laszlocph/drone-oss-08/model"
|
||||
)
|
||||
|
||||
// helper function that converts a Gitea repository to a Drone repository.
|
||||
|
|
|
@ -19,8 +19,8 @@ import (
|
|||
"testing"
|
||||
|
||||
"code.gitea.io/sdk/gitea"
|
||||
"github.com/drone/drone/model"
|
||||
"github.com/drone/drone/remote/gitea/fixtures"
|
||||
"github.com/laszlocph/drone-oss-08/model"
|
||||
"github.com/laszlocph/drone-oss-08/remote/gitea/fixtures"
|
||||
"github.com/franela/goblin"
|
||||
)
|
||||
|
||||
|
|
|
@ -18,7 +18,7 @@ import (
|
|||
"io"
|
||||
"net/http"
|
||||
|
||||
"github.com/drone/drone/model"
|
||||
"github.com/laszlocph/drone-oss-08/model"
|
||||
)
|
||||
|
||||
const (
|
||||
|
|
|
@ -18,7 +18,7 @@ import (
|
|||
"fmt"
|
||||
"strings"
|
||||
|
||||
"github.com/drone/drone/model"
|
||||
"github.com/laszlocph/drone-oss-08/model"
|
||||
|
||||
"github.com/google/go-github/github"
|
||||
)
|
||||
|
|
|
@ -17,7 +17,7 @@ package github
|
|||
import (
|
||||
"testing"
|
||||
|
||||
"github.com/drone/drone/model"
|
||||
"github.com/laszlocph/drone-oss-08/model"
|
||||
"github.com/google/go-github/github"
|
||||
|
||||
"github.com/franela/goblin"
|
||||
|
|
|
@ -24,9 +24,9 @@ import (
|
|||
"strconv"
|
||||
"strings"
|
||||
|
||||
"github.com/drone/drone/model"
|
||||
"github.com/drone/drone/remote"
|
||||
"github.com/drone/drone/shared/httputil"
|
||||
"github.com/laszlocph/drone-oss-08/model"
|
||||
"github.com/laszlocph/drone-oss-08/remote"
|
||||
"github.com/laszlocph/drone-oss-08/shared/httputil"
|
||||
|
||||
"github.com/google/go-github/github"
|
||||
"golang.org/x/net/context"
|
||||
|
|
|
@ -18,8 +18,8 @@ import (
|
|||
"net/http/httptest"
|
||||
"testing"
|
||||
|
||||
"github.com/drone/drone/model"
|
||||
"github.com/drone/drone/remote/github/fixtures"
|
||||
"github.com/laszlocph/drone-oss-08/model"
|
||||
"github.com/laszlocph/drone-oss-08/remote/github/fixtures"
|
||||
|
||||
"github.com/franela/goblin"
|
||||
"github.com/gin-gonic/gin"
|
||||
|
|
|
@ -21,7 +21,7 @@ import (
|
|||
"io/ioutil"
|
||||
"net/http"
|
||||
|
||||
"github.com/drone/drone/model"
|
||||
"github.com/laszlocph/drone-oss-08/model"
|
||||
)
|
||||
|
||||
const (
|
||||
|
|
|
@ -19,8 +19,8 @@ import (
|
|||
"net/http"
|
||||
"testing"
|
||||
|
||||
"github.com/drone/drone/model"
|
||||
"github.com/drone/drone/remote/github/fixtures"
|
||||
"github.com/laszlocph/drone-oss-08/model"
|
||||
"github.com/laszlocph/drone-oss-08/remote/github/fixtures"
|
||||
"github.com/franela/goblin"
|
||||
)
|
||||
|
||||
|
|
|
@ -24,12 +24,12 @@ import (
|
|||
"strconv"
|
||||
"strings"
|
||||
|
||||
"github.com/drone/drone/model"
|
||||
"github.com/drone/drone/remote"
|
||||
"github.com/drone/drone/shared/httputil"
|
||||
"github.com/drone/drone/shared/oauth2"
|
||||
"github.com/laszlocph/drone-oss-08/model"
|
||||
"github.com/laszlocph/drone-oss-08/remote"
|
||||
"github.com/laszlocph/drone-oss-08/shared/httputil"
|
||||
"github.com/laszlocph/drone-oss-08/shared/oauth2"
|
||||
|
||||
"github.com/drone/drone/remote/gitlab/client"
|
||||
"github.com/laszlocph/drone-oss-08/remote/gitlab/client"
|
||||
)
|
||||
|
||||
const DefaultScope = "api"
|
||||
|
|
|
@ -19,8 +19,8 @@ import (
|
|||
"net/http"
|
||||
"testing"
|
||||
|
||||
"github.com/drone/drone/model"
|
||||
"github.com/drone/drone/remote/gitlab/testdata"
|
||||
"github.com/laszlocph/drone-oss-08/model"
|
||||
"github.com/laszlocph/drone-oss-08/remote/gitlab/testdata"
|
||||
"github.com/franela/goblin"
|
||||
)
|
||||
|
||||
|
|
|
@ -22,7 +22,7 @@ import (
|
|||
"strconv"
|
||||
"strings"
|
||||
|
||||
"github.com/drone/drone/remote/gitlab/client"
|
||||
"github.com/laszlocph/drone-oss-08/remote/gitlab/client"
|
||||
)
|
||||
|
||||
const (
|
||||
|
|
|
@ -24,12 +24,12 @@ import (
|
|||
"strconv"
|
||||
"strings"
|
||||
|
||||
"github.com/drone/drone/model"
|
||||
"github.com/drone/drone/remote"
|
||||
"github.com/drone/drone/shared/httputil"
|
||||
"github.com/drone/drone/shared/oauth2"
|
||||
"github.com/laszlocph/drone-oss-08/model"
|
||||
"github.com/laszlocph/drone-oss-08/remote"
|
||||
"github.com/laszlocph/drone-oss-08/shared/httputil"
|
||||
"github.com/laszlocph/drone-oss-08/shared/oauth2"
|
||||
|
||||
"github.com/drone/drone/remote/gitlab3/client"
|
||||
"github.com/laszlocph/drone-oss-08/remote/gitlab3/client"
|
||||
)
|
||||
|
||||
const DefaultScope = "api"
|
||||
|
|
|
@ -19,8 +19,8 @@ import (
|
|||
"net/http"
|
||||
"testing"
|
||||
|
||||
"github.com/drone/drone/model"
|
||||
"github.com/drone/drone/remote/gitlab3/testdata"
|
||||
"github.com/laszlocph/drone-oss-08/model"
|
||||
"github.com/laszlocph/drone-oss-08/remote/gitlab3/testdata"
|
||||
"github.com/franela/goblin"
|
||||
)
|
||||
|
||||
|
|
|
@ -22,7 +22,7 @@ import (
|
|||
"strconv"
|
||||
"strings"
|
||||
|
||||
"github.com/drone/drone/remote/gitlab3/client"
|
||||
"github.com/laszlocph/drone-oss-08/remote/gitlab3/client"
|
||||
)
|
||||
|
||||
const (
|
||||
|
|
|
@ -22,8 +22,8 @@ import (
|
|||
"net/url"
|
||||
"strings"
|
||||
|
||||
"github.com/drone/drone/model"
|
||||
"github.com/drone/drone/remote"
|
||||
"github.com/laszlocph/drone-oss-08/model"
|
||||
"github.com/laszlocph/drone-oss-08/remote"
|
||||
"github.com/gogits/go-gogs-client"
|
||||
)
|
||||
|
||||
|
|
|
@ -18,8 +18,8 @@ import (
|
|||
"net/http/httptest"
|
||||
"testing"
|
||||
|
||||
"github.com/drone/drone/model"
|
||||
"github.com/drone/drone/remote/gogs/fixtures"
|
||||
"github.com/laszlocph/drone-oss-08/model"
|
||||
"github.com/laszlocph/drone-oss-08/remote/gogs/fixtures"
|
||||
|
||||
"github.com/franela/goblin"
|
||||
"github.com/gin-gonic/gin"
|
||||
|
|
|
@ -22,7 +22,7 @@ import (
|
|||
"strings"
|
||||
"time"
|
||||
|
||||
"github.com/drone/drone/model"
|
||||
"github.com/laszlocph/drone-oss-08/model"
|
||||
"github.com/gogits/go-gogs-client"
|
||||
)
|
||||
|
||||
|
|
|
@ -18,8 +18,8 @@ import (
|
|||
"bytes"
|
||||
"testing"
|
||||
|
||||
"github.com/drone/drone/model"
|
||||
"github.com/drone/drone/remote/gogs/fixtures"
|
||||
"github.com/laszlocph/drone-oss-08/model"
|
||||
"github.com/laszlocph/drone-oss-08/remote/gogs/fixtures"
|
||||
|
||||
"github.com/franela/goblin"
|
||||
"github.com/gogits/go-gogs-client"
|
||||
|
|
|
@ -18,7 +18,7 @@ import (
|
|||
"io"
|
||||
"net/http"
|
||||
|
||||
"github.com/drone/drone/model"
|
||||
"github.com/laszlocph/drone-oss-08/model"
|
||||
)
|
||||
|
||||
const (
|
||||
|
|
|
@ -17,7 +17,7 @@ package mock
|
|||
import (
|
||||
"net/http"
|
||||
|
||||
"github.com/drone/drone/model"
|
||||
"github.com/laszlocph/drone-oss-08/model"
|
||||
"github.com/stretchr/testify/mock"
|
||||
)
|
||||
|
||||
|
|
|
@ -20,7 +20,7 @@ import (
|
|||
"net/http"
|
||||
"time"
|
||||
|
||||
"github.com/drone/drone/model"
|
||||
"github.com/laszlocph/drone-oss-08/model"
|
||||
|
||||
"golang.org/x/net/context"
|
||||
)
|
||||
|
|
|
@ -15,7 +15,7 @@
|
|||
package middleware
|
||||
|
||||
import (
|
||||
"github.com/drone/drone/model"
|
||||
"github.com/laszlocph/drone-oss-08/model"
|
||||
|
||||
"github.com/gin-gonic/gin"
|
||||
"github.com/urfave/cli"
|
||||
|
|
|
@ -18,7 +18,7 @@ import (
|
|||
"net/http"
|
||||
"time"
|
||||
|
||||
"github.com/drone/drone/version"
|
||||
"github.com/laszlocph/drone-oss-08/version"
|
||||
"github.com/gin-gonic/gin"
|
||||
)
|
||||
|
||||
|
|
|
@ -15,7 +15,7 @@
|
|||
package middleware
|
||||
|
||||
import (
|
||||
"github.com/drone/drone/remote"
|
||||
"github.com/laszlocph/drone-oss-08/remote"
|
||||
"github.com/gin-gonic/gin"
|
||||
)
|
||||
|
||||
|
|
|
@ -15,7 +15,7 @@
|
|||
package session
|
||||
|
||||
import (
|
||||
"github.com/drone/drone/shared/token"
|
||||
"github.com/laszlocph/drone-oss-08/shared/token"
|
||||
"github.com/gin-gonic/gin"
|
||||
)
|
||||
|
||||
|
|
|
@ -18,9 +18,9 @@ import (
|
|||
"net/http"
|
||||
"time"
|
||||
|
||||
"github.com/drone/drone/model"
|
||||
"github.com/drone/drone/remote"
|
||||
"github.com/drone/drone/store"
|
||||
"github.com/laszlocph/drone-oss-08/model"
|
||||
"github.com/laszlocph/drone-oss-08/remote"
|
||||
"github.com/laszlocph/drone-oss-08/store"
|
||||
|
||||
log "github.com/Sirupsen/logrus"
|
||||
"github.com/gin-gonic/gin"
|
||||
|
|
|
@ -17,9 +17,9 @@ package session
|
|||
import (
|
||||
"net/http"
|
||||
|
||||
"github.com/drone/drone/model"
|
||||
"github.com/drone/drone/shared/token"
|
||||
"github.com/drone/drone/store"
|
||||
"github.com/laszlocph/drone-oss-08/model"
|
||||
"github.com/laszlocph/drone-oss-08/shared/token"
|
||||
"github.com/laszlocph/drone-oss-08/store"
|
||||
|
||||
"github.com/gin-gonic/gin"
|
||||
)
|
||||
|
|
|
@ -15,7 +15,7 @@
|
|||
package middleware
|
||||
|
||||
import (
|
||||
"github.com/drone/drone/store"
|
||||
"github.com/laszlocph/drone-oss-08/store"
|
||||
"github.com/urfave/cli"
|
||||
|
||||
"github.com/gin-gonic/gin"
|
||||
|
|
|
@ -17,9 +17,9 @@ package token
|
|||
import (
|
||||
"time"
|
||||
|
||||
"github.com/drone/drone/remote"
|
||||
"github.com/drone/drone/router/middleware/session"
|
||||
"github.com/drone/drone/store"
|
||||
"github.com/laszlocph/drone-oss-08/remote"
|
||||
"github.com/laszlocph/drone-oss-08/router/middleware/session"
|
||||
"github.com/laszlocph/drone-oss-08/store"
|
||||
|
||||
log "github.com/Sirupsen/logrus"
|
||||
"github.com/gin-gonic/gin"
|
||||
|
|
|
@ -15,7 +15,7 @@
|
|||
package middleware
|
||||
|
||||
import (
|
||||
"github.com/drone/drone/version"
|
||||
"github.com/laszlocph/drone-oss-08/version"
|
||||
"github.com/gin-gonic/gin"
|
||||
)
|
||||
|
||||
|
|
|
@ -20,13 +20,13 @@ import (
|
|||
"github.com/dimfeld/httptreemux"
|
||||
"github.com/gin-gonic/gin"
|
||||
|
||||
"github.com/drone/drone/router/middleware/header"
|
||||
"github.com/drone/drone/router/middleware/session"
|
||||
"github.com/drone/drone/router/middleware/token"
|
||||
"github.com/drone/drone/server"
|
||||
"github.com/drone/drone/server/debug"
|
||||
"github.com/drone/drone/server/metrics"
|
||||
"github.com/drone/drone/server/web"
|
||||
"github.com/laszlocph/drone-oss-08/router/middleware/header"
|
||||
"github.com/laszlocph/drone-oss-08/router/middleware/session"
|
||||
"github.com/laszlocph/drone-oss-08/router/middleware/token"
|
||||
"github.com/laszlocph/drone-oss-08/server"
|
||||
"github.com/laszlocph/drone-oss-08/server/debug"
|
||||
"github.com/laszlocph/drone-oss-08/server/metrics"
|
||||
"github.com/laszlocph/drone-oss-08/server/web"
|
||||
)
|
||||
|
||||
// Load loads the router
|
||||
|
|
|
@ -20,9 +20,9 @@ import (
|
|||
log "github.com/Sirupsen/logrus"
|
||||
"github.com/gin-gonic/gin"
|
||||
|
||||
"github.com/drone/drone/model"
|
||||
"github.com/drone/drone/shared/httputil"
|
||||
"github.com/drone/drone/store"
|
||||
"github.com/laszlocph/drone-oss-08/model"
|
||||
"github.com/laszlocph/drone-oss-08/shared/httputil"
|
||||
"github.com/laszlocph/drone-oss-08/store"
|
||||
)
|
||||
|
||||
var (
|
||||
|
|
|
@ -28,13 +28,13 @@ import (
|
|||
"github.com/cncd/pipeline/pipeline/rpc"
|
||||
"github.com/cncd/pubsub"
|
||||
"github.com/cncd/queue"
|
||||
"github.com/drone/drone/remote"
|
||||
"github.com/drone/drone/shared/httputil"
|
||||
"github.com/drone/drone/store"
|
||||
"github.com/laszlocph/drone-oss-08/remote"
|
||||
"github.com/laszlocph/drone-oss-08/shared/httputil"
|
||||
"github.com/laszlocph/drone-oss-08/store"
|
||||
"github.com/gin-gonic/gin"
|
||||
|
||||
"github.com/drone/drone/model"
|
||||
"github.com/drone/drone/router/middleware/session"
|
||||
"github.com/laszlocph/drone-oss-08/model"
|
||||
"github.com/laszlocph/drone-oss-08/router/middleware/session"
|
||||
)
|
||||
|
||||
func GetBuilds(c *gin.Context) {
|
||||
|
|
|
@ -20,8 +20,8 @@ import (
|
|||
"strconv"
|
||||
"strings"
|
||||
|
||||
"github.com/drone/drone/router/middleware/session"
|
||||
"github.com/drone/drone/store"
|
||||
"github.com/laszlocph/drone-oss-08/router/middleware/session"
|
||||
"github.com/laszlocph/drone-oss-08/store"
|
||||
"github.com/gin-gonic/gin"
|
||||
)
|
||||
|
||||
|
|
|
@ -29,11 +29,11 @@ import (
|
|||
"github.com/gin-gonic/gin"
|
||||
|
||||
"github.com/Sirupsen/logrus"
|
||||
"github.com/drone/drone/model"
|
||||
"github.com/drone/drone/remote"
|
||||
"github.com/drone/drone/shared/httputil"
|
||||
"github.com/drone/drone/shared/token"
|
||||
"github.com/drone/drone/store"
|
||||
"github.com/laszlocph/drone-oss-08/model"
|
||||
"github.com/laszlocph/drone-oss-08/remote"
|
||||
"github.com/laszlocph/drone-oss-08/shared/httputil"
|
||||
"github.com/laszlocph/drone-oss-08/shared/token"
|
||||
"github.com/laszlocph/drone-oss-08/store"
|
||||
"github.com/drone/envsubst"
|
||||
|
||||
"github.com/cncd/pipeline/pipeline/backend"
|
||||
|
|
|
@ -17,7 +17,7 @@ package server
|
|||
import (
|
||||
"testing"
|
||||
|
||||
"github.com/drone/drone/model"
|
||||
"github.com/laszlocph/drone-oss-08/model"
|
||||
)
|
||||
|
||||
func TestMultilineEnvsubst(t *testing.T) {
|
||||
|
|
|
@ -19,11 +19,11 @@ import (
|
|||
"net/http"
|
||||
"time"
|
||||
|
||||
"github.com/drone/drone/model"
|
||||
"github.com/drone/drone/remote"
|
||||
"github.com/drone/drone/shared/httputil"
|
||||
"github.com/drone/drone/shared/token"
|
||||
"github.com/drone/drone/store"
|
||||
"github.com/laszlocph/drone-oss-08/model"
|
||||
"github.com/laszlocph/drone-oss-08/remote"
|
||||
"github.com/laszlocph/drone-oss-08/shared/httputil"
|
||||
"github.com/laszlocph/drone-oss-08/shared/token"
|
||||
"github.com/laszlocph/drone-oss-08/store"
|
||||
"github.com/gorilla/securecookie"
|
||||
|
||||
"github.com/Sirupsen/logrus"
|
||||
|
|
|
@ -18,7 +18,7 @@ import (
|
|||
"errors"
|
||||
"fmt"
|
||||
|
||||
"github.com/drone/drone/server"
|
||||
"github.com/laszlocph/drone-oss-08/server"
|
||||
"github.com/gin-gonic/gin"
|
||||
"github.com/prometheus/client_golang/prometheus/promhttp"
|
||||
)
|
||||
|
|
|
@ -17,8 +17,8 @@ package server
|
|||
import (
|
||||
"net/http"
|
||||
|
||||
"github.com/drone/drone/model"
|
||||
"github.com/drone/drone/router/middleware/session"
|
||||
"github.com/laszlocph/drone-oss-08/model"
|
||||
"github.com/laszlocph/drone-oss-08/router/middleware/session"
|
||||
|
||||
"github.com/gin-gonic/gin"
|
||||
)
|
||||
|
|
|
@ -23,12 +23,12 @@ import (
|
|||
"github.com/gin-gonic/gin"
|
||||
"github.com/gorilla/securecookie"
|
||||
|
||||
"github.com/drone/drone/model"
|
||||
"github.com/drone/drone/remote"
|
||||
"github.com/drone/drone/router/middleware/session"
|
||||
"github.com/drone/drone/shared/httputil"
|
||||
"github.com/drone/drone/shared/token"
|
||||
"github.com/drone/drone/store"
|
||||
"github.com/laszlocph/drone-oss-08/model"
|
||||
"github.com/laszlocph/drone-oss-08/remote"
|
||||
"github.com/laszlocph/drone-oss-08/router/middleware/session"
|
||||
"github.com/laszlocph/drone-oss-08/shared/httputil"
|
||||
"github.com/laszlocph/drone-oss-08/shared/token"
|
||||
"github.com/laszlocph/drone-oss-08/store"
|
||||
)
|
||||
|
||||
func PostRepo(c *gin.Context) {
|
||||
|
|
|
@ -34,9 +34,9 @@ import (
|
|||
"github.com/cncd/pubsub"
|
||||
"github.com/cncd/queue"
|
||||
|
||||
"github.com/drone/drone/model"
|
||||
"github.com/drone/drone/remote"
|
||||
"github.com/drone/drone/store"
|
||||
"github.com/laszlocph/drone-oss-08/model"
|
||||
"github.com/laszlocph/drone-oss-08/remote"
|
||||
"github.com/laszlocph/drone-oss-08/store"
|
||||
|
||||
"github.com/drone/expr"
|
||||
)
|
||||
|
|
|
@ -17,8 +17,8 @@ package server
|
|||
import (
|
||||
"net/http"
|
||||
|
||||
"github.com/drone/drone/model"
|
||||
"github.com/drone/drone/router/middleware/session"
|
||||
"github.com/laszlocph/drone-oss-08/model"
|
||||
"github.com/laszlocph/drone-oss-08/router/middleware/session"
|
||||
|
||||
"github.com/gin-gonic/gin"
|
||||
)
|
||||
|
|
|
@ -24,9 +24,9 @@ import (
|
|||
|
||||
"github.com/cncd/logging"
|
||||
"github.com/cncd/pubsub"
|
||||
"github.com/drone/drone/model"
|
||||
"github.com/drone/drone/router/middleware/session"
|
||||
"github.com/drone/drone/store"
|
||||
"github.com/laszlocph/drone-oss-08/model"
|
||||
"github.com/laszlocph/drone-oss-08/router/middleware/session"
|
||||
"github.com/laszlocph/drone-oss-08/store"
|
||||
|
||||
"github.com/Sirupsen/logrus"
|
||||
"github.com/gin-gonic/gin"
|
||||
|
|
|
@ -17,7 +17,7 @@ package swagger
|
|||
import (
|
||||
"net/http"
|
||||
|
||||
"github.com/drone/drone/model"
|
||||
"github.com/laszlocph/drone-oss-08/model"
|
||||
)
|
||||
|
||||
// swagger:route GET /users/{login} user getUser
|
||||
|
|
|
@ -17,9 +17,9 @@ package server
|
|||
import (
|
||||
"time"
|
||||
|
||||
"github.com/drone/drone/model"
|
||||
"github.com/drone/drone/remote"
|
||||
"github.com/drone/drone/store"
|
||||
"github.com/laszlocph/drone-oss-08/model"
|
||||
"github.com/laszlocph/drone-oss-08/remote"
|
||||
"github.com/laszlocph/drone-oss-08/store"
|
||||
)
|
||||
|
||||
// Syncer synces the user repository and permissions.
|
||||
|
|
|
@ -24,11 +24,11 @@ import (
|
|||
"github.com/gin-gonic/gin"
|
||||
"github.com/gorilla/securecookie"
|
||||
|
||||
"github.com/drone/drone/model"
|
||||
"github.com/drone/drone/remote"
|
||||
"github.com/drone/drone/router/middleware/session"
|
||||
"github.com/drone/drone/shared/token"
|
||||
"github.com/drone/drone/store"
|
||||
"github.com/laszlocph/drone-oss-08/model"
|
||||
"github.com/laszlocph/drone-oss-08/remote"
|
||||
"github.com/laszlocph/drone-oss-08/router/middleware/session"
|
||||
"github.com/laszlocph/drone-oss-08/shared/token"
|
||||
"github.com/laszlocph/drone-oss-08/store"
|
||||
)
|
||||
|
||||
func GetSelf(c *gin.Context) {
|
||||
|
|
|
@ -21,8 +21,8 @@ import (
|
|||
"github.com/gin-gonic/gin"
|
||||
"github.com/gorilla/securecookie"
|
||||
|
||||
"github.com/drone/drone/model"
|
||||
"github.com/drone/drone/store"
|
||||
"github.com/laszlocph/drone-oss-08/model"
|
||||
"github.com/laszlocph/drone-oss-08/store"
|
||||
)
|
||||
|
||||
func GetUsers(c *gin.Context) {
|
||||
|
|
|
@ -24,10 +24,10 @@ import (
|
|||
"path/filepath"
|
||||
"time"
|
||||
|
||||
"github.com/drone/drone-ui/dist"
|
||||
"github.com/drone/drone/model"
|
||||
"github.com/drone/drone/shared/token"
|
||||
"github.com/drone/drone/version"
|
||||
"github.com/laszlocph/drone-ui/dist"
|
||||
"github.com/laszlocph/drone-oss-08/model"
|
||||
"github.com/laszlocph/drone-oss-08/shared/token"
|
||||
"github.com/laszlocph/drone-oss-08/version"
|
||||
|
||||
"github.com/dimfeld/httptreemux"
|
||||
)
|
||||
|
|
|
@ -15,8 +15,8 @@
|
|||
package server
|
||||
|
||||
import (
|
||||
"github.com/drone/drone/store"
|
||||
"github.com/drone/drone/version"
|
||||
"github.com/laszlocph/drone-oss-08/store"
|
||||
"github.com/laszlocph/drone-oss-08/version"
|
||||
"github.com/gin-gonic/gin"
|
||||
)
|
||||
|
||||
|
@ -32,7 +32,7 @@ func Health(c *gin.Context) {
|
|||
// Version endpoint returns the server version and build information.
|
||||
func Version(c *gin.Context) {
|
||||
c.JSON(200, gin.H{
|
||||
"source": "https://github.com/drone/drone",
|
||||
"source": "https://github.com/laszlocph/drone-oss-08",
|
||||
"version": version.Version.String(),
|
||||
})
|
||||
}
|
||||
|
|
|
@ -18,8 +18,8 @@ import (
|
|||
"fmt"
|
||||
"time"
|
||||
|
||||
"github.com/drone/drone/model"
|
||||
"github.com/drone/drone/store/datastore/sql"
|
||||
"github.com/laszlocph/drone-oss-08/model"
|
||||
"github.com/laszlocph/drone-oss-08/store/datastore/sql"
|
||||
"github.com/russross/meddler"
|
||||
)
|
||||
|
||||
|
|
|
@ -18,7 +18,7 @@ import (
|
|||
"fmt"
|
||||
"testing"
|
||||
|
||||
"github.com/drone/drone/model"
|
||||
"github.com/laszlocph/drone-oss-08/model"
|
||||
"github.com/franela/goblin"
|
||||
)
|
||||
|
||||
|
|
|
@ -17,8 +17,8 @@ package datastore
|
|||
import (
|
||||
gosql "database/sql"
|
||||
|
||||
"github.com/drone/drone/model"
|
||||
"github.com/drone/drone/store/datastore/sql"
|
||||
"github.com/laszlocph/drone-oss-08/model"
|
||||
"github.com/laszlocph/drone-oss-08/store/datastore/sql"
|
||||
"github.com/russross/meddler"
|
||||
)
|
||||
|
||||
|
|
|
@ -17,7 +17,7 @@ package datastore
|
|||
import (
|
||||
"testing"
|
||||
|
||||
"github.com/drone/drone/model"
|
||||
"github.com/laszlocph/drone-oss-08/model"
|
||||
)
|
||||
|
||||
func TestConfig(t *testing.T) {
|
||||
|
|
|
@ -18,9 +18,9 @@ import (
|
|||
"database/sql"
|
||||
"errors"
|
||||
|
||||
"github.com/drone/drone/store/datastore/ddl/mysql"
|
||||
"github.com/drone/drone/store/datastore/ddl/postgres"
|
||||
"github.com/drone/drone/store/datastore/ddl/sqlite"
|
||||
"github.com/laszlocph/drone-oss-08/store/datastore/ddl/mysql"
|
||||
"github.com/laszlocph/drone-oss-08/store/datastore/ddl/postgres"
|
||||
"github.com/laszlocph/drone-oss-08/store/datastore/ddl/sqlite"
|
||||
)
|
||||
|
||||
// Supported database drivers
|
||||
|
|
|
@ -19,8 +19,8 @@ import (
|
|||
"io"
|
||||
"io/ioutil"
|
||||
|
||||
"github.com/drone/drone/model"
|
||||
"github.com/drone/drone/store/datastore/sql"
|
||||
"github.com/laszlocph/drone-oss-08/model"
|
||||
"github.com/laszlocph/drone-oss-08/store/datastore/sql"
|
||||
|
||||
"github.com/russross/meddler"
|
||||
)
|
||||
|
|
|
@ -19,7 +19,7 @@ import (
|
|||
"io/ioutil"
|
||||
"testing"
|
||||
|
||||
"github.com/drone/drone/model"
|
||||
"github.com/laszlocph/drone-oss-08/model"
|
||||
)
|
||||
|
||||
func TestFileFind(t *testing.T) {
|
||||
|
|
|
@ -19,8 +19,8 @@ import (
|
|||
"io"
|
||||
"io/ioutil"
|
||||
|
||||
"github.com/drone/drone/model"
|
||||
"github.com/drone/drone/store/datastore/sql"
|
||||
"github.com/laszlocph/drone-oss-08/model"
|
||||
"github.com/laszlocph/drone-oss-08/store/datastore/sql"
|
||||
"github.com/russross/meddler"
|
||||
)
|
||||
|
||||
|
|
|
@ -19,7 +19,7 @@ import (
|
|||
"io/ioutil"
|
||||
"testing"
|
||||
|
||||
"github.com/drone/drone/model"
|
||||
"github.com/laszlocph/drone-oss-08/model"
|
||||
)
|
||||
|
||||
func TestLogCreateFind(t *testing.T) {
|
||||
|
|
|
@ -15,8 +15,8 @@
|
|||
package datastore
|
||||
|
||||
import (
|
||||
"github.com/drone/drone/model"
|
||||
"github.com/drone/drone/store/datastore/sql"
|
||||
"github.com/laszlocph/drone-oss-08/model"
|
||||
"github.com/laszlocph/drone-oss-08/store/datastore/sql"
|
||||
|
||||
"github.com/russross/meddler"
|
||||
)
|
||||
|
|
Some files were not shown because too many files have changed in this diff Show more
Loading…
Reference in a new issue