diff --git a/.circleci/config.yml b/.circleci/config.yml index 23270be1..71730b2e 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -9,7 +9,6 @@ jobs: working_directory: /go/src/github.com/checkr/flagr steps: - checkout - - run: apt update && apt install -y sqlite3 - run: make deps - run: make ci - run: bash <(curl -s https://codecov.io/bash) diff --git a/Makefile b/Makefile index 0f471a15..de0b5736 100644 --- a/Makefile +++ b/Makefile @@ -39,12 +39,11 @@ start: gen: api_docs swagger -deps: checks +deps: @GO111MODULE=off go get -u github.com/myitcv/gobin @gobin github.com/go-swagger/go-swagger/cmd/swagger@v0.23.0 @gobin github.com/codeskyblue/fswatch @gobin github.com/golangci/golangci-lint/cmd/golangci-lint@v1.24.0 - @echo "Sqlite3" && sqlite3 -version watch: @fswatch @@ -61,10 +60,6 @@ api_docs: @echo "Installing swagger-merger" && npm install swagger-merger -g @swagger-merger -i $(PWD)/swagger/index.yaml -o $(PWD)/docs/api_docs/bundle.yaml -checks: - @echo "Check deps" - @(env bash $(PWD)/buildscripts/checkdeps.sh) - verifiers: verify_lint verify_swagger verify_lint: diff --git a/buildscripts/checkdeps.sh b/buildscripts/checkdeps.sh deleted file mode 100755 index 57efe2fc..00000000 --- a/buildscripts/checkdeps.sh +++ /dev/null @@ -1,176 +0,0 @@ -#!/usr/bin/env bash -# -# Minio Cloud Storage, (C) 2014-2016 Minio, 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. -# - -_init() { - - shopt -s extglob - - ## Minimum required versions for build dependencies - GIT_VERSION="1.0" - GO_VERSION="1.12" - OSX_VERSION="10.8" - KNAME=$(uname -s) - ARCH=$(uname -m) - case "${KNAME}" in - SunOS ) - ARCH=$(isainfo -k) - ;; - esac -} - -## FIXME: -## In OSX, 'readlink -f' option does not exist, hence -## we have our own readlink -f behaviour here. -## Once OSX has the option, below function is good enough. -## -## readlink() { -## return /bin/readlink -f "$1" -## } -## -readlink() { - TARGET_FILE=$1 - - cd `dirname $TARGET_FILE` - TARGET_FILE=`basename $TARGET_FILE` - - # Iterate down a (possible) chain of symlinks - while [ -L "$TARGET_FILE" ] - do - TARGET_FILE=$(env readlink $TARGET_FILE) - cd `dirname $TARGET_FILE` - TARGET_FILE=`basename $TARGET_FILE` - done - - # Compute the canonicalized name by finding the physical path - # for the directory we're in and appending the target file. - PHYS_DIR=`pwd -P` - RESULT=$PHYS_DIR/$TARGET_FILE - echo $RESULT -} - -## FIXME: -## In OSX, 'sort -V' option does not exist, hence -## we have our own version compare function. -## Once OSX has the option, below function is good enough. -## -## check_minimum_version() { -## versions=($(echo -e "$1\n$2" | sort -V)) -## return [ "$1" == "${versions[0]}" ] -## } -## -check_minimum_version() { - IFS='.' read -r -a varray1 <<< "$1" - IFS='.' read -r -a varray2 <<< "$2" - - for i in "${!varray1[@]}"; do - if [[ ${varray1[i]} -lt ${varray2[i]} ]]; then - return 0 - elif [[ ${varray1[i]} -gt ${varray2[i]} ]]; then - return 1 - fi - done - - return 0 -} - -assert_is_supported_arch() { - case "${ARCH}" in - x86_64 | amd64 | aarch64 | arm* ) - return - ;; - *) - echo "ERROR" - echo "Arch '${ARCH}' not supported." - echo "Supported Arch: [x86_64, amd64, aarch64, arm*]" - exit 1 - esac -} - -assert_is_supported_os() { - case "${KNAME}" in - Linux | FreeBSD | OpenBSD | NetBSD | DragonFly | SunOS ) - return - ;; - Darwin ) - osx_host_version=$(env sw_vers -productVersion) - if ! check_minimum_version "${OSX_VERSION}" "${osx_host_version}"; then - echo "ERROR" - echo "OSX version '${osx_host_version}' not supported." - echo "Minimum supported version: ${OSX_VERSION}" - exit 1 - fi - return - ;; - *) - echo "ERROR" - echo "OS '${KNAME}' is not supported." - echo "Supported OS: [Linux, FreeBSD, OpenBSD, NetBSD, Darwin, DragonFly]" - exit 1 - esac -} - -assert_check_golang_env() { - if ! which go >/dev/null 2>&1; then - echo "ERROR" - echo "Cannot find go binary in your PATH configuration, please refer to Go installation document at" - echo "https://docs.minio.io/docs/how-to-install-golang" - exit 1 - fi - - installed_go_version=$(go version | sed 's/^.* go\([0-9.]*\).*$/\1/') - if ! check_minimum_version "${GO_VERSION}" "${installed_go_version}"; then - echo "ERROR" - echo "Go version '${installed_go_version}' not supported." - echo "Minimum supported version: ${GO_VERSION}" - exit 1 - fi - - if [ -z "${GOPATH}" ]; then - echo "ERROR" - echo "GOPATH environment variable missing, please refer to Go installation document" - echo "https://docs.minio.io/docs/how-to-install-golang" - exit 1 - fi - -} - -assert_check_deps() { - # support unusual Git versions such as: 2.7.4 (Apple Git-66) - installed_git_version=$(git version | perl -ne '$_ =~ m/git version (.*?)( |$)/; print "$1\n";') - if ! check_minimum_version "${GIT_VERSION}" "${installed_git_version}"; then - echo "ERROR" - echo "Git version '${installed_git_version}' not supported." - echo "Minimum supported version: ${GIT_VERSION}" - exit 1 - fi -} - -main() { - ## Check for supported arch - assert_is_supported_arch - - ## Check for supported os - assert_is_supported_os - - ## Check for Go environment - assert_check_golang_env - - ## Check for dependencies - assert_check_deps -} - -_init && main "$@" diff --git a/buildscripts/demo.py b/buildscripts/demo.py deleted file mode 100644 index b95a09c3..00000000 --- a/buildscripts/demo.py +++ /dev/null @@ -1,38 +0,0 @@ -import httplib -import random -import json -import datetime - -conn = httplib.HTTPConnection("localhost:18000") -conn_elastic = httplib.HTTPConnection("localhost:9200") -headers = { 'content-type': "application/json" } - -def random_payload(): - entity_id = random.randint(1, 1000000) - d = { - "entityID": str(entity_id), - "entityType": "user", - "entityContext": { - "state": random.choice(['CA', 'NY', 'VA']), - "dl_state": random.choice(['CA', 'NY', 'VA']), - }, - "flagID": 2, - "enableDebug": True - } - return json.dumps(d) - -def index_elastic(payload): - conn_elastic.request("POST", "/flagr/flagr-records", payload, headers) - res = conn_elastic.getresponse() - data = res.read() - print(data.decode("utf-8")) - -while 1: - t = datetime.datetime.now() - conn.request("POST", "/api/v1/evaluation", random_payload(), headers) - res = conn.getresponse() - print(str((datetime.datetime.now() - t).total_seconds() * 1000) + 'ms') - - data = res.read() - index_elastic(data) - print(data.decode("utf-8")) diff --git a/buildscripts/get_remote_sqlite.sh b/buildscripts/get_remote_sqlite.sh deleted file mode 100755 index 89dcca0d..00000000 --- a/buildscripts/get_remote_sqlite.sh +++ /dev/null @@ -1,5 +0,0 @@ -#!/bin/sh - -if [ "$FLAGR_REMOTE_SQLITE_ENABLED" = "true" ] && [ "$FLAGR_DB_DBDRIVER" = "sqlite3" ]; then - curl -u $FLAGR_REMOTE_SQLITE_USERNAME:$FLAGR_REMOTE_SQLITE_PASSWORD $FLAGR_REMOTE_SQLITE_URL -o $FLAGR_DB_DBCONNECTIONSTR; -fi diff --git a/buildscripts/publish_to_docker.sh b/buildscripts/publish_to_docker.sh deleted file mode 100755 index aec5fed5..00000000 --- a/buildscripts/publish_to_docker.sh +++ /dev/null @@ -1,12 +0,0 @@ -#!/usr/bin/env bash -set -e -git checkout master -git pull -f_tag=$(git describe --tags) -git checkout $f_tag -docker build -t checkr/flagr:latest . -docker tag checkr/flagr:latest checkr/flagr:$f_tag -docker tag checkr/flagr:latest registry.heroku.com/try-flagr/web && docker push registry.heroku.com/try-flagr/web && heroku container:release -a try-flagr web -docker push checkr/flagr:$f_tag -docker push checkr/flagr:latest -git checkout master diff --git a/docs/home.md b/docs/home.md index 7bf3dd71..43ad0845 100644 --- a/docs/home.md +++ b/docs/home.md @@ -37,7 +37,6 @@ Install Dependencies. - Go - Make (for Makefile) - NPM (for building UI) -- SQLite3 (for testing) Build from source.