mirror of
https://github.com/fnproject/fn.git
synced 2022-10-28 21:29:17 +03:00
Boom, circle good to go, releases on commits to master too (#7)
* circle * circle * circle * circle * circle * CIRCLE * circle * circle * circle * circle * circle * circle * circle * circle * circle * circle * cijrcle * circle * circle * circle * circle * c * c * circle * testing release * circle * trying release * c * c * functions: 0.3.25 release [skip ci] * c * functions: 0.3.26 release [skip ci] * fn tool: 0.3.19 release [skip ci] * testing cli release only * fn tool: 0.3.20 release [skip ci] * fn tool: 0.3.21 release [skip ci] * hopefully the last thing * fn tool: 0.3.22 release [skip ci] * c * fn tool: 0.3.23 release [skip ci] * almost there.... * fn tool: 0.3.24 release [skip ci] * fnlb: 0.0.2 release [skip ci] * fn tool: 0.3.25 release [skip ci] * fnlb: 0.0.3 release [skip ci] * Added back in commented out lines. * Fixing middleware example.
This commit is contained in:
@@ -1,38 +1,41 @@
|
||||
# Golang CircleCI 2.0 configuration file
|
||||
#
|
||||
# Check https://circleci.com/docs/2.0/language-go/ for more details
|
||||
version: 2
|
||||
jobs:
|
||||
build:
|
||||
machine: true
|
||||
working_directory: /go/src/github.com/{{ORG_NAME}}/{{REPO_NAME}}
|
||||
working_directory: ~/go/src/github.com/fnproject/fn
|
||||
environment: # apparently expansion doesn't work here yet: https://discuss.circleci.com/t/environment-variable-expansion-in-working-directory/11322
|
||||
- GOPATH=/home/circleci/go
|
||||
- GOVERSION=1.8.3
|
||||
- OS=linux
|
||||
- ARCH=amd64
|
||||
steps:
|
||||
- checkout
|
||||
# update docker
|
||||
- run: docker version
|
||||
- run: sudo service docker stop
|
||||
- run: curl -fsSL https://get.docker.com/ | sudo sh
|
||||
# update Go
|
||||
- run: |
|
||||
go version
|
||||
go env GOROOT
|
||||
mkdir tmp
|
||||
cd tmp
|
||||
sudo rm -rf /usr/local/go
|
||||
wget https://storage.googleapis.com/golang/go$GOVERSION.$OS-$ARCH.tar.gz
|
||||
# mkdir -p $HOME/golang
|
||||
# tar -C $HOME/golang -xzf go1.8.3.linux-amd64.tar.gz
|
||||
sudo tar -C /usr/local -xzf go$GOVERSION.$OS-$ARCH.tar.gz
|
||||
go get -u github.com/golang/dep/...
|
||||
- run: go version
|
||||
# update Docker
|
||||
- run: |
|
||||
docker version
|
||||
sudo service docker stop
|
||||
curl -fsSL https://get.docker.com/ | sudo sh
|
||||
- run: docker version
|
||||
- run: ./test.sh
|
||||
|
||||
|
||||
# docker:
|
||||
# # specify the version
|
||||
# - image: circleci/golang:1.8
|
||||
|
||||
# # Specify service dependencies here if necessary
|
||||
# # CircleCI maintains a library of pre-built images
|
||||
# # documented at https://circleci.com/docs/2.0/circleci-images/
|
||||
# # - image: circleci/postgres:9.4
|
||||
|
||||
# #### TEMPLATE_NOTE: go expects specific checkout path representing url
|
||||
# #### expecting it in the form of
|
||||
# #### /go/src/github.com/circleci/go-tool
|
||||
# #### /go/src/bitbucket.org/circleci/go-tool
|
||||
# working_directory: /go/src/github.com/{{ORG_NAME}}/{{REPO_NAME}}
|
||||
# steps:
|
||||
# - checkout
|
||||
|
||||
# # specify any bash command here prefixed with `run: `
|
||||
# # - run: go get -v -t -d ./...
|
||||
# - run: ./test.sh
|
||||
- deploy:
|
||||
command: |
|
||||
if [ "${CIRCLE_BRANCH}" == "master" ]; then
|
||||
git config --global user.email "ci@fnproject.com"
|
||||
git config --global user.name "CI"
|
||||
git branch --set-upstream-to=origin/${CIRCLE_BRANCH} ${CIRCLE_BRANCH}
|
||||
docker login -u $DOCKER_USER -p $DOCKER_PASS
|
||||
./release.sh
|
||||
fi
|
||||
|
||||
1
.gitignore
vendored
1
.gitignore
vendored
@@ -23,3 +23,4 @@ private.sh
|
||||
data/
|
||||
.vscode/
|
||||
fn/func.yaml
|
||||
tmp/
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
package version
|
||||
|
||||
// Version of Functions
|
||||
var Version = "0.3.24"
|
||||
var Version = "0.3.26"
|
||||
|
||||
@@ -39,32 +39,16 @@ git push
|
||||
git push origin $tag
|
||||
|
||||
# For GitHub
|
||||
# url='https://api.github.com/repos/treeder/functions/releases'
|
||||
# output=$(curl -s -u $GH_DEPLOY_USER:$GH_DEPLOY_KEY -d "{\"tag_name\": \"$version\", \"name\": \"$version\"}" $url)
|
||||
# upload_url=$(echo "$output" | python -c 'import json,sys;obj=json.load(sys.stdin);print obj["upload_url"]' | sed -E "s/\{.*//")
|
||||
# html_url=$(echo "$output" | python -c 'import json,sys;obj=json.load(sys.stdin);print obj["html_url"]')
|
||||
# curl --data-binary "@fn_linux" -H "Content-Type: application/octet-stream" -u $GH_DEPLOY_USER:$GH_DEPLOY_KEY $upload_url\?name\=fn_linux >/dev/null
|
||||
# curl --data-binary "@fn_mac" -H "Content-Type: application/octet-stream" -u $GH_DEPLOY_USER:$GH_DEPLOY_KEY $upload_url\?name\=fn_mac >/dev/null
|
||||
# curl --data-binary "@fn.exe" -H "Content-Type: application/octet-stream" -u $GH_DEPLOY_USER:$GH_DEPLOY_KEY $upload_url\?name\=fn.exe >/dev/null
|
||||
|
||||
# For GitLab
|
||||
# 1) Upload files: https://docs.gitlab.com/ee/api/projects.html#upload-a-file
|
||||
upload_url='https://gitlab-odx.oracle.com/api/v3/projects/9/uploads'
|
||||
output=$(curl --request POST --form "file=@fn_linux" --header "PRIVATE-TOKEN: $GITLAB_TOKEN" $upload_url)
|
||||
linux_markdown=$(echo "$output" | python -c 'import json,sys;obj=json.load(sys.stdin);print obj["markdown"]')
|
||||
output=$(curl --request POST --form "file=@fn_mac" --header "PRIVATE-TOKEN: $GITLAB_TOKEN" $upload_url)
|
||||
mac_markdown=$(echo "$output" | python -c 'import json,sys;obj=json.load(sys.stdin);print obj["markdown"]')
|
||||
output=$(curl --request POST --form "file=@fn.exe" --header "PRIVATE-TOKEN: $GITLAB_TOKEN" $upload_url)
|
||||
win_markdown=$(echo "$output" | python -c 'import json,sys;obj=json.load(sys.stdin);print obj["markdown"]')
|
||||
output=$(curl --request POST --form "file=@fn_alpine" --header "PRIVATE-TOKEN: $GITLAB_TOKEN" $upload_url)
|
||||
alpine_markdown=$(echo "$output" | python -c 'import json,sys;obj=json.load(sys.stdin);print obj["markdown"]')
|
||||
|
||||
# 2) Create a release: https://docs.gitlab.com/ee/api/tags.html#create-a-new-release
|
||||
release_url="https://gitlab-odx.oracle.com/api/v3/projects/9/repository/tags/$tag/release"
|
||||
release_desc="Awesome release, much Wow\n\nfn for Linux: $linux_markdown \n\nfn for Mac: $mac_markdown \n\nfn for Windows: $win_markdown \n\nfn for Alpine: $alpine_markdown"
|
||||
curl --request POST -H "PRIVATE-TOKEN: $GITLAB_TOKEN" -H "Content-Type: application/json" -d "{\"tag_name\": \"$tag\", \"description\": \"$release_desc\"}" $release_url
|
||||
url='https://api.github.com/repos/fnproject/fn/releases'
|
||||
output=$(curl -s -u $GH_DEPLOY_USER:$GH_DEPLOY_KEY -d "{\"tag_name\": \"$version\", \"name\": \"$version\"}" $url)
|
||||
upload_url=$(echo "$output" | python -c 'import json,sys;obj=json.load(sys.stdin);print obj["upload_url"]' | sed -E "s/\{.*//")
|
||||
html_url=$(echo "$output" | python -c 'import json,sys;obj=json.load(sys.stdin);print obj["html_url"]')
|
||||
curl --data-binary "@fn_linux" -H "Content-Type: application/octet-stream" -u $GH_DEPLOY_USER:$GH_DEPLOY_KEY $upload_url\?name\=fn_linux >/dev/null
|
||||
curl --data-binary "@fn_mac" -H "Content-Type: application/octet-stream" -u $GH_DEPLOY_USER:$GH_DEPLOY_KEY $upload_url\?name\=fn_mac >/dev/null
|
||||
curl --data-binary "@fn.exe" -H "Content-Type: application/octet-stream" -u $GH_DEPLOY_USER:$GH_DEPLOY_KEY $upload_url\?name\=fn.exe >/dev/null
|
||||
|
||||
# TODO: Add the download URLS to install.sh. Maybe we should make a template to generate install.sh
|
||||
# TODO: Download URL's are in the output vars above under "url". Eg: "url":"/uploads/9a1848c5ebf2b83f8b055ac0e50e5232/fn.exe"
|
||||
# sed "s/release=.*/release=\"$version\"/g" fn/install.sh > fn/install.sh.tmp
|
||||
# mv fn/install.sh.tmp fn/install.sh
|
||||
# sed "s/release=.*/release=\"$version\"/g" install.sh > install.sh.tmp
|
||||
# mv install.sh.tmp install.sh
|
||||
# TODO: then git commit and push? Would be nice to do that along with the vrsion git push above
|
||||
|
||||
@@ -10,7 +10,7 @@ import (
|
||||
)
|
||||
|
||||
// Version of Functions CLI
|
||||
var Version = "0.3.18"
|
||||
var Version = "0.3.25"
|
||||
|
||||
func version() cli.Command {
|
||||
r := versionCmd{VersionApi: functions.NewVersionApi()}
|
||||
|
||||
@@ -33,7 +33,7 @@ func main() {
|
||||
type CustomMiddleware struct {
|
||||
}
|
||||
|
||||
func (h *CustomMiddleware) Serve(next http.Handler) http.Handler {
|
||||
func (h *CustomMiddleware) Chain(next http.Handler) http.Handler {
|
||||
return http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {
|
||||
fmt.Println("CustomMiddleware called")
|
||||
|
||||
|
||||
@@ -7,7 +7,7 @@ build:
|
||||
docker-build:
|
||||
docker pull funcy/go:dev
|
||||
docker run --rm -v ${GOPATH}/src/github.com/fnproject/fn:/go/src/github.com/fnproject/fn \
|
||||
-w /go/src/github.com/fnproject/fn/clilb funcy/go:dev go build -o fnlb-alpine
|
||||
-w /go/src/github.com/fnproject/fn/fnlb funcy/go:dev go build -o fnlb-alpine
|
||||
docker build --build-arg HTTP_PROXY -t funcy/fnlb:latest .
|
||||
|
||||
all: build
|
||||
|
||||
@@ -17,7 +17,7 @@ import (
|
||||
"github.com/fnproject/fn/fnlb/lb"
|
||||
)
|
||||
|
||||
const VERSION = "0.0.1"
|
||||
const VERSION = "0.0.3"
|
||||
|
||||
func main() {
|
||||
// XXX (reed): normalize
|
||||
|
||||
@@ -39,7 +39,7 @@ docker tag $user/$service:$tag $user/$service:$version
|
||||
docker push $user/$service:$version
|
||||
docker push $user/$service:$tag
|
||||
|
||||
cd fn
|
||||
cd cli
|
||||
./release.sh $version
|
||||
cd ..
|
||||
cd fnlb
|
||||
|
||||
15
test.sh
15
test.sh
@@ -2,6 +2,8 @@
|
||||
|
||||
set -ex
|
||||
|
||||
make build
|
||||
|
||||
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
|
||||
@@ -43,8 +45,11 @@ cd cli && make build && make test
|
||||
export FN="$(pwd)/fn"
|
||||
cd ..
|
||||
|
||||
# TODO: Test a bunch of the examples using fn test when ready
|
||||
# checker tests env vars
|
||||
# TODO: Fix checker tests behind proxy...
|
||||
# cd examples/checker
|
||||
# ./test.sh
|
||||
# test middlware, extensions, examples, etc
|
||||
# TODO: do more here, maybe as part of fn tests
|
||||
cd examples/middleware
|
||||
go build
|
||||
cd ../..
|
||||
cd examples/extensions
|
||||
go build
|
||||
cd ../..
|
||||
|
||||
Reference in New Issue
Block a user