Skip to content

Commit

Permalink
Merge pull request #66 from grafana/drone-signing
Browse files Browse the repository at this point in the history
drone signing
  • Loading branch information
yoziru authored Oct 31, 2023
2 parents 479ea09 + f82e240 commit 0e45a50
Show file tree
Hide file tree
Showing 4 changed files with 339 additions and 0 deletions.
File renamed without changes.
328 changes: 328 additions & 0 deletions .drone/drone.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,328 @@
---
clone:
retries: 3
kind: pipeline
name: docker-linux-amd64
platform:
arch: amd64
os: linux
services: []
steps:
- commands: []
environment:
DOCKER_BUILDKIT: 1
image: plugins/docker
name: Build and push Docker image
settings:
build_args:
- BUILDKIT_INLINE_CACHE=1
cache_from: grafana/vectorapi
password:
from_secret: docker_password
repo: grafana/vectorapi
tags:
- ${DRONE_COMMIT_SHA:0:10}-linux-amd64
target: production
username:
from_secret: docker_username
trigger:
ref:
- refs/heads/main
- refs/heads/public-docker-image
type: docker
volumes: []
---
clone:
retries: 3
kind: pipeline
name: docker-linux-arm64
platform:
arch: arm64
os: linux
services: []
steps:
- commands: []
environment:
DOCKER_BUILDKIT: 1
image: plugins/docker
name: Build and push Docker image
settings:
build_args:
- BUILDKIT_INLINE_CACHE=1
cache_from: grafana/vectorapi
password:
from_secret: docker_password
repo: grafana/vectorapi
tags:
- ${DRONE_COMMIT_SHA:0:10}-linux-arm64
target: production
username:
from_secret: docker_username
trigger:
ref:
- refs/heads/main
- refs/heads/public-docker-image
type: docker
volumes: []
---
clone:
retries: 3
depends_on:
- docker-linux-amd64
- docker-linux-arm64
kind: pipeline
name: docker-manifest
services: []
steps:
- commands: []
image: plugins/manifest
name: manifest
settings:
password:
from_secret: docker_password
platforms:
- linux/amd64
- linux/arm64
tags:
- latest
target: grafana/vectorapi:${DRONE_COMMIT_SHA:0:10}
template: grafana/vectorapi:${DRONE_COMMIT_SHA:0:10}-OS-ARCH
username:
from_secret: docker_username
trigger:
ref:
- refs/heads/main
- refs/heads/public-docker-image
type: docker
volumes: []
---
clone:
retries: 3
kind: pipeline
name: Python tests
services:
- environment:
POSTGRES_DB: postgres
POSTGRES_PASSWORD: mysecretpassword
POSTGRES_PORT: 5432
POSTGRES_USER: postgres
image: ankane/pgvector
name: db
steps:
- commands: []
environment:
GCS_CACHE_JSON_KEY:
from_secret: gcs_service_account_key
image: meltwater/drone-cache
name: restore setup poetry
pull: true
settings:
archive_format: gzip
backend: gcs
bucket: drone-cache-mlops
cache_key: '{{ os }}-{{ arch }}/py3.11/poetry/1.6.1'
mount:
- .poetry
region: us-central1
restore: true
- commands:
- curl -sSL https://install.python-poetry.org | python -
depends_on:
- restore setup poetry
environment:
POETRY_HOME: /drone/src/.poetry
POETRY_VERSION: 1.6.1
POETRY_VIRTUALENVS_IN_PROJECT: true
POSTGRES_DB: postgres
POSTGRES_HOST: db
POSTGRES_PASSWORD: mysecretpassword
POSTGRES_PORT: 5432
VECTORAPI_STORE_SCHEMA: test_schema
image: python:3.11-bullseye
name: setup poetry
- commands: []
depends_on:
- setup poetry
environment:
GCS_CACHE_JSON_KEY:
from_secret: gcs_service_account_key
image: meltwater/drone-cache
name: store setup poetry
pull: true
settings:
archive_format: gzip
backend: gcs
bucket: drone-cache-mlops
cache_key: '{{ os }}-{{ arch }}/py3.11/poetry/1.6.1'
mount:
- .poetry
override: false
rebuild: true
region: us-central1
- commands: []
environment:
GCS_CACHE_JSON_KEY:
from_secret: gcs_service_account_key
image: meltwater/drone-cache
name: restore setup python-venv
pull: true
settings:
archive_format: gzip
backend: gcs
bucket: drone-cache-mlops
cache_key: '{{ os }}-{{ arch }}/py3.11/python-venv/vectorapi/{{ checksum "poetry.lock"
}}'
mount:
- .venv
region: us-central1
restore: true
- commands:
- export PATH=$POETRY_HOME/bin:$PATH
- poetry install --sync
depends_on:
- restore setup python-venv
- setup poetry
environment:
POETRY_HOME: /drone/src/.poetry
POETRY_VERSION: 1.6.1
POETRY_VIRTUALENVS_IN_PROJECT: true
POSTGRES_DB: postgres
POSTGRES_HOST: db
POSTGRES_PASSWORD: mysecretpassword
POSTGRES_PORT: 5432
VECTORAPI_STORE_SCHEMA: test_schema
image: python:3.11-bullseye
name: setup python-venv
- commands: []
depends_on:
- setup python-venv
environment:
GCS_CACHE_JSON_KEY:
from_secret: gcs_service_account_key
image: meltwater/drone-cache
name: store setup python-venv
pull: true
settings:
archive_format: gzip
backend: gcs
bucket: drone-cache-mlops
cache_key: '{{ os }}-{{ arch }}/py3.11/python-venv/vectorapi/{{ checksum "poetry.lock"
}}'
mount:
- .venv
override: false
rebuild: true
region: us-central1
- commands:
- export PATH=$POETRY_HOME/bin:$PATH
- poetry lock --check
depends_on:
- setup python-venv
environment:
POETRY_HOME: /drone/src/.poetry
POETRY_VERSION: 1.6.1
POETRY_VIRTUALENVS_IN_PROJECT: true
POSTGRES_DB: postgres
POSTGRES_HOST: db
POSTGRES_PASSWORD: mysecretpassword
POSTGRES_PORT: 5432
VECTORAPI_STORE_SCHEMA: test_schema
image: python:3.11-bullseye
name: poetry lock check
- commands:
- . .venv/bin/activate
- make lint
depends_on:
- setup python-venv
image: python:3.11-bullseye
name: lint
- commands:
- . .venv/bin/activate
- make static-analysis
depends_on:
- setup python-venv
environment:
POETRY_HOME: /drone/src/.poetry
POETRY_VERSION: 1.6.1
POETRY_VIRTUALENVS_IN_PROJECT: true
POSTGRES_DB: postgres
POSTGRES_HOST: db
POSTGRES_PASSWORD: mysecretpassword
POSTGRES_PORT: 5432
VECTORAPI_STORE_SCHEMA: test_schema
image: python:3.11-bullseye
name: static analysis
- commands:
- . .venv/bin/activate
- make test
depends_on:
- setup python-venv
environment:
POETRY_HOME: /drone/src/.poetry
POETRY_VERSION: 1.6.1
POETRY_VIRTUALENVS_IN_PROJECT: true
POSTGRES_DB: postgres
POSTGRES_HOST: db
POSTGRES_PASSWORD: mysecretpassword
POSTGRES_PORT: 5432
VECTORAPI_STORE_SCHEMA: test_schema
image: python:3.11-bullseye
name: test
- commands:
- . .venv/bin/activate
- make test-integration
depends_on:
- setup python-venv
environment:
POETRY_HOME: /drone/src/.poetry
POETRY_VERSION: 1.6.1
POETRY_VIRTUALENVS_IN_PROJECT: true
POSTGRES_DB: postgres
POSTGRES_HOST: db
POSTGRES_PASSWORD: mysecretpassword
POSTGRES_PORT: 5432
VECTORAPI_STORE_SCHEMA: test_schema
image: python:3.11-bullseye
name: integration
trigger:
ref:
- refs/heads/main
- refs/heads/public-docker-image
- refs/pull/**
type: docker
volumes: []
---
get:
name: .dockerconfigjson
path: infra/data/ci/gcr-admin
kind: secret
name: gcr_admin
---
get:
name: .dockerconfigjson
path: secret/data/common/gcr
kind: secret
name: gcr_reader
---
get:
name: username
path: infra/data/ci/docker_hub
kind: secret
name: docker_username
---
get:
name: password
path: infra/data/ci/docker_hub
kind: secret
name: docker_password
---
get:
name: gcp_key
path: infra/data/ci/drone-plugins
kind: secret
name: gcs_service_account_key
---
kind: signature
hmac: b97fb51e07a3f93a176eb549aa7745c89a2a562634e035a190fdad4130ae7e19

...
6 changes: 6 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,12 @@ test: ## Run the unit tests
test-integration: ## Run the integration tests
python -m pytest -v tests/integration --integration

.PHONY: drone
drone: ## Regenerate and sign drone.yml
drone jsonnet --stream --format --source .drone/drone.jsonnet --target .drone/drone.yml
drone lint .drone/drone.yml --trusted
@drone sign --save grafana/vectorapi .drone/drone.yml || echo "You must set DRONE_SERVER and DRONE_TOKEN. These values can be found on your [drone account](http://drone.grafana.net/account) page."

.PHONY: help
help: ## Display this help screen
@grep -E '^[a-z.A-Z_-]+:.*?## .*$$' $(MAKEFILE_LIST) | sort | awk 'BEGIN {FS = ":.*?## "}; {printf "\033[36m%-30s\033[0m %s\n", $$1, $$2}'
5 changes: 5 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,10 @@
# VectorAPI

[![License](https://img.shields.io/github/license/grafana/vectorapi)](LICENSE)
[![Build Status](https://drone.grafana.net/api/badges/grafana/vectorapi/status.svg)](https://drone.grafana.net/grafana/vectorapi)
[![Docker](https://img.shields.io/docker/v/grafana/vectorapi?logo=docker)](https://hub.docker.com/r/grafana/vectorapi/tags)
[![API Docs](https://img.shields.io/badge/docs-api-blue)](https://grafana.github.io/vectorapi/)

VectorAPI is a service for managing vector collections and performing vector similarity queries using a PostgreSQL vector database with the `pgvector` extension. Utilizes `fastapi` for the HTTP API, `pgvector` and SQLAlchemy for the vector database side and relies on `pytorch` for computing embeddings.

## Getting started
Expand Down

0 comments on commit 0e45a50

Please sign in to comment.