Merge branch 'deploy_sh' into 'master'

Deploy sh

See merge request !46
This commit is contained in:
Reed Allman
2017-06-09 13:42:59 -07:00
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 \
-w /go/src/gitlab-odx.oracle.com/odx/functions \
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

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) -->
@@ -24,9 +24,9 @@ platform that you can run anywhere. Some of it's key features:
## Usage
### Installation (if running locally)
### Installation (if running locally)
NOTE: The following instructions apply while the project is a private repo. This will
NOTE: The following instructions apply while the project is a private repo. This will
build the Functions server and the CLI tool directly from the repo instead of
using pre-built containers. Once the project is public, these steps will be unnecessary.
@@ -58,7 +58,7 @@ Download the pre-built CLI binary:
4. chmod +x
<!-- ADD BACK ONCE PUBLIC
<!-- ADD BACK ONCE PUBLIC
### Install CLI tool
@@ -125,7 +125,7 @@ curl http://localhost:8080/r/myapp/hello
Or in a browser: [http://localhost:8080/r/myapp/hello](http://localhost:8080/r/myapp/hello)
That's it! You just deployed your first function and called it. Now to update your function
That's it! You just deployed your first function and called it. Now to update your function
you can update your code and run `fn deploy myapp` again.
## To Learn More

View File

@@ -4,46 +4,67 @@ import (
"bytes"
"database/sql"
"fmt"
"log"
"net/url"
"os"
"os/exec"
"strconv"
"testing"
"time"
"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()) {
fmt.Println("initializing mysql for test")
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
timeout := time.After(60 * time.Second)
wait := 2 * time.Second
var db *sql.DB
var err error
var buf bytes.Buffer
time.Sleep(time.Second * 25)
for {
db, err = sql.Open("mysql", fmt.Sprintf("root:root@tcp(%v:3307)/",
datastoretest.GetContainerHostIP()))
db, err = sql.Open("mysql", fmt.Sprintf("root:root@tcp(%s:%v)/",
mysqlHost, mysqlPort))
if err != nil {
if wait > maxWait {
fatalf("failed to connect to mysql after %d seconds", maxWait)
fmt.Fprintln(&buf, "failed to connect to mysql:", err)
fmt.Fprintln(&buf, "retrying in:", wait)
} else {
// Ping
if _, err = db.Exec("SELECT 1"); err == nil {
break
}
fmt.Println("failed to connect to mysql:", err)
fmt.Println("retrying in:", wait)
time.Sleep(wait)
fmt.Fprintln(&buf, "failed to ping database:", err)
}
select {
case <-timeout:
fmt.Println(buf.String())
log.Fatal("timed out waiting for mysql")
case <-time.After(wait):
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;")
@@ -62,8 +83,8 @@ func prepareMysqlTest(logf, fatalf func(string, ...interface{})) (func(), func()
fmt.Println("mysql for test ready")
return func() {
db, err := sql.Open("mysql", fmt.Sprintf("root:root@tcp(%v:3307)/",
datastoretest.GetContainerHostIP()))
db, err := sql.Open("mysql", fmt.Sprintf("root:root@tcp(%s:%d)/",
mysqlHost, mysqlPort))
if err != nil {
fatalf("failed to connect for truncation: %s\n", err)
}
@@ -75,7 +96,7 @@ func prepareMysqlTest(logf, fatalf func(string, ...interface{})) (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)
defer close()
u, err := url.Parse(fmt.Sprintf(tmpMysql, datastoretest.GetContainerHostIP()))
u, err := url.Parse(fmt.Sprintf(tmpMysql, mysqlHost, mysqlPort))
if err != nil {
t.Fatalf("failed to parse url: %s\n", err)
}

View File

@@ -4,53 +4,76 @@ import (
"bytes"
"database/sql"
"fmt"
"log"
"net/url"
"os"
"os/exec"
"strconv"
"testing"
"time"
"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()) {
fmt.Println("initializing postgres for test")
tryRun(logf, "remove old postgres container", exec.Command("docker", "rm", "-f", "func-postgres-test"))
mustRun(fatalf, "start postgres container", exec.Command("docker", "run", "--name", "func-postgres-test", "-p", "15432:5432", "-d", "postgres"))
timeout := time.After(20 * time.Second)
wait := 500 * time.Millisecond
wait := 1 * time.Second
for {
db, err := sql.Open("postgres", fmt.Sprintf("postgres://postgres@%v:15432?sslmode=disable",
datastoretest.GetContainerHostIP()))
db, err := sql.Open("postgres", fmt.Sprintf("postgres://postgres@%s:%d?sslmode=disable",
postgresHost, postgresPort))
if err != nil {
fmt.Println("failed to connect to postgres:", err)
fmt.Println("retrying in:", wait)
time.Sleep(wait)
wait = 2 * wait
continue
}
} else {
_, err = db.Exec(`CREATE DATABASE funcs;`)
if err != nil {
fmt.Println("failed to create database:", err)
fmt.Println("retrying in:", wait)
_, err = db.Exec(`CREATE DATABASE funcs;`)
if err != nil {
fmt.Println("failed to create database:", err)
fmt.Println("retrying in:", wait)
time.Sleep(wait)
wait = 2 * wait
} else {
_, 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)
}
}
select {
case <-timeout:
log.Fatal("timed out waiting for postgres")
case <-time.After(wait):
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")
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 {
fatalf("failed to connect for truncation: %s\n", err)
}
@@ -62,7 +85,7 @@ func preparePostgresTest(logf, fatalf func(string, ...interface{})) (func(), fun
}
},
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)
defer close()
u, err := url.Parse(fmt.Sprintf(tmpPostgres, datastoretest.GetContainerHostIP()))
u, err := url.Parse(fmt.Sprintf(tmpPostgres, postgresHost, postgresPort))
if err != nil {
t.Fatalf("failed to parse url: %v", err)
}

View File

@@ -5,7 +5,9 @@ import (
"fmt"
"log"
"net/url"
"os"
"os/exec"
"strconv"
"testing"
"time"
@@ -13,16 +15,34 @@ import (
"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()) {
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)
for {
c, err := redis.DialURL(fmt.Sprintf(tmpRedis, datastoretest.GetContainerHostIP()))
c, err := redis.DialURL(fmt.Sprintf(tmpRedis, redisHost, redisPort))
if err == nil {
_, err = c.Do("PING")
c.Close()
@@ -41,7 +61,7 @@ func prepareRedisTest(logf, fatalf func(string, ...interface{})) (func(), func()
fmt.Println("redis for test ready")
return 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)
defer close()
u, err := url.Parse(fmt.Sprintf(tmpRedis, datastoretest.GetContainerHostIP()))
u, err := url.Parse(fmt.Sprintf(tmpRedis, redisHost, redisPort))
if err != nil {
t.Fatal("failed to parse url: ", err)
}

145
fn/glide.lock generated
View File

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

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
version: 4da3e2cfbabc9f751898f250b49f2439785783a1
- name: github.com/fsouza/go-dockerclient
version: fbeb72ccd29aa2596f364a5a85af622c651c3e16
version: c933ed18bef34ec2955de03de8ef9a3bb996e3df
- name: github.com/funcy/functions_go
version: 6ab40fd04a355106389f52a5a3815b1b771b18c7
subpackages:

35
test.sh
View File

@@ -2,7 +2,37 @@
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 gitlab-odx.oracle.com/odx/functions/api/runner/drivers/docker
cd fn && make build && make test
# TODO: should we install fn here to use throughout?
export FN="$(pwd)/fn"
@@ -10,5 +40,6 @@ cd ..
# TODO: Test a bunch of the examples using fn test when ready
# checker tests env vars
cd examples/checker
./test.sh
# TODO: Fix checker tests behind proxy...
# cd examples/checker
# ./test.sh