Deploy sh

This commit is contained in:
James Jeffrey
2017-06-09 13:42:59 -07:00
committed by Reed Allman
parent aa170c918f
commit 79f1dab007
10 changed files with 312 additions and 170 deletions

65
.gitlab-ci.yml Normal file
View File

@@ -0,0 +1,65 @@
image: funcy/go-dind:latest
cache:
key: "$CI_COMMIT_REF_NAME"
untracked: true
stages:
- deps
- build
- test
- deploy
before_script:
- mkdir -p "${GOPATH}/src/gitlab-odx.oracle.com/odx/"
- ln -s `pwd` "${GOPATH}/src/gitlab-odx.oracle.com/odx/"
- cd "${GOPATH}/src/gitlab-odx.oracle.com/odx/functions"
get_deps:
stage: deps
script:
- cd "${GOPATH}/src/gitlab-odx.oracle.com/odx/functions"
- pwd
- go get github.com/Masterminds/glide
- glide install --strip-vendor
- cd "${GOPATH}/src/gitlab-odx.oracle.com/odx/functions/fn"
- pwd
- glide install --strip-vendor
only:
- master
load_deps:
stage: deps
script:
- cd "${GOPATH}/src/gitlab-odx.oracle.com/odx/functions"
- pwd
- ls vendor/github.com/ > /dev/null || which glide || go get github.com/Masterminds/glide
- ls vendor/github.com/ > /dev/null || glide install --strip-vendor
- cd "${GOPATH}/src/gitlab-odx.oracle.com/odx/functions/fn"
- pwd
- ls vendor/github.com/ > /dev/null || glide install --strip-vendor
except:
- master
build_job:
stage: build
script:
- go build -o functions-alpine
test_job:
stage: test
script:
- ./test.sh
deploy_job:
only:
- tags
- master
stage: deploy
script:
- ls
- docker build -t ${DOCKER_IMAGE}:latest .
- docker tag ${DOCKER_IMAGE}:latest ${DOCKER_IMAGE}:${CI_COMMIT_REF_NAME}
- docker login -p ${DOCKER_PASSWORD} -u ${DOCKER_USERNAME} ${DOCKER_REGISTRY}
- docker push ${DOCKER_IMAGE}:${CI_COMMIT_REF_NAME}
- docker push ${DOCKER_IMAGE}:latest

View File

@@ -40,6 +40,6 @@ docker-test:
-v ${CURDIR}:/go/src/gitlab-odx.oracle.com/odx/functions \ -v ${CURDIR}:/go/src/gitlab-odx.oracle.com/odx/functions \
-w /go/src/gitlab-odx.oracle.com/odx/functions \ -w /go/src/gitlab-odx.oracle.com/odx/functions \
funcy/go:dev go test \ funcy/go:dev go test \
-v $(shell docker run -ti -v ${CURDIR}:/go/src/gitlab-odx.oracle.com/odx/functions -w /go/src/gitlab-odx.oracle.com/odx/functions -e GOPATH=/go golang:alpine sh -c 'go list ./... | grep -v vendor | grep -v examples | grep -v tool | grep -v fn | grep -v datastore') -v $(shell docker run --rm -ti -v ${CURDIR}:/go/src/gitlab-odx.oracle.com/odx/functions -w /go/src/gitlab-odx.oracle.com/odx/functions -e GOPATH=/go golang:alpine sh -c 'go list ./... | grep -v vendor | grep -v examples | grep -v tool | grep -v fn')
all: dep build all: dep build

View File

@@ -1,4 +1,4 @@
# Oracle Functions # Oracle Functions [![build status](https://gitlab-odx.oracle.com/odx/functions/badges/master/build.svg)](https://gitlab-odx.oracle.com/odx/functions/commits/master)
<!-- [![GoDoc](https://godoc.org/github.com/treeder/functions?status.svg)](https://godoc.org/github.com/treeder/functions) --> <!-- [![GoDoc](https://godoc.org/github.com/treeder/functions?status.svg)](https://godoc.org/github.com/treeder/functions) -->

View File

@@ -4,46 +4,67 @@ import (
"bytes" "bytes"
"database/sql" "database/sql"
"fmt" "fmt"
"log"
"net/url" "net/url"
"os"
"os/exec" "os/exec"
"strconv"
"testing" "testing"
"time" "time"
"gitlab-odx.oracle.com/odx/functions/api/datastore/internal/datastoretest" "gitlab-odx.oracle.com/odx/functions/api/datastore/internal/datastoretest"
) )
const tmpMysql = "mysql://root:root@tcp(%v:3307)/funcs" const tmpMysql = "mysql://root:root@tcp(%s:%d)/funcs"
var (
mysqlHost = func() string {
host := os.Getenv("MYSQL_HOST")
if host == "" {
host = "127.0.0.1"
}
return host
}()
mysqlPort = func() int {
port := os.Getenv("MYSQL_PORT")
if port == "" {
port = "3307"
}
p, err := strconv.Atoi(port)
if err != nil {
panic(err)
}
return p
}()
)
func prepareMysqlTest(logf, fatalf func(string, ...interface{})) (func(), func()) { func prepareMysqlTest(logf, fatalf func(string, ...interface{})) (func(), func()) {
fmt.Println("initializing mysql for test") timeout := time.After(60 * time.Second)
tryRun(logf, "remove old mysql container", exec.Command("docker", "rm", "-f", "func-mysql-test"))
mustRun(fatalf, "start mysql container", exec.Command(
"docker", "run", "--name", "func-mysql-test", "-p", "3307:3306", "-e", "MYSQL_DATABASE=funcs",
"-e", "MYSQL_ROOT_PASSWORD=root", "-d", "mysql"))
maxWait := 16 * time.Second
wait := 2 * time.Second wait := 2 * time.Second
var db *sql.DB var db *sql.DB
var err error var err error
var buf bytes.Buffer
time.Sleep(time.Second * 25)
for { for {
db, err = sql.Open("mysql", fmt.Sprintf("root:root@tcp(%v:3307)/", db, err = sql.Open("mysql", fmt.Sprintf("root:root@tcp(%s:%v)/",
datastoretest.GetContainerHostIP())) mysqlHost, mysqlPort))
if err != nil { if err != nil {
if wait > maxWait { fmt.Fprintln(&buf, "failed to connect to mysql:", err)
fatalf("failed to connect to mysql after %d seconds", maxWait) fmt.Fprintln(&buf, "retrying in:", wait)
} else {
// Ping
if _, err = db.Exec("SELECT 1"); err == nil {
break break
} }
fmt.Println("failed to connect to mysql:", err) fmt.Fprintln(&buf, "failed to ping database:", err)
fmt.Println("retrying in:", wait) }
time.Sleep(wait) select {
case <-timeout:
fmt.Println(buf.String())
log.Fatal("timed out waiting for mysql")
case <-time.After(wait):
continue continue
} }
// Ping
if _, err = db.Exec("SELECT 1"); err != nil {
fmt.Println("failed to ping database:", err)
time.Sleep(wait)
continue
}
break
} }
_, err = db.Exec("DROP DATABASE IF EXISTS funcs;") _, err = db.Exec("DROP DATABASE IF EXISTS funcs;")
@@ -62,8 +83,8 @@ func prepareMysqlTest(logf, fatalf func(string, ...interface{})) (func(), func()
fmt.Println("mysql for test ready") fmt.Println("mysql for test ready")
return func() { return func() {
db, err := sql.Open("mysql", fmt.Sprintf("root:root@tcp(%v:3307)/", db, err := sql.Open("mysql", fmt.Sprintf("root:root@tcp(%s:%d)/",
datastoretest.GetContainerHostIP())) mysqlHost, mysqlPort))
if err != nil { if err != nil {
fatalf("failed to connect for truncation: %s\n", err) fatalf("failed to connect for truncation: %s\n", err)
} }
@@ -75,7 +96,7 @@ func prepareMysqlTest(logf, fatalf func(string, ...interface{})) (func(), func()
} }
}, },
func() { func() {
tryRun(logf, "stop mysql container", exec.Command("docker", "rm", "-f", "func-mysql-test")) tryRun(logf, "stop mysql container", exec.Command("docker", "rm", "-vf", "func-mysql-test"))
} }
} }
@@ -83,7 +104,7 @@ func TestDatastore(t *testing.T) {
_, close := prepareMysqlTest(t.Logf, t.Fatalf) _, close := prepareMysqlTest(t.Logf, t.Fatalf)
defer close() defer close()
u, err := url.Parse(fmt.Sprintf(tmpMysql, datastoretest.GetContainerHostIP())) u, err := url.Parse(fmt.Sprintf(tmpMysql, mysqlHost, mysqlPort))
if err != nil { if err != nil {
t.Fatalf("failed to parse url: %s\n", err) t.Fatalf("failed to parse url: %s\n", err)
} }

View File

@@ -4,53 +4,76 @@ import (
"bytes" "bytes"
"database/sql" "database/sql"
"fmt" "fmt"
"log"
"net/url" "net/url"
"os"
"os/exec" "os/exec"
"strconv"
"testing" "testing"
"time" "time"
"gitlab-odx.oracle.com/odx/functions/api/datastore/internal/datastoretest" "gitlab-odx.oracle.com/odx/functions/api/datastore/internal/datastoretest"
) )
const tmpPostgres = "postgres://postgres@%v:15432/funcs?sslmode=disable" const tmpPostgres = "postgres://postgres@%s:%d/funcs?sslmode=disable"
var (
postgresHost = func() string {
host := os.Getenv("POSTGRES_HOST")
if host == "" {
host = "127.0.0.1"
}
return host
}()
postgresPort = func() int {
port := os.Getenv("POSTGRES_PORT")
if port == "" {
port = "15432"
}
p, err := strconv.Atoi(port)
if err != nil {
panic(err)
}
return p
}()
)
func preparePostgresTest(logf, fatalf func(string, ...interface{})) (func(), func()) { func preparePostgresTest(logf, fatalf func(string, ...interface{})) (func(), func()) {
fmt.Println("initializing postgres for test") timeout := time.After(20 * time.Second)
tryRun(logf, "remove old postgres container", exec.Command("docker", "rm", "-f", "func-postgres-test")) wait := 500 * time.Millisecond
mustRun(fatalf, "start postgres container", exec.Command("docker", "run", "--name", "func-postgres-test", "-p", "15432:5432", "-d", "postgres"))
wait := 1 * time.Second
for { for {
db, err := sql.Open("postgres", fmt.Sprintf("postgres://postgres@%v:15432?sslmode=disable", db, err := sql.Open("postgres", fmt.Sprintf("postgres://postgres@%s:%d?sslmode=disable",
datastoretest.GetContainerHostIP())) postgresHost, postgresPort))
if err != nil { if err != nil {
fmt.Println("failed to connect to postgres:", err) fmt.Println("failed to connect to postgres:", err)
fmt.Println("retrying in:", wait) fmt.Println("retrying in:", wait)
time.Sleep(wait) } else {
wait = 2 * wait _, err = db.Exec(`CREATE DATABASE funcs;`)
continue if err != nil {
} fmt.Println("failed to create database:", err)
fmt.Println("retrying in:", wait)
_, err = db.Exec(`CREATE DATABASE funcs;`) } else {
if err != nil { _, err = db.Exec(`GRANT ALL PRIVILEGES ON DATABASE funcs TO postgres;`)
fmt.Println("failed to create database:", err) if err == nil {
fmt.Println("retrying in:", wait) break
time.Sleep(wait) }
wait = 2 * wait fmt.Println("failed to grant privileges:", err)
fmt.Println("retrying in:", wait)
}
}
select {
case <-timeout:
log.Fatal("timed out waiting for postgres")
case <-time.After(wait):
continue continue
} }
_, err = db.Exec(`GRANT ALL PRIVILEGES ON DATABASE funcs TO postgres;`)
if err == nil {
break
}
fmt.Println("failed to grant privileges:", err)
fmt.Println("retrying in:", wait)
time.Sleep(wait)
wait = 2 * wait
} }
fmt.Println("postgres for test ready") fmt.Println("postgres for test ready")
return func() { return func() {
db, err := sql.Open("postgres", fmt.Sprintf(tmpPostgres, datastoretest.GetContainerHostIP())) db, err := sql.Open("postgres", fmt.Sprintf(tmpPostgres, postgresHost, postgresPort))
if err != nil { if err != nil {
fatalf("failed to connect for truncation: %s\n", err) fatalf("failed to connect for truncation: %s\n", err)
} }
@@ -62,7 +85,7 @@ func preparePostgresTest(logf, fatalf func(string, ...interface{})) (func(), fun
} }
}, },
func() { func() {
tryRun(logf, "stop postgres container", exec.Command("docker", "rm", "-f", "func-postgres-test")) tryRun(logf, "stop postgres container", exec.Command("docker", "rm", "-fv", "func-postgres-test"))
} }
} }
@@ -70,7 +93,7 @@ func TestDatastore(t *testing.T) {
_, close := preparePostgresTest(t.Logf, t.Fatalf) _, close := preparePostgresTest(t.Logf, t.Fatalf)
defer close() defer close()
u, err := url.Parse(fmt.Sprintf(tmpPostgres, datastoretest.GetContainerHostIP())) u, err := url.Parse(fmt.Sprintf(tmpPostgres, postgresHost, postgresPort))
if err != nil { if err != nil {
t.Fatalf("failed to parse url: %v", err) t.Fatalf("failed to parse url: %v", err)
} }

View File

@@ -5,7 +5,9 @@ import (
"fmt" "fmt"
"log" "log"
"net/url" "net/url"
"os"
"os/exec" "os/exec"
"strconv"
"testing" "testing"
"time" "time"
@@ -13,16 +15,34 @@ import (
"gitlab-odx.oracle.com/odx/functions/api/datastore/internal/datastoretest" "gitlab-odx.oracle.com/odx/functions/api/datastore/internal/datastoretest"
) )
const tmpRedis = "redis://%v:6301/" const tmpRedis = "redis://%s:%d/"
var (
redisHost = func() string {
host := os.Getenv("REDIS_HOST")
if host == "" {
host = "127.0.0.1"
}
return host
}()
redisPort = func() int {
port := os.Getenv("REDIS_PORT")
if port == "" {
port = "6301"
}
p, err := strconv.Atoi(port)
if err != nil {
panic(err)
}
return p
}()
)
func prepareRedisTest(logf, fatalf func(string, ...interface{})) (func(), func()) { func prepareRedisTest(logf, fatalf func(string, ...interface{})) (func(), func()) {
fmt.Println("initializing redis for test")
tryRun(logf, "remove old redis container", exec.Command("docker", "rm", "-f", "func-redis-test"))
mustRun(fatalf, "start redis container", exec.Command("docker", "run", "--name", "func-redis-test", "-p", "6301:6379", "-d", "redis"))
timeout := time.After(20 * time.Second) timeout := time.After(20 * time.Second)
for { for {
c, err := redis.DialURL(fmt.Sprintf(tmpRedis, datastoretest.GetContainerHostIP())) c, err := redis.DialURL(fmt.Sprintf(tmpRedis, redisHost, redisPort))
if err == nil { if err == nil {
_, err = c.Do("PING") _, err = c.Do("PING")
c.Close() c.Close()
@@ -41,7 +61,7 @@ func prepareRedisTest(logf, fatalf func(string, ...interface{})) (func(), func()
fmt.Println("redis for test ready") fmt.Println("redis for test ready")
return func() {}, return func() {},
func() { func() {
tryRun(logf, "stop redis container", exec.Command("docker", "rm", "-f", "func-redis-test")) tryRun(logf, "stop redis container", exec.Command("docker", "rm", "-fv", "func-redis-test"))
} }
} }
@@ -49,7 +69,7 @@ func TestDatastore(t *testing.T) {
_, close := prepareRedisTest(t.Logf, t.Fatalf) _, close := prepareRedisTest(t.Logf, t.Fatalf)
defer close() defer close()
u, err := url.Parse(fmt.Sprintf(tmpRedis, datastoretest.GetContainerHostIP())) u, err := url.Parse(fmt.Sprintf(tmpRedis, redisHost, redisPort))
if err != nil { if err != nil {
t.Fatal("failed to parse url: ", err) t.Fatal("failed to parse url: ", err)
} }

145
fn/glide.lock generated
View File

@@ -1,14 +1,10 @@
hash: 6b12a9176a923d8bc91e738c26d3e6ae32ca478f1f1ddc3d169ac91a13f2c559 hash: dc83b968dd779a3e5e087c8a0b03a5299f93673a704b60d148aba71c61532222
updated: 2017-06-06T19:42:36.259550031+03:00 updated: 2017-06-08T18:22:18.92183221-07:00
imports: imports:
- name: code.cloudfoundry.org/bytefmt
version: b12c1522f4cbb5f35861bd5dd2c39a4fa996441a
- name: github.com/amir/raidman
version: c74861fe6a7bb8ede0a010ce4485bdbb4fc4c985
- name: github.com/asaskevich/govalidator - name: github.com/asaskevich/govalidator
version: 7b3beb6df3c42abd3509abfc3bcacc0fbfb7c877 version: aa5cce4a76edb1a5acecab1870c17abbffb5419e
- name: github.com/aws/aws-sdk-go - name: github.com/aws/aws-sdk-go
version: 90dec2183a5f5458ee79cbaf4b8e9ab910bc81a6 version: c48c76c996d07c48cddab11a21971c299203d8c1
subpackages: subpackages:
- aws - aws
- aws/awserr - aws/awserr
@@ -18,123 +14,82 @@ imports:
- aws/corehandlers - aws/corehandlers
- aws/credentials - aws/credentials
- aws/credentials/ec2rolecreds - aws/credentials/ec2rolecreds
- aws/credentials/endpointcreds
- aws/credentials/stscreds
- aws/defaults - aws/defaults
- aws/ec2metadata - aws/ec2metadata
- aws/endpoints
- aws/request - aws/request
- aws/session - aws/session
- aws/signer/v4 - aws/signer/v4
- private/endpoints - internal/shareddefaults
- private/protocol - private/protocol
- private/protocol/json/jsonutil - private/protocol/json/jsonutil
- private/protocol/jsonrpc - private/protocol/jsonrpc
- private/protocol/query
- private/protocol/query/queryutil
- private/protocol/rest - private/protocol/rest
- private/protocol/restjson - private/protocol/restjson
- private/protocol/xml/xmlutil
- service/lambda - service/lambda
- service/sts
- name: github.com/Azure/go-ansiterm - name: github.com/Azure/go-ansiterm
version: fa152c58bc15761d0200cb75fe958b89a9d4888e version: fa152c58bc15761d0200cb75fe958b89a9d4888e
subpackages: subpackages:
- winterm - winterm
- name: github.com/boltdb/bolt
version: 0d9f544bb94aac29c185968483459ef74d6deb5d
- name: github.com/cactus/go-statsd-client
version: 91c326c3f7bd20f0226d3d1c289dd9f8ce28d33d
subpackages:
- statsd
- name: github.com/ccirello/supervisor
version: 341cd52503c550c397196693601273cc290cf1b4
- name: github.com/coreos/go-semver - name: github.com/coreos/go-semver
version: 9474efc580562cce8f761659fbce31b6feb8ce88 version: 8ab6407b697782a06568d4b7f1db25550ec2e4c6
subpackages: subpackages:
- semver - semver
- name: github.com/dchest/siphash
version: 4ebf1de738443ea7f45f02dc394c4df1942a126d
- name: github.com/dghubble/go-twitter
version: f310dcebe0ae1f6b73165caed281f87768c15780
subpackages:
- twitter
- name: github.com/dghubble/oauth1
version: 4385816142116aade2d97d0f320f9d3666e74cd9
- name: github.com/dgrijalva/jwt-go
version: 9ed569b5d1ac936e6494082958d63a6aa4fff99a
- name: github.com/docker/cli
version: ed5b66308222511bd9e2e4e7e2c278d9887d0142
subpackages:
- cli/config/configfile
- name: github.com/docker/distribution
version: 99cb7c0946d2f5a38015443e515dc916295064d7
subpackages:
- manifest/schema1
- name: github.com/docker/docker - name: github.com/docker/docker
version: fddb5a7f2ab29be441bc797f7e79fffc5cc531d3 version: 1a2d2f75f42696d295392b939346ed4a36ac0bfc
subpackages: subpackages:
- pkg/jsonlog - pkg/jsonlog
- pkg/term - pkg/term
- pkg/term/windows - pkg/term/windows
- name: github.com/docker/go-units - name: github.com/docker/go-units
version: e30f1e79f3cd72542f2026ceec18d3bd67ab859c version: 0dadbb0345b35ec7ef35e228dabb8de89a65bf52
- name: github.com/fsouza/go-dockerclient
version: fbeb72ccd29aa2596f364a5a85af622c651c3e16
- name: github.com/funcy/functions_go - name: github.com/funcy/functions_go
version: 6ab40fd04a355106389f52a5a3815b1b771b18c7 version: 3b83bbd98c2a5909eea3ccfafe3730a9822d15ee
subpackages: subpackages:
- client - client
- client/apps - client/apps
- client/call
- client/routes - client/routes
- client/tasks - client/tasks
- client/version - client/version
- models - models
- name: github.com/garyburd/redigo
version: 0708def8b0cf3a05acdf44a7f28b864c2958921d
subpackages:
- redis
- name: github.com/giantswarm/semver-bump - name: github.com/giantswarm/semver-bump
version: 7ec6ac8985c24dd50b4942f9a908d13cdfe70f23 version: 88e6c9f2fe390c48839eaba32490fd09cb3b581c
subpackages: subpackages:
- bump - bump
- storage - storage
- name: github.com/gin-gonic/gin
version: e2212d40c62a98b388a5eb48ecbdcf88534688ba
- name: github.com/go-ini/ini - name: github.com/go-ini/ini
version: 2ba15ac2dc9cdf88c110ec2dc0ced7fa45f5678c version: d3de07a94d22b4a0972deb4b96d790c2c0ce8333
- name: github.com/go-openapi/analysis - name: github.com/go-openapi/analysis
version: 7222828b8ce19afee3c595aef6643b9e42150120 version: 0473cb67199f68b8b7d90e641afd9e79ad36b851
- name: github.com/go-openapi/errors - name: github.com/go-openapi/errors
version: 49fe8b3a0e0d32a617d8d50c67f856ad6e45b28b version: 03cfca65330da08a5a440053faf994a3c682b5bf
- name: github.com/go-openapi/jsonpointer - name: github.com/go-openapi/jsonpointer
version: 8d96a2dc61536b690bd36b2e9df0b3c0b62825b2 version: 779f45308c19820f1a69e9a4cd965f496e0da10f
- name: github.com/go-openapi/jsonreference - name: github.com/go-openapi/jsonreference
version: 36d33bfe519efae5632669801b180bf1a245da3b version: 36d33bfe519efae5632669801b180bf1a245da3b
- name: github.com/go-openapi/loads - name: github.com/go-openapi/loads
version: 315567415dfd74b651f7a62cabfc82a57ed7b9ad version: a80dea3052f00e5f032e860dd7355cd0cc67e24d
subpackages:
- fmts
- name: github.com/go-openapi/runtime - name: github.com/go-openapi/runtime
version: 14b161b40ece9dac8e244ab2fde2d209e108c6f5 version: 2e9e988df6c290425033bacd425e008950c96be6
subpackages: subpackages:
- client - client
- name: github.com/go-openapi/spec - name: github.com/go-openapi/spec
version: f7ae86df5bc115a2744343016c789a89f065a4bd version: e81a13315ac92ce3e73075856c5cd50301695405
- name: github.com/go-openapi/strfmt - name: github.com/go-openapi/strfmt
version: 34fc3ba7c0f5fb615fda47a2b4fbd4c641b215f2 version: 93a31ef21ac23f317792fff78f9539219dd74619
- name: github.com/go-openapi/swag - name: github.com/go-openapi/swag
version: 3b6d86cd965820f968760d5d419cb4add096bdd7 version: f3f9494671f93fcff853e3c6e9e948b3eb71e590
- name: github.com/go-openapi/validate - name: github.com/go-openapi/validate
version: 027696d4b54399770f1cdcc6c6daa56975f9e14e version: 035dcd74f1f61e83debe1c22950dc53556e7e4b2
- name: github.com/go-resty/resty - name: github.com/go-resty/resty
version: 24dc7ba4bc1ef9215048b28e7248f99c42901db5 version: 7a8134d8718193eb857994adee49d73a302e7718
- name: github.com/go-sql-driver/mysql
version: a0583e0143b1624142adab07e0e97fe106d99561
- name: github.com/google/btree
version: 0c3044bc8bada22db67b93f5760fe3f05d6a5c25
- name: github.com/heroku/docker-registry-client
version: 36bd5f538a6b9e70f2d863c9a8f6bf955a98eddc
subpackages:
- registry
- name: github.com/iron-io/iron_go3
version: b50ecf8ff90187fc5fabccd9d028dd461adce4ee
subpackages:
- config
- mq
- name: github.com/jmespath/go-jmespath - name: github.com/jmespath/go-jmespath
version: bd40a432e4c76585ef6b72d3fd96fb9b6dc7b68d version: bd40a432e4c76585ef6b72d3fd96fb9b6dc7b68d
- name: github.com/jmoiron/jsonq - name: github.com/jmoiron/jsonq
@@ -143,65 +98,53 @@ imports:
version: 08cceb5d0b5331634b9826762a8fd53b29b86ad8 version: 08cceb5d0b5331634b9826762a8fd53b29b86ad8
subpackages: subpackages:
- errors - errors
- name: github.com/lib/pq
version: 4a82388ebc5138c8289fe9bc602cb0b3e32cd617
- name: github.com/mailru/easyjson - name: github.com/mailru/easyjson
version: 159cdb893c982e3d1bc6450322fedd514f9c9de3 version: 44c0351a5bc860bcb2608d54aa03ea686c4e7b25
subpackages: subpackages:
- buffer - buffer
- jlexer - jlexer
- jwriter - jwriter
- name: github.com/mitchellh/mapstructure - name: github.com/mitchellh/mapstructure
version: f3009df150dadf309fdee4a54ed65c124afad715 version: d0303fe809921458f417bcf828397a65db30a7e4
- name: github.com/moby/moby - name: github.com/moby/moby
version: c8141a1fb1ff33b2bfab85a40e5da9a282f36cdc version: 90d35abf7b3535c1c319c872900fbd76374e521c
subpackages: subpackages:
- pkg/jsonmessage - pkg/jsonmessage
- name: github.com/Nvveen/Gotty - name: github.com/Nvveen/Gotty
version: cd527374f1e5bff4938207604a14f2e38a9cf512 version: cd527374f1e5bff4938207604a14f2e38a9cf512
- name: github.com/pkg/errors
version: 248dadf4e9068a0b3e79f02ed0a610d935de5302
- name: github.com/PuerkitoBio/purell - name: github.com/PuerkitoBio/purell
version: 0bcb03f4b4d0a9428594752bd2a3b9aa0a9d4bd4 version: b938d81255b5473c57635324295cb0fe398c7a58
- name: github.com/PuerkitoBio/urlesc - name: github.com/PuerkitoBio/urlesc
version: 5bd2802263f21d8788851d5305584c82a5c75d7e version: bbf7a2afc14f93e1e0a5c06df524fbd75e5031e5
- name: github.com/satori/go.uuid
version: 879c5887cd475cd7864858769793b2ceb0d44feb
- name: github.com/Sirupsen/logrus - name: github.com/Sirupsen/logrus
version: 0208149b40d863d2c1a2f8fe5753096a9cf2cc8b version: ba1b36c82c5e05c4f912a88eab0dcd91a171688f
subpackages:
- hooks/syslog
- name: github.com/spf13/viper
version: 5ed0fc31f7f453625df314d8e66b9791e8d13003
- name: github.com/urfave/cli - name: github.com/urfave/cli
version: 0bdeddeeb0f650497d603c4ad7b20cfe685682f6 version: 0bdeddeeb0f650497d603c4ad7b20cfe685682f6
- name: golang.org/x/crypto
version: c10c31b5e94b6f7a0283272dc2bb27163dcea24b
subpackages:
- bcrypt
- name: golang.org/x/net - name: golang.org/x/net
version: f315505cf3349909cdf013ea56690da34e96a451 version: 59a0b19b5533c7977ddeb86b017bf507ed407b12
subpackages: subpackages:
- context - context
- context/ctxhttp - context/ctxhttp
- idna - idna
- publicsuffix - publicsuffix
- name: golang.org/x/sys - name: golang.org/x/sys
version: 478fcf54317e52ab69f40bb4c7a1520288d7f7ea version: 0b25a408a50076fbbcae6b7ac0ea5fbb0b085e79
subpackages: subpackages:
- unix - unix
- windows
- name: golang.org/x/text - name: golang.org/x/text
version: 5c6cf4f9a2357d38515014cea8c488ed22bdab90 version: eae24e7440a7aee8476ea69a0c574eafb42f5839
subpackages: subpackages:
- secure/bidirule
- transform - transform
- unicode/bidi
- unicode/norm - unicode/norm
- width - width
- name: gopkg.in/mgo.v2 - name: gopkg.in/mgo.v2
version: 3f83fa5005286a7fe593b055f0d7771a7dce4655 version: 3f83fa5005286a7fe593b055f0d7771a7dce4655
subpackages: subpackages:
- bson - bson
- internal/json
- name: gopkg.in/yaml.v2 - name: gopkg.in/yaml.v2
version: bef53efd0c76e49e6de55ead051f886bea7e9420 version: cd8b52f8269e0feb286dfeef29f8fe4d5b397e0b
testImports: testImports: []
- name: github.com/vrischmann/envconfig
version: 757beaaeac8d14bcc7ea3f71488d65cf45cf2eff

39
fn/glide.yaml Normal file
View File

@@ -0,0 +1,39 @@
package: gitlab-odx.oracle.com/odx/functions/fn
import:
- package: github.com/Sirupsen/logrus
version: ^0.11.5
- package: github.com/aws/aws-sdk-go
version: ^1.8.36
subpackages:
- aws
- aws/credentials
- aws/session
- service/lambda
- package: github.com/coreos/go-semver
version: ^0.2.0
subpackages:
- semver
- package: github.com/funcy/functions_go
subpackages:
- client
- client/apps
- client/call
- client/routes
- models
- package: github.com/giantswarm/semver-bump
version: ^1.1.1
subpackages:
- bump
- storage
- package: github.com/go-openapi/runtime
subpackages:
- client
- package: github.com/go-openapi/strfmt
- package: github.com/jmoiron/jsonq
- package: github.com/moby/moby
version: ^17.5.0-ce-rc3
subpackages:
- pkg/jsonmessage
- package: github.com/urfave/cli
version: ^1.19.1
- package: gopkg.in/yaml.v2

2
glide.lock generated
View File

@@ -115,7 +115,7 @@ imports:
- name: github.com/fsnotify/fsnotify - name: github.com/fsnotify/fsnotify
version: 4da3e2cfbabc9f751898f250b49f2439785783a1 version: 4da3e2cfbabc9f751898f250b49f2439785783a1
- name: github.com/fsouza/go-dockerclient - name: github.com/fsouza/go-dockerclient
version: fbeb72ccd29aa2596f364a5a85af622c651c3e16 version: c933ed18bef34ec2955de03de8ef9a3bb996e3df
- name: github.com/funcy/functions_go - name: github.com/funcy/functions_go
version: 6ab40fd04a355106389f52a5a3815b1b771b18c7 version: 6ab40fd04a355106389f52a5a3815b1b771b18c7
subpackages: subpackages:

35
test.sh
View File

@@ -2,7 +2,37 @@
set -ex set -ex
docker rm -fv func-postgres-test || echo No prev test db container
docker run --name func-postgres-test -p 15432:5432 -d postgres
docker rm -fv func-mysql-test || echo No prev mysql test db container
docker run --name func-mysql-test -p 3307:3306 -e MYSQL_DATABASE=funcs -e MYSQL_ROOT_PASSWORD=root -d mysql
docker rm -fv func-redis-test|| echo No prev redis test db container
docker run --name func-redis-test -p 6301:6379 -d redis
sleep 5
if [ `uname` == "Darwin" ]
then
export POSTGRES_HOST=localhost
export POSTGRES_PORT=15432
export MYSQL_HOST=localhost
export MYSQL_PORT=3307
export REDIS_HOST=localhost
export REDIS_PORT=6301
else
export POSTGRES_HOST="$(docker inspect -f '{{.NetworkSettings.IPAddress}}' func-postgres-test)"
export POSTGRES_PORT=5432
export MYSQL_HOST="$(docker inspect -f '{{.NetworkSettings.IPAddress}}' func-mysql-test)"
export MYSQL_PORT=3306
export REDIS_HOST="$(docker inspect -f '{{.NetworkSettings.IPAddress}}' func-redis-test)"
export REDIS_PORT=6379
fi
go test -v $(go list ./... | grep -v vendor | grep -v examples | grep -v tool | grep -v fn) go test -v $(go list ./... | grep -v vendor | grep -v examples | grep -v tool | grep -v fn)
# go test -v gitlab-odx.oracle.com/odx/functions/api/runner/drivers/docker
cd fn && make build && make test cd fn && make build && make test
# TODO: should we install fn here to use throughout? # TODO: should we install fn here to use throughout?
export FN="$(pwd)/fn" export FN="$(pwd)/fn"
@@ -10,5 +40,6 @@ cd ..
# TODO: Test a bunch of the examples using fn test when ready # TODO: Test a bunch of the examples using fn test when ready
# checker tests env vars # checker tests env vars
cd examples/checker # TODO: Fix checker tests behind proxy...
./test.sh # cd examples/checker
# ./test.sh