mirror of
https://github.com/featurebasedb/featurebase.git
synced 2026-09-12 23:51:03 +00:00
Merge branch 'master' into 54mir/authentication
This commit is contained in:
commit
d537398568
4 changed files with 403 additions and 444 deletions
|
|
@ -1,38 +0,0 @@
|
|||
|
||||
resources:
|
||||
- name: featurebaseRepo
|
||||
type: GitRepo
|
||||
configuration:
|
||||
# SCM integration where the repository is located
|
||||
gitProvider: github_molecula_featurebase
|
||||
# Repository path, including org name/repo name
|
||||
path: molecula/featurebase
|
||||
branches:
|
||||
# Specifies which branches will trigger dependent steps
|
||||
include: cicd
|
||||
- name: featurebaseBuildInfo
|
||||
type: BuildInfo
|
||||
configuration:
|
||||
sourceArtifactory: Molecula_Artifactory
|
||||
buildName: featurebase_build
|
||||
buildNumber: 4
|
||||
pipelines:
|
||||
- name: ScanGoCode
|
||||
steps:
|
||||
- name: scan
|
||||
type: XrayScan
|
||||
configuration:
|
||||
failOnScan: false
|
||||
inputResources:
|
||||
- name: featurebaseBuildInfo
|
||||
trigger: true
|
||||
execution:
|
||||
onStart:
|
||||
- echo "Preparing for work..."
|
||||
- echo "Prepping build environment"
|
||||
onSuccess:
|
||||
- echo "Job well done!"
|
||||
onFailure:
|
||||
- echo "uh oh, something went wrong"
|
||||
onComplete:
|
||||
- echo "Cleaning up some stuff"
|
||||
|
|
@ -1,305 +1,305 @@
|
|||
version: 2.1
|
||||
# version: 2.1
|
||||
|
||||
executors:
|
||||
golang:
|
||||
parameters:
|
||||
version:
|
||||
type: string
|
||||
default: "1.15.8"
|
||||
resource_class:
|
||||
type: string
|
||||
default: medium
|
||||
docker:
|
||||
- image: circleci/golang:<< parameters.version >>
|
||||
resource_class: << parameters.resource_class >>
|
||||
working_directory: /go/src/github.com/molecula/featurebase
|
||||
# executors:
|
||||
# golang:
|
||||
# parameters:
|
||||
# version:
|
||||
# type: string
|
||||
# default: "1.15.8"
|
||||
# resource_class:
|
||||
# type: string
|
||||
# default: medium
|
||||
# docker:
|
||||
# - image: circleci/golang:<< parameters.version >>
|
||||
# resource_class: << parameters.resource_class >>
|
||||
# working_directory: /go/src/github.com/molecula/featurebase
|
||||
|
||||
commands:
|
||||
add-github-auth:
|
||||
steps:
|
||||
- run: git config --global url."https://${GITHUB_USER}:${GITHUB_PERSONAL_ACCESS_TOKEN}@github.com/".insteadOf "https://github.com/"
|
||||
- run: git config --global url."https://${GITHUB_USER}:${GITHUB_PERSONAL_ACCESS_TOKEN}@github.com/".insteadOf "git@github.com:"
|
||||
restore-mod-cache:
|
||||
steps:
|
||||
- restore_cache:
|
||||
key: mod-cache-{{ checksum "go.sum" }}
|
||||
save-mod-cache:
|
||||
steps:
|
||||
- save_cache:
|
||||
key: mod-cache-{{ checksum "go.sum" }}
|
||||
paths:
|
||||
- /go/pkg/mod/
|
||||
checkout-plus:
|
||||
steps:
|
||||
- add-github-auth
|
||||
- checkout
|
||||
- restore-mod-cache
|
||||
skip-if-root-unchanged:
|
||||
description: "skips the parent job if the PR includes no changes to featurebase"
|
||||
steps:
|
||||
- run: |
|
||||
ROOT_CHANGED_FILES="$(git diff --name-only HEAD $(git merge-base master HEAD) | grep -v '^lattice/')" || true
|
||||
echo "ROOT_CHANGED_FILES = $ROOT_CHANGED_FILES"
|
||||
if [ -z "$ROOT_CHANGED_FILES" ] ; then
|
||||
echo "halting step"
|
||||
circleci step halt
|
||||
fi
|
||||
skip-if-lattice-unchanged:
|
||||
description: "skips the parent job if the PR includes no changes to lattice"
|
||||
steps:
|
||||
- run: |
|
||||
LATTICE_CHANGED_FILES="$(git diff --name-only HEAD $(git merge-base master HEAD) | grep '^lattice/')" || true
|
||||
echo "LATTICE_CHANGED_FILES = $LATTICE_CHANGED_FILES"
|
||||
if [ -z "$LATTICE_CHANGED_FILES" ] ; then
|
||||
echo "halting step"
|
||||
circleci step halt
|
||||
fi
|
||||
# commands:
|
||||
# add-github-auth:
|
||||
# steps:
|
||||
# - run: git config --global url."https://${GITHUB_USER}:${GITHUB_PERSONAL_ACCESS_TOKEN}@github.com/".insteadOf "https://github.com/"
|
||||
# - run: git config --global url."https://${GITHUB_USER}:${GITHUB_PERSONAL_ACCESS_TOKEN}@github.com/".insteadOf "git@github.com:"
|
||||
# restore-mod-cache:
|
||||
# steps:
|
||||
# - restore_cache:
|
||||
# key: mod-cache-{{ checksum "go.sum" }}
|
||||
# save-mod-cache:
|
||||
# steps:
|
||||
# - save_cache:
|
||||
# key: mod-cache-{{ checksum "go.sum" }}
|
||||
# paths:
|
||||
# - /go/pkg/mod/
|
||||
# checkout-plus:
|
||||
# steps:
|
||||
# - add-github-auth
|
||||
# - checkout
|
||||
# - restore-mod-cache
|
||||
# skip-if-root-unchanged:
|
||||
# description: "skips the parent job if the PR includes no changes to featurebase"
|
||||
# steps:
|
||||
# - run: |
|
||||
# ROOT_CHANGED_FILES="$(git diff --name-only HEAD $(git merge-base master HEAD) | grep -v '^lattice/')" || true
|
||||
# echo "ROOT_CHANGED_FILES = $ROOT_CHANGED_FILES"
|
||||
# if [ -z "$ROOT_CHANGED_FILES" ] ; then
|
||||
# echo "halting step"
|
||||
# circleci step halt
|
||||
# fi
|
||||
# skip-if-lattice-unchanged:
|
||||
# description: "skips the parent job if the PR includes no changes to lattice"
|
||||
# steps:
|
||||
# - run: |
|
||||
# LATTICE_CHANGED_FILES="$(git diff --name-only HEAD $(git merge-base master HEAD) | grep '^lattice/')" || true
|
||||
# echo "LATTICE_CHANGED_FILES = $LATTICE_CHANGED_FILES"
|
||||
# if [ -z "$LATTICE_CHANGED_FILES" ] ; then
|
||||
# echo "halting step"
|
||||
# circleci step halt
|
||||
# fi
|
||||
|
||||
jobs:
|
||||
setup:
|
||||
executor:
|
||||
name: golang
|
||||
steps:
|
||||
- checkout-plus
|
||||
- run: go mod download
|
||||
- save-mod-cache
|
||||
linter:
|
||||
executor:
|
||||
name: golang
|
||||
steps:
|
||||
- checkout-plus
|
||||
- skip-if-root-unchanged
|
||||
- run: curl -sSfL https://raw.githubusercontent.com/golangci/golangci-lint/master/install.sh | sudo sh -s -- -b /usr/local/bin v1.31.0
|
||||
- run: make golangci-lint
|
||||
go-mod-tidy:
|
||||
executor:
|
||||
name: golang
|
||||
steps:
|
||||
- checkout-plus
|
||||
- skip-if-root-unchanged
|
||||
- run: go mod tidy
|
||||
- run: git diff --exit-code -- go.mod go.sum
|
||||
check-changelog-label:
|
||||
executor:
|
||||
name: golang
|
||||
steps:
|
||||
- run: '[[ -n $CIRCLE_PULL_REQUEST ]] || circleci step halt || true' # Skip if this is not a pull request
|
||||
- run: curl https://$GITHUB_USER:$GITHUB_PERSONAL_ACCESS_TOKEN@api.github.com/repos/molecula/featurebase/pulls/$(basename $CIRCLE_PULL_REQUEST) | jq "[.labels[] | .name | startswith(\"changelog\")] | any" -e
|
||||
test-build-arm:
|
||||
executor:
|
||||
name: golang
|
||||
steps:
|
||||
- checkout-plus
|
||||
- skip-if-root-unchanged
|
||||
- run: make build GOOS=linux GOARCH=arm GOARM=5
|
||||
- run: make build GOOS=linux GOARCH=arm GOARM=6
|
||||
- run: make build GOOS=linux GOARCH=arm GOARM=7
|
||||
- run: make build GOOS=linux GOARCH=arm64
|
||||
test:
|
||||
parameters:
|
||||
resource_class:
|
||||
type: string
|
||||
default: medium
|
||||
golang_version:
|
||||
type: string
|
||||
default: "1.15.8"
|
||||
shard_width:
|
||||
type: string
|
||||
default: "20"
|
||||
test_make_target:
|
||||
type: string
|
||||
default: "test"
|
||||
test_flags:
|
||||
type: string
|
||||
default: ""
|
||||
goarch:
|
||||
type: string
|
||||
default: amd64
|
||||
executor:
|
||||
name: golang
|
||||
version: << parameters.golang_version >>
|
||||
resource_class: << parameters.resource_class >>
|
||||
environment:
|
||||
TMPDIR: /mnt/ramdisk
|
||||
steps:
|
||||
- checkout-plus
|
||||
- skip-if-root-unchanged
|
||||
- run: sudo apt-get update --allow-releaseinfo-change -y
|
||||
- run: sudo apt-get install lsof
|
||||
- run:
|
||||
command: make << parameters.test_make_target >> SHARD_WIDTH=<< parameters.shard_width >> GOARCH=<< parameters.goarch >>
|
||||
no_output_timeout: 30m
|
||||
test-external-lookup:
|
||||
docker:
|
||||
- image: circleci/golang:1.15.8
|
||||
- image: circleci/postgres:13.2-ram
|
||||
environment:
|
||||
POSTGRES_PASSWORD=password
|
||||
steps:
|
||||
- checkout-plus
|
||||
- skip-if-root-unchanged
|
||||
- run: sudo apt-get update --allow-releaseinfo-change -y
|
||||
- run: sudo apt-get install postgresql-client
|
||||
- run: (for i in `seq 1 20`; do pg_isready -h localhost && exit 0 || sleep 1; done; exit 1)
|
||||
- run:
|
||||
command: make test-external-lookup EXTERNAL_LOOKUP_DSN=postgresql://postgres:password@localhost/circle_test?sslmode=disable
|
||||
no_output_timeout: 30m
|
||||
cluster-tests:
|
||||
executor:
|
||||
name: golang
|
||||
steps:
|
||||
- checkout-plus
|
||||
- skip-if-root-unchanged
|
||||
- setup_remote_docker
|
||||
- run: make clustertests
|
||||
release:
|
||||
executor:
|
||||
name: golang
|
||||
steps:
|
||||
- checkout-plus
|
||||
- attach_workspace:
|
||||
at: .
|
||||
- setup_remote_docker:
|
||||
version: 19.03.13 # see https://support.circleci.com/hc/en-us/articles/360050934711
|
||||
- run: echo -n $DOCKER_PASS | docker login -u $DOCKER_USER --password-stdin
|
||||
- run: make docker-release
|
||||
- store_artifacts:
|
||||
path: build
|
||||
- persist_to_workspace:
|
||||
root: .
|
||||
paths: build
|
||||
publish_release:
|
||||
executor:
|
||||
name: golang
|
||||
steps:
|
||||
- attach_workspace:
|
||||
at: .
|
||||
- run: go get github.com/tcnksm/ghr
|
||||
- run: ghr -t ${GITHUB_PERSONAL_ACCESS_TOKEN} -u ${CIRCLE_PROJECT_USERNAME} -r ${CIRCLE_PROJECT_REPONAME} -c ${CIRCLE_SHA1} -delete ${CIRCLE_TAG} ./build/
|
||||
docker-build:
|
||||
executor:
|
||||
name: golang
|
||||
steps:
|
||||
- checkout-plus
|
||||
- setup_remote_docker:
|
||||
version: 19.03.13 # see https://support.circleci.com/hc/en-us/articles/360050934711
|
||||
- run: echo -n $DOCKER_PASS | docker login -u $DOCKER_USER --password-stdin
|
||||
- run: make docker GO_VERSION=1.15.8
|
||||
- run: docker run featurebase:$(git describe --tags) help
|
||||
dockerhub-upload-unstable:
|
||||
executor:
|
||||
name: golang
|
||||
steps:
|
||||
- checkout-plus
|
||||
- setup_remote_docker:
|
||||
version: 19.03.13 # see https://support.circleci.com/hc/en-us/articles/360050934711
|
||||
- run: echo -n $DOCKER_PASS | docker login -u $DOCKER_USER --password-stdin
|
||||
- run: make docker
|
||||
- run: docker run featurebase:$(git describe --tags) help
|
||||
- run: make docker-tag-push DOCKER_TARGET=moleculacorp/featurebase:<< pipeline.git.branch >>
|
||||
dockerhub-upload-stable:
|
||||
executor:
|
||||
name: golang
|
||||
steps:
|
||||
- checkout-plus
|
||||
- setup_remote_docker:
|
||||
version: 19.03.13 # see https://support.circleci.com/hc/en-us/articles/360050934711
|
||||
- run: echo -n $DOCKER_PASS | docker login -u $DOCKER_USER --password-stdin
|
||||
- run: make docker
|
||||
- run: docker run featurebase:$(git describe --tags) help
|
||||
- run: make docker-tag-push DOCKER_TARGET=moleculacorp/featurebase:<< pipeline.git.tag >>
|
||||
- run: make docker-tag-push DOCKER_TARGET=moleculacorp/featurebase:latest
|
||||
# jobs:
|
||||
# setup:
|
||||
# executor:
|
||||
# name: golang
|
||||
# steps:
|
||||
# - checkout-plus
|
||||
# - run: go mod download
|
||||
# - save-mod-cache
|
||||
# linter:
|
||||
# executor:
|
||||
# name: golang
|
||||
# steps:
|
||||
# - checkout-plus
|
||||
# - skip-if-root-unchanged
|
||||
# - run: curl -sSfL https://raw.githubusercontent.com/golangci/golangci-lint/master/install.sh | sudo sh -s -- -b /usr/local/bin v1.31.0
|
||||
# - run: make golangci-lint
|
||||
# go-mod-tidy:
|
||||
# executor:
|
||||
# name: golang
|
||||
# steps:
|
||||
# - checkout-plus
|
||||
# - skip-if-root-unchanged
|
||||
# - run: go mod tidy
|
||||
# - run: git diff --exit-code -- go.mod go.sum
|
||||
# check-changelog-label:
|
||||
# executor:
|
||||
# name: golang
|
||||
# steps:
|
||||
# - run: '[[ -n $CIRCLE_PULL_REQUEST ]] || circleci step halt || true' # Skip if this is not a pull request
|
||||
# - run: curl https://$GITHUB_USER:$GITHUB_PERSONAL_ACCESS_TOKEN@api.github.com/repos/molecula/featurebase/pulls/$(basename $CIRCLE_PULL_REQUEST) | jq "[.labels[] | .name | startswith(\"changelog\")] | any" -e
|
||||
# test-build-arm:
|
||||
# executor:
|
||||
# name: golang
|
||||
# steps:
|
||||
# - checkout-plus
|
||||
# - skip-if-root-unchanged
|
||||
# - run: make build GOOS=linux GOARCH=arm GOARM=5
|
||||
# - run: make build GOOS=linux GOARCH=arm GOARM=6
|
||||
# - run: make build GOOS=linux GOARCH=arm GOARM=7
|
||||
# - run: make build GOOS=linux GOARCH=arm64
|
||||
# test:
|
||||
# parameters:
|
||||
# resource_class:
|
||||
# type: string
|
||||
# default: medium
|
||||
# golang_version:
|
||||
# type: string
|
||||
# default: "1.15.8"
|
||||
# shard_width:
|
||||
# type: string
|
||||
# default: "20"
|
||||
# test_make_target:
|
||||
# type: string
|
||||
# default: "test"
|
||||
# test_flags:
|
||||
# type: string
|
||||
# default: ""
|
||||
# goarch:
|
||||
# type: string
|
||||
# default: amd64
|
||||
# executor:
|
||||
# name: golang
|
||||
# version: << parameters.golang_version >>
|
||||
# resource_class: << parameters.resource_class >>
|
||||
# environment:
|
||||
# TMPDIR: /mnt/ramdisk
|
||||
# steps:
|
||||
# - checkout-plus
|
||||
# - skip-if-root-unchanged
|
||||
# - run: sudo apt-get update --allow-releaseinfo-change -y
|
||||
# - run: sudo apt-get install lsof
|
||||
# - run:
|
||||
# command: make << parameters.test_make_target >> SHARD_WIDTH=<< parameters.shard_width >> GOARCH=<< parameters.goarch >>
|
||||
# no_output_timeout: 30m
|
||||
# test-external-lookup:
|
||||
# docker:
|
||||
# - image: circleci/golang:1.15.8
|
||||
# - image: circleci/postgres:13.2-ram
|
||||
# environment:
|
||||
# POSTGRES_PASSWORD=password
|
||||
# steps:
|
||||
# - checkout-plus
|
||||
# - skip-if-root-unchanged
|
||||
# - run: sudo apt-get update --allow-releaseinfo-change -y
|
||||
# - run: sudo apt-get install postgresql-client
|
||||
# - run: (for i in `seq 1 20`; do pg_isready -h localhost && exit 0 || sleep 1; done; exit 1)
|
||||
# - run:
|
||||
# command: make test-external-lookup EXTERNAL_LOOKUP_DSN=postgresql://postgres:password@localhost/circle_test?sslmode=disable
|
||||
# no_output_timeout: 30m
|
||||
# cluster-tests:
|
||||
# executor:
|
||||
# name: golang
|
||||
# steps:
|
||||
# - checkout-plus
|
||||
# - skip-if-root-unchanged
|
||||
# - setup_remote_docker
|
||||
# - run: make clustertests
|
||||
# release:
|
||||
# executor:
|
||||
# name: golang
|
||||
# steps:
|
||||
# - checkout-plus
|
||||
# - attach_workspace:
|
||||
# at: .
|
||||
# - setup_remote_docker:
|
||||
# version: 19.03.13 # see https://support.circleci.com/hc/en-us/articles/360050934711
|
||||
# - run: echo -n $DOCKER_PASS | docker login -u $DOCKER_USER --password-stdin
|
||||
# - run: make docker-release
|
||||
# - store_artifacts:
|
||||
# path: build
|
||||
# - persist_to_workspace:
|
||||
# root: .
|
||||
# paths: build
|
||||
# publish_release:
|
||||
# executor:
|
||||
# name: golang
|
||||
# steps:
|
||||
# - attach_workspace:
|
||||
# at: .
|
||||
# - run: go get github.com/tcnksm/ghr
|
||||
# - run: ghr -t ${GITHUB_PERSONAL_ACCESS_TOKEN} -u ${CIRCLE_PROJECT_USERNAME} -r ${CIRCLE_PROJECT_REPONAME} -c ${CIRCLE_SHA1} -delete ${CIRCLE_TAG} ./build/
|
||||
# docker-build:
|
||||
# executor:
|
||||
# name: golang
|
||||
# steps:
|
||||
# - checkout-plus
|
||||
# - setup_remote_docker:
|
||||
# version: 19.03.13 # see https://support.circleci.com/hc/en-us/articles/360050934711
|
||||
# - run: echo -n $DOCKER_PASS | docker login -u $DOCKER_USER --password-stdin
|
||||
# - run: make docker GO_VERSION=1.15.8
|
||||
# - run: docker run featurebase:$(git describe --tags) help
|
||||
# dockerhub-upload-unstable:
|
||||
# executor:
|
||||
# name: golang
|
||||
# steps:
|
||||
# - checkout-plus
|
||||
# - setup_remote_docker:
|
||||
# version: 19.03.13 # see https://support.circleci.com/hc/en-us/articles/360050934711
|
||||
# - run: echo -n $DOCKER_PASS | docker login -u $DOCKER_USER --password-stdin
|
||||
# - run: make docker
|
||||
# - run: docker run featurebase:$(git describe --tags) help
|
||||
# - run: make docker-tag-push DOCKER_TARGET=moleculacorp/featurebase:<< pipeline.git.branch >>
|
||||
# dockerhub-upload-stable:
|
||||
# executor:
|
||||
# name: golang
|
||||
# steps:
|
||||
# - checkout-plus
|
||||
# - setup_remote_docker:
|
||||
# version: 19.03.13 # see https://support.circleci.com/hc/en-us/articles/360050934711
|
||||
# - run: echo -n $DOCKER_PASS | docker login -u $DOCKER_USER --password-stdin
|
||||
# - run: make docker
|
||||
# - run: docker run featurebase:$(git describe --tags) help
|
||||
# - run: make docker-tag-push DOCKER_TARGET=moleculacorp/featurebase:<< pipeline.git.tag >>
|
||||
# - run: make docker-tag-push DOCKER_TARGET=moleculacorp/featurebase:latest
|
||||
|
||||
workflows:
|
||||
build:
|
||||
jobs:
|
||||
- setup:
|
||||
context: molecula
|
||||
filters:
|
||||
tags:
|
||||
only: /^v.*/
|
||||
- linter:
|
||||
context: molecula
|
||||
requires:
|
||||
- setup
|
||||
- go-mod-tidy:
|
||||
context: molecula
|
||||
requires:
|
||||
- setup
|
||||
- check-changelog-label:
|
||||
context: molecula
|
||||
requires:
|
||||
- setup
|
||||
- test-build-arm:
|
||||
context: molecula
|
||||
requires:
|
||||
- setup
|
||||
- test:
|
||||
name: test-golang-<< matrix.golang_version >>
|
||||
resource_class: large
|
||||
context: molecula
|
||||
requires:
|
||||
- setup
|
||||
matrix:
|
||||
parameters:
|
||||
golang_version: ["1.15.8", "1.16.10"]
|
||||
- test:
|
||||
name: << matrix.test_make_target >>
|
||||
resource_class: xlarge
|
||||
context: molecula
|
||||
requires:
|
||||
- setup
|
||||
matrix:
|
||||
parameters:
|
||||
test_make_target: ["test-race"]
|
||||
- test:
|
||||
name: test-shardwidth-22
|
||||
context: molecula
|
||||
shard_width: "22"
|
||||
resource_class: large
|
||||
requires:
|
||||
- setup
|
||||
- test-external-lookup:
|
||||
context: molecula
|
||||
requires:
|
||||
- setup
|
||||
- cluster-tests:
|
||||
context: molecula
|
||||
requires:
|
||||
- setup
|
||||
- docker-build:
|
||||
context: molecula
|
||||
requires:
|
||||
- setup
|
||||
- release:
|
||||
context: molecula
|
||||
requires:
|
||||
- setup
|
||||
filters:
|
||||
tags:
|
||||
only: /^v.*/
|
||||
- publish_release:
|
||||
context: molecula
|
||||
requires:
|
||||
- release
|
||||
filters:
|
||||
tags:
|
||||
only: /^v.*/
|
||||
branches:
|
||||
ignore: /.*/
|
||||
- dockerhub-upload-unstable:
|
||||
context: molecula
|
||||
requires:
|
||||
- setup
|
||||
filters:
|
||||
branches:
|
||||
only: master
|
||||
- dockerhub-upload-stable:
|
||||
context: molecula
|
||||
requires:
|
||||
- setup
|
||||
filters:
|
||||
tags:
|
||||
only: /^v.*/
|
||||
branches:
|
||||
ignore: /.*/
|
||||
# workflows:
|
||||
# build:
|
||||
# jobs:
|
||||
# - setup:
|
||||
# context: molecula
|
||||
# filters:
|
||||
# tags:
|
||||
# only: /^v.*/
|
||||
# - linter:
|
||||
# context: molecula
|
||||
# requires:
|
||||
# - setup
|
||||
# - go-mod-tidy:
|
||||
# context: molecula
|
||||
# requires:
|
||||
# - setup
|
||||
# - check-changelog-label:
|
||||
# context: molecula
|
||||
# requires:
|
||||
# - setup
|
||||
# - test-build-arm:
|
||||
# context: molecula
|
||||
# requires:
|
||||
# - setup
|
||||
# - test:
|
||||
# name: test-golang-<< matrix.golang_version >>
|
||||
# resource_class: large
|
||||
# context: molecula
|
||||
# requires:
|
||||
# - setup
|
||||
# matrix:
|
||||
# parameters:
|
||||
# golang_version: ["1.15.8", "1.16.10"]
|
||||
# - test:
|
||||
# name: << matrix.test_make_target >>
|
||||
# resource_class: xlarge
|
||||
# context: molecula
|
||||
# requires:
|
||||
# - setup
|
||||
# matrix:
|
||||
# parameters:
|
||||
# test_make_target: ["test-race"]
|
||||
# - test:
|
||||
# name: test-shardwidth-22
|
||||
# context: molecula
|
||||
# shard_width: "22"
|
||||
# resource_class: large
|
||||
# requires:
|
||||
# - setup
|
||||
# - test-external-lookup:
|
||||
# context: molecula
|
||||
# requires:
|
||||
# - setup
|
||||
# - cluster-tests:
|
||||
# context: molecula
|
||||
# requires:
|
||||
# - setup
|
||||
# - docker-build:
|
||||
# context: molecula
|
||||
# requires:
|
||||
# - setup
|
||||
# - release:
|
||||
# context: molecula
|
||||
# requires:
|
||||
# - setup
|
||||
# filters:
|
||||
# tags:
|
||||
# only: /^v.*/
|
||||
# - publish_release:
|
||||
# context: molecula
|
||||
# requires:
|
||||
# - release
|
||||
# filters:
|
||||
# tags:
|
||||
# only: /^v.*/
|
||||
# branches:
|
||||
# ignore: /.*/
|
||||
# - dockerhub-upload-unstable:
|
||||
# context: molecula
|
||||
# requires:
|
||||
# - setup
|
||||
# filters:
|
||||
# branches:
|
||||
# only: master
|
||||
# - dockerhub-upload-stable:
|
||||
# context: molecula
|
||||
# requires:
|
||||
# - setup
|
||||
# filters:
|
||||
# tags:
|
||||
# only: /^v.*/
|
||||
# branches:
|
||||
# ignore: /.*/
|
||||
|
|
|
|||
|
|
@ -220,31 +220,31 @@ build container fb:
|
|||
|
||||
# deploy EC2 instance, configure and run featurebase
|
||||
deploy node for linux amd64:
|
||||
stage: integration
|
||||
image: registry.gitlab.com/gitlab-org/cloud-deploy/aws-base:latest
|
||||
variables:
|
||||
PROFILE: "default"
|
||||
AWS_SSH_PRIVATE_KEY: $AWS_SSH_PRIVATE_KEY
|
||||
rules:
|
||||
- if: '$CI_PIPELINE_SOURCE == "push" && $CI_COMMIT_BRANCH == $CI_DEFAULT_BRANCH'
|
||||
before_script:
|
||||
- aws configure set aws_access_key_id $AWS_ACCESS_KEY_ID
|
||||
- aws configure set aws_secret_access_key $AWS_SECRET_ACCESS_KEY
|
||||
- aws configure set region "us-east-2"
|
||||
- aws configure set aws_profile $PROFILE
|
||||
- echo $AWS_SSH_PRIVATE_KEY > gitlab-featurebase-dev.pem
|
||||
- chmod 400 gitlab-featurebase-dev.pem
|
||||
- 'which ssh-agent || ( apt-get update -y && apt-get install openssh-client -y )'
|
||||
- eval `ssh-agent -s`
|
||||
- mkdir -p ~/.ssh
|
||||
- echo "$AWS_SSH_PRIVATE_KEY" | ssh-add -
|
||||
- chmod 700 /root/.ssh
|
||||
- '[[ -f /.dockerenv ]] && echo -e "Host *\n\tStrictHostKeyChecking no\n\n" > ~/.ssh/config'
|
||||
- apt update && apt -y install jq
|
||||
script:
|
||||
- ./qa/scripts/deployNode.sh $PROFILE
|
||||
needs:
|
||||
- job: build for linux amd64
|
||||
stage: integration
|
||||
image: registry.gitlab.com/gitlab-org/cloud-deploy/aws-base:latest
|
||||
variables:
|
||||
PROFILE: "service-terraform"
|
||||
AWS_SSH_PRIVATE_KEY: $AWS_FBCI_SSH_KEY
|
||||
rules:
|
||||
- if: '$CI_PIPELINE_SOURCE == "push" && $CI_COMMIT_BRANCH == $CI_DEFAULT_BRANCH'
|
||||
before_script:
|
||||
- aws configure set aws_access_key_id $AWS_FBCI_ACCESS_KEY_ID
|
||||
- aws configure set aws_secret_access_key $AWS_FBCI_SECRET_ACCESS_KEY
|
||||
- aws configure set region "us-east-2"
|
||||
- aws configure set aws_profile $PROFILE
|
||||
- echo $AWS_FBCI_SSH_KEY > gitlab-featurebase-ci.pem
|
||||
- chmod 400 gitlab-featurebase-ci.pem
|
||||
- 'which ssh-agent || ( apt-get update -y && apt-get install openssh-client -y )'
|
||||
- eval `ssh-agent -s`
|
||||
- mkdir -p ~/.ssh
|
||||
- echo "$AWS_FBCI_SSH_KEY" | ssh-add -
|
||||
- chmod 700 /root/.ssh
|
||||
- '[[ -f /.dockerenv ]] && echo -e "Host *\n\tStrictHostKeyChecking no\n\n" > ~/.ssh/config'
|
||||
- apt update && apt -y install jq
|
||||
script:
|
||||
- ./qa/scripts/deployNode.sh $PROFILE
|
||||
needs:
|
||||
- job: build for linux amd64
|
||||
|
||||
gauntlet:
|
||||
stage: gauntlet
|
||||
|
|
@ -286,4 +286,4 @@ gauntlet:
|
|||
- ./qa/scripts/testSamsungGauntlet.sh
|
||||
after_script:
|
||||
- ./qa/scripts/teardownSamsungGauntlet.sh
|
||||
needs: ["build for linux arm64"]
|
||||
needs: ["build for linux arm64"]
|
||||
|
|
|
|||
|
|
@ -13,7 +13,6 @@ import (
|
|||
gohttp "net/http"
|
||||
"net/http/httptest"
|
||||
"reflect"
|
||||
"sort"
|
||||
"strings"
|
||||
"sync"
|
||||
"testing"
|
||||
|
|
@ -24,10 +23,8 @@ import (
|
|||
"github.com/molecula/featurebase/v2/encoding/proto"
|
||||
"github.com/molecula/featurebase/v2/http"
|
||||
"github.com/molecula/featurebase/v2/pql"
|
||||
pb "github.com/molecula/featurebase/v2/proto"
|
||||
"github.com/molecula/featurebase/v2/server"
|
||||
"github.com/molecula/featurebase/v2/test"
|
||||
"google.golang.org/grpc"
|
||||
)
|
||||
|
||||
func TestHandler_PostSchemaCluster(t *testing.T) {
|
||||
|
|
@ -1472,93 +1469,93 @@ func TestClusterTranslator(t *testing.T) {
|
|||
}
|
||||
}
|
||||
|
||||
func TestQueryHistory(t *testing.T) {
|
||||
cluster := test.MustRunCluster(t, 3,
|
||||
[]server.CommandOption{
|
||||
server.OptCommandServerOptions(
|
||||
pilosa.OptServerNodeID("1"),
|
||||
)},
|
||||
[]server.CommandOption{
|
||||
server.OptCommandServerOptions(
|
||||
pilosa.OptServerNodeID("0"),
|
||||
)},
|
||||
[]server.CommandOption{
|
||||
server.OptCommandServerOptions(
|
||||
pilosa.OptServerNodeID("2"),
|
||||
)},
|
||||
)
|
||||
defer cluster.Close()
|
||||
// func TestQueryHistory(t *testing.T) {
|
||||
// cluster := test.MustRunCluster(t, 3,
|
||||
// []server.CommandOption{
|
||||
// server.OptCommandServerOptions(
|
||||
// pilosa.OptServerNodeID("1"),
|
||||
// )},
|
||||
// []server.CommandOption{
|
||||
// server.OptCommandServerOptions(
|
||||
// pilosa.OptServerNodeID("0"),
|
||||
// )},
|
||||
// []server.CommandOption{
|
||||
// server.OptCommandServerOptions(
|
||||
// pilosa.OptServerNodeID("2"),
|
||||
// )},
|
||||
// )
|
||||
// defer cluster.Close()
|
||||
|
||||
cmd := cluster.GetNode(0)
|
||||
h := cmd.Handler.(*http.Handler).Handler
|
||||
// cmd := cluster.GetNode(0)
|
||||
// h := cmd.Handler.(*http.Handler).Handler
|
||||
|
||||
w := httptest.NewRecorder()
|
||||
// w := httptest.NewRecorder()
|
||||
|
||||
test.Do(t, "POST", cmd.URL()+"/index/i0", "")
|
||||
test.Do(t, "POST", cmd.URL()+"/index/i0/field/f0", "")
|
||||
// test.Do(t, "POST", cmd.URL()+"/index/i0", "")
|
||||
// test.Do(t, "POST", cmd.URL()+"/index/i0/field/f0", "")
|
||||
|
||||
gh := server.NewGRPCHandler(cmd.API)
|
||||
stream := &MockServerTransportStream{}
|
||||
ctx := grpc.NewContextWithServerTransportStream(context.Background(), stream)
|
||||
_, err := gh.QuerySQLUnary(ctx, &pb.QuerySQLRequest{
|
||||
Sql: `select * from i0`,
|
||||
})
|
||||
// gh := server.NewGRPCHandler(cmd.API)
|
||||
// stream := &MockServerTransportStream{}
|
||||
// ctx := grpc.NewContextWithServerTransportStream(context.Background(), stream)
|
||||
// _, err := gh.QuerySQLUnary(ctx, &pb.QuerySQLRequest{
|
||||
// Sql: `select * from i0`,
|
||||
// })
|
||||
|
||||
if err != nil {
|
||||
t.Fatalf("QuerySQLUnary failed: %v", err)
|
||||
}
|
||||
// if err != nil {
|
||||
// t.Fatalf("QuerySQLUnary failed: %v", err)
|
||||
// }
|
||||
|
||||
test.Do(t, "POST", cmd.URL()+"/index/i0/query", "Set(0, f0=0)")
|
||||
test.Do(t, "POST", cmd.URL()+"/index/i0/query", "Set(3000000, f0=0)")
|
||||
test.Do(t, "POST", cmd.URL()+"/index/i0/query", "TopN(f0)")
|
||||
// test.Do(t, "POST", cmd.URL()+"/index/i0/query", "Set(0, f0=0)")
|
||||
// test.Do(t, "POST", cmd.URL()+"/index/i0/query", "Set(3000000, f0=0)")
|
||||
// test.Do(t, "POST", cmd.URL()+"/index/i0/query", "TopN(f0)")
|
||||
|
||||
h.ServeHTTP(w, test.MustNewHTTPRequest("GET", "/query-history", nil))
|
||||
if w.Code != gohttp.StatusOK {
|
||||
t.Fatalf("unexpected status code: %d %s", w.Code, w.Body.String())
|
||||
}
|
||||
// h.ServeHTTP(w, test.MustNewHTTPRequest("GET", "/query-history", nil))
|
||||
// if w.Code != gohttp.StatusOK {
|
||||
// t.Fatalf("unexpected status code: %d %s", w.Code, w.Body.String())
|
||||
// }
|
||||
|
||||
ret := make([]pilosa.PastQueryStatus, 4)
|
||||
b, err := ioutil.ReadAll(w.Body)
|
||||
if err != nil {
|
||||
t.Fatalf("reading: %v", err)
|
||||
}
|
||||
err = json.Unmarshal(b, &ret)
|
||||
if err != nil {
|
||||
t.Fatalf("unmarshalling: %v", err)
|
||||
}
|
||||
// ret := make([]pilosa.PastQueryStatus, 4)
|
||||
// b, err := ioutil.ReadAll(w.Body)
|
||||
// if err != nil {
|
||||
// t.Fatalf("reading: %v", err)
|
||||
// }
|
||||
// err = json.Unmarshal(b, &ret)
|
||||
// if err != nil {
|
||||
// t.Fatalf("unmarshalling: %v", err)
|
||||
// }
|
||||
|
||||
// verify result length
|
||||
if len(ret) != 4 {
|
||||
// each set query executes on both nodes once
|
||||
// topn query gets added to history on node0 once, node1 twice
|
||||
t.Fatalf("expected list of length 4, got %d\n%+v", len(ret), ret)
|
||||
}
|
||||
// // verify result length
|
||||
// if len(ret) != 4 {
|
||||
// // each set query executes on both nodes once
|
||||
// // topn query gets added to history on node0 once, node1 twice
|
||||
// t.Fatalf("expected list of length 4, got %d\n%+v", len(ret), ret)
|
||||
// }
|
||||
|
||||
// verify sort order
|
||||
if !sort.SliceIsSorted(ret, func(i, j int) bool {
|
||||
// must match the sort in api.PastQueries
|
||||
return ret[i].Start.After(ret[j].Start)
|
||||
}) {
|
||||
t.Fatalf("response list not sorted correctly")
|
||||
}
|
||||
// // verify sort order
|
||||
// if !sort.SliceIsSorted(ret, func(i, j int) bool {
|
||||
// // must match the sort in api.PastQueries
|
||||
// return ret[i].Start.After(ret[j].Start)
|
||||
// }) {
|
||||
// t.Fatalf("response list not sorted correctly")
|
||||
// }
|
||||
|
||||
// verify some response values
|
||||
if ret[0].Index != "i0" {
|
||||
t.Fatalf("response value for 'Index' was '%s', expected 'i0'", ret[0].Index)
|
||||
}
|
||||
if ret[0].Node != cluster.GetNode(0).Server.NodeID() {
|
||||
t.Fatalf("response value for 'Node' was '%s', expected '%s'", ret[0].Node, cluster.GetNode(0).Server.NodeID())
|
||||
}
|
||||
if ret[3].PQL != "Extract(All(),Rows(f0))" {
|
||||
t.Fatalf("response value for 'PQL' was '%s', expected 'Extract(All(),Rows(f0))'", ret[0].PQL)
|
||||
}
|
||||
if ret[3].SQL != "select * from i0" {
|
||||
t.Fatalf("response value for 'SQL' was '%s', expected 'select * from i0'", ret[0].SQL)
|
||||
}
|
||||
if ret[0].PQL != "TopN(f0)" {
|
||||
t.Fatalf("response value for 'PQL' was '%s', expected 'TopN(f0)'", ret[0].PQL)
|
||||
}
|
||||
}
|
||||
// // verify some response values
|
||||
// if ret[0].Index != "i0" {
|
||||
// t.Fatalf("response value for 'Index' was '%s', expected 'i0'", ret[0].Index)
|
||||
// }
|
||||
// if ret[0].Node != cluster.GetNode(0).Server.NodeID() {
|
||||
// t.Fatalf("response value for 'Node' was '%s', expected '%s'", ret[0].Node, cluster.GetNode(0).Server.NodeID())
|
||||
// }
|
||||
// if ret[3].PQL != "Extract(All(),Rows(f0))" {
|
||||
// t.Fatalf("response value for 'PQL' was '%s', expected 'Extract(All(),Rows(f0))'", ret[0].PQL)
|
||||
// }
|
||||
// if ret[3].SQL != "select * from i0" {
|
||||
// t.Fatalf("response value for 'SQL' was '%s', expected 'select * from i0'", ret[0].SQL)
|
||||
// }
|
||||
// if ret[0].PQL != "TopN(f0)" {
|
||||
// t.Fatalf("response value for 'PQL' was '%s', expected 'TopN(f0)'", ret[0].PQL)
|
||||
// }
|
||||
// }
|
||||
|
||||
func mustJSONDecode(t *testing.T, r io.Reader) (ret map[string]interface{}) {
|
||||
dec := json.NewDecoder(r)
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue