Local test setup

This commit is contained in:
Laszlo Fogas
2019-05-29 09:11:15 +02:00
parent cc4101ef35
commit b263e59bd1
3 changed files with 96 additions and 0 deletions

1
.gitignore vendored
View File

@@ -11,3 +11,4 @@ kubeconfig.yaml
server/swagger/files/*.json
.idea/
.vscode/

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