mirror of
https://github.com/woodpecker-ci/woodpecker.git
synced 2026-04-15 01:41:56 +00:00
Local test setup
This commit is contained in:
1
.gitignore
vendored
1
.gitignore
vendored
@@ -11,3 +11,4 @@ kubeconfig.yaml
|
||||
|
||||
server/swagger/files/*.json
|
||||
.idea/
|
||||
.vscode/
|
||||
|
||||
58
cmd/drone-server/main_test.go
Normal file
58
cmd/drone-server/main_test.go
Normal file
@@ -0,0 +1,58 @@
|
||||
// Copyright 2018 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 manual
|
||||
|
||||
package main
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"os"
|
||||
"testing"
|
||||
|
||||
_ "github.com/joho/godotenv/autoload"
|
||||
"github.com/laszlocph/drone-oss-08/version"
|
||||
"github.com/urfave/cli"
|
||||
)
|
||||
|
||||
func Test_main(t *testing.T) {
|
||||
os.Setenv("KUBECONFIG", "/home/laszlo/go/src/github.com/laszlocph/drone-oss-08/kubeconfig.yaml")
|
||||
os.Setenv("DRONE_HOST", "xxx")
|
||||
os.Setenv("DRONE_GITHUB", "true")
|
||||
// os.Setenv("DATABASE_CONFIG", "/var/lib/drone/drone.sqlite")
|
||||
os.Setenv("DATABASE_DRIVER", "sqlite3")
|
||||
os.Setenv("DRONE_DEBUG", "true")
|
||||
os.Setenv("DRONE_KUBERNETES", "true")
|
||||
os.Setenv("DRONE_KUBERNETES_NAMESPACE", "default")
|
||||
os.Setenv("DRONE_KUBERNETES_STORAGECLASS", "example-nfs")
|
||||
os.Setenv("DRONE_KUBERNETES_VOLUME_SIZE", "100Mi")
|
||||
|
||||
os.Setenv("DRONE_ADMIN", "laszlocph")
|
||||
os.Setenv("DRONE_OPEN", "true")
|
||||
os.Setenv("DRONE_GITHUB_CLIENT", "xxx")
|
||||
os.Setenv("DRONE_GITHUB_SECRET", "xxx")
|
||||
|
||||
app := cli.NewApp()
|
||||
app.Name = "drone-server"
|
||||
app.Version = version.Version.String()
|
||||
app.Usage = "drone server"
|
||||
app.Action = server
|
||||
app.Flags = flags
|
||||
app.Before = before
|
||||
|
||||
if err := app.Run(os.Args); err != nil {
|
||||
fmt.Fprintln(os.Stderr, err)
|
||||
os.Exit(1)
|
||||
}
|
||||
}
|
||||
37
docker-compose.yml
Normal file
37
docker-compose.yml
Normal file
@@ -0,0 +1,37 @@
|
||||
version: '2'
|
||||
|
||||
services:
|
||||
drone-server:
|
||||
build:
|
||||
context: .
|
||||
dockerfile: Dockerfile
|
||||
image: laszlocloud/drone-oss-08-server:local
|
||||
ports:
|
||||
- 8000:8000
|
||||
volumes:
|
||||
- /var/lib/drone:/var/lib/drone/
|
||||
- /home/laszlo/.kube/config:/root/.kube/config
|
||||
environment:
|
||||
- DRONE_OPEN=true
|
||||
- DRONE_ADMIN=laszlocph
|
||||
- DRONE_HOST=${HOST}
|
||||
- DRONE_GITHUB=true
|
||||
- DRONE_GITHUB_CLIENT=${GITHUB_CLIENT}
|
||||
- DRONE_GITHUB_SECRET=${GITHUB_SECRET}
|
||||
- DRONE_SECRET=${DRONE_SECRET}
|
||||
- DRONE_KUBERNETES=true
|
||||
- DRONE_KUBERNETES_NAMESPACE=default
|
||||
- DRONE_KUBERNETES_STORAGECLASS=example-nfs
|
||||
- DRONE_KUBERNETES_VOLUME_SIZE=100Mi
|
||||
- KUBECONFIG=/root/.kube/config
|
||||
# drone-agent:
|
||||
# build:
|
||||
# context: .
|
||||
# dockerfile: Dockerfile.agent
|
||||
# image: laszlocloud/drone-oss-08-agent:local
|
||||
# volumes:
|
||||
# - /var/run/docker.sock:/var/run/docker.sock
|
||||
# environment:
|
||||
# - DRONE_SERVER=drone-server:9000
|
||||
# - DRONE_SECRET=${DRONE_SECRET}
|
||||
# - DRONE_MAX_PROCS=1
|
||||
Reference in New Issue
Block a user