diff --git a/.github/workflows/dependencies.yml b/.github/workflows/dependencies.yml index dc66e4ee..8d4cc92f 100644 --- a/.github/workflows/dependencies.yml +++ b/.github/workflows/dependencies.yml @@ -18,8 +18,8 @@ jobs: - name: Login to DockerHub uses: docker/login-action@v2 with: - username: ${{ secrets.DOCKER_USER }} - password: ${{ secrets.DOCKER_PASS }} + username: ${{ fromJson(secrets.DOCKERHUB).username }} + password: ${{ fromJson(secrets.DOCKERHUB).password }} - name: Build and Push Dependencies Image env: diff --git a/.github/workflows/develop.yml b/.github/workflows/develop.yml index 295f4d26..9c689e02 100644 --- a/.github/workflows/develop.yml +++ b/.github/workflows/develop.yml @@ -25,8 +25,8 @@ jobs: - name: Login to DockerHub uses: docker/login-action@v2 with: - username: ${{ secrets.DOCKER_USER }} - password: ${{ secrets.DOCKER_PASS }} + username: ${{ fromJson(secrets.DOCKERHUB).username }} + password: ${{ fromJson(secrets.DOCKERHUB).password }} - name: Authenticate to Google Cloud uses: google-github-actions/auth@v2 @@ -75,8 +75,8 @@ jobs: - name: Login to DockerHub uses: docker/login-action@v2 with: - username: ${{ secrets.DOCKER_USER }} - password: ${{ secrets.DOCKER_PASS }} + username: ${{ fromJson(secrets.DOCKERHUB).username }} + password: ${{ fromJson(secrets.DOCKERHUB).password }} - name: Build Notebook,docs Docker env: diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index 5cfe6340..5d626540 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -23,8 +23,8 @@ jobs: - name: Login to DockerHub uses: docker/login-action@v2 with: - username: ${{ secrets.DOCKER_USER }} - password: ${{ secrets.DOCKER_PASS }} + username: ${{ fromJson(secrets.DOCKERHUB).username }} + password: ${{ fromJson(secrets.DOCKERHUB).password }} - name: Authenticate to Google Cloud uses: google-github-actions/auth@v2 @@ -69,8 +69,8 @@ jobs: - name: Login to DockerHub uses: docker/login-action@v2 with: - username: ${{ secrets.DOCKER_USER }} - password: ${{ secrets.DOCKER_PASS }} + username: ${{ fromJson(secrets.DOCKERHUB).username }} + password: ${{ fromJson(secrets.DOCKERHUB).password }} - name: Build Notebook env: @@ -102,23 +102,26 @@ jobs: run: 'TOKEN=${{ secrets.GITHUBPAT }} ./github-release.sh' shell: bash - trigger_demos_buils: - runs-on: ubuntu-latest - needs: - - build_notebooks_and_publish_pypi - steps: - - uses: actions/checkout@v3 - - name: repository dispatch + - name: Publish docs content image run: | - curl -X POST https://api.github.com/repos/aperture-data/demos/actions/workflows/13727133/dispatches \ - -H "Accept: application/vnd.github+json" \ - -H "Authorization: Bearer ${{ secrets.GITHUBPAT }}" \ - -H "X-GitHub-Api-Version: 2022-11-28" \ - -d '{"ref":"master","inputs":{}}' + source version.sh + read_version + docker build -f docs-content/Dockerfile -t "aperturedata/aperturedb-python-docs:v$BUILD_VERSION" . + docker push "aperturedata/aperturedb-python-docs:v$BUILD_VERSION" + shell: bash + - name: Update docs provider version in infra + env: + GH_TOKEN: ${{ secrets.PAT_INFRA }} + run: | + source version.sh + read_version + jq -n --arg tag "v$BUILD_VERSION" \ + '{event_type:"update-tag",client_payload:{environment:"develop",component:"python-client",tag:$tag}}' \ + | gh api repos/aperture-data/infra/dispatches --input - shell: bash - trigger_docs_deploy: + trigger_demos_buils: runs-on: ubuntu-latest needs: - build_notebooks_and_publish_pypi @@ -126,7 +129,7 @@ jobs: - uses: actions/checkout@v3 - name: repository dispatch run: | - curl -X POST https://api.github.com/repos/aperture-data/docs/actions/workflows/64451786/dispatches \ + curl -X POST https://api.github.com/repos/aperture-data/demos/actions/workflows/13727133/dispatches \ -H "Accept: application/vnd.github+json" \ -H "Authorization: Bearer ${{ secrets.GITHUBPAT }}" \ -H "X-GitHub-Api-Version: 2022-11-28" \ diff --git a/.github/workflows/nightly.yml b/.github/workflows/nightly.yml index 25401e54..ec251662 100644 --- a/.github/workflows/nightly.yml +++ b/.github/workflows/nightly.yml @@ -20,8 +20,8 @@ jobs: - name: Login to DockerHub uses: docker/login-action@v2 with: - username: ${{ secrets.DOCKER_USER }} - password: ${{ secrets.DOCKER_PASS }} + username: ${{ fromJson(secrets.DOCKERHUB).username }} + password: ${{ fromJson(secrets.DOCKERHUB).password }} - name: Authenticate to Google Cloud uses: google-github-actions/auth@v2 diff --git a/.github/workflows/pr.yaml b/.github/workflows/pr.yaml index 0e680ff3..7a213b07 100644 --- a/.github/workflows/pr.yaml +++ b/.github/workflows/pr.yaml @@ -28,8 +28,8 @@ jobs: - name: Login to DockerHub uses: docker/login-action@v2 with: - username: ${{ secrets.DOCKER_USER }} - password: ${{ secrets.DOCKER_PASS }} + username: ${{ fromJson(secrets.DOCKERHUB).username }} + password: ${{ fromJson(secrets.DOCKERHUB).password }} - name: Authenticate to Google Cloud uses: google-github-actions/auth@v2 @@ -94,8 +94,8 @@ jobs: - name: Login to DockerHub uses: docker/login-action@v2 with: - username: ${{ secrets.DOCKER_USER }} - password: ${{ secrets.DOCKER_PASS }} + username: ${{ fromJson(secrets.DOCKERHUB).username }} + password: ${{ fromJson(secrets.DOCKERHUB).password }} - name: Authenticate to Google Cloud uses: google-github-actions/auth@v2 diff --git a/.github/workflows/release.yaml b/.github/workflows/release.yaml index b1597095..d44f9e87 100644 --- a/.github/workflows/release.yaml +++ b/.github/workflows/release.yaml @@ -27,8 +27,8 @@ jobs: - name: Login to DockerHub uses: docker/login-action@v2 with: - username: ${{ secrets.DOCKER_USER }} - password: ${{ secrets.DOCKER_PASS }} + username: ${{ fromJson(secrets.DOCKERHUB).username }} + password: ${{ fromJson(secrets.DOCKERHUB).password }} - name: Authenticate to Google Cloud uses: google-github-actions/auth@v2 @@ -67,8 +67,8 @@ jobs: - name: Login to DockerHub uses: docker/login-action@v2 with: - username: ${{ secrets.DOCKER_USER }} - password: ${{ secrets.DOCKER_PASS }} + username: ${{ fromJson(secrets.DOCKERHUB).username }} + password: ${{ fromJson(secrets.DOCKERHUB).password }} - name: Build Notebook Docker run: BUILD_COMPLETE=true NO_PUSH=true ./ci.sh diff --git a/aperturedb/Constraints.py b/aperturedb/Constraints.py index 10ed92c1..b85b88cb 100644 --- a/aperturedb/Constraints.py +++ b/aperturedb/Constraints.py @@ -47,6 +47,30 @@ def is_in(self, key, val_array) -> Constraints: self.constraints[self._conjunction][key] = ["in", val_array] return self + def contains(self, key, value) -> Constraints: + self.constraints[self._conjunction][key] = ["contains", value] + return self + + def icontains(self, key, value) -> Constraints: + self.constraints[self._conjunction][key] = ["icontains", value] + return self + + def startswith(self, key, value) -> Constraints: + self.constraints[self._conjunction][key] = ["startswith", value] + return self + + def istartswith(self, key, value) -> Constraints: + self.constraints[self._conjunction][key] = ["istartswith", value] + return self + + def like(self, key, value) -> Constraints: + self.constraints[self._conjunction][key] = ["like", value] + return self + + def ilike(self, key, value) -> Constraints: + self.constraints[self._conjunction][key] = ["ilike", value] + return self + def check(self, entity): for key, op in self.constraints.items(): if key not in entity: diff --git a/aperturedb/__init__.py b/aperturedb/__init__.py index a4fccee9..f61134d4 100644 --- a/aperturedb/__init__.py +++ b/aperturedb/__init__.py @@ -10,7 +10,7 @@ import signal import sys -__version__ = "0.4.60" +__version__ = "0.4.61" logger = logging.getLogger(__name__) diff --git a/docs-content/Dockerfile b/docs-content/Dockerfile new file mode 100644 index 00000000..12ebb11b --- /dev/null +++ b/docs-content/Dockerfile @@ -0,0 +1,7 @@ +FROM alpine:3 +RUN apk add --no-cache bash rsync +COPY aperturedb/ /content/aperturedb/ +COPY examples/ /content/examples/ +COPY docs-content/publish.sh /publish.sh +ENV DOCS_PROVIDER=aperturedb-python +ENTRYPOINT ["bash", "/publish.sh"] diff --git a/docs-content/publish.sh b/docs-content/publish.sh new file mode 100755 index 00000000..98539673 --- /dev/null +++ b/docs-content/publish.sh @@ -0,0 +1,32 @@ +#!/usr/bin/env bash +# Upload a complete content generation to docs over its internal rsync service. +set -euo pipefail + +: "${DOCS_PROVIDER:?DOCS_PROVIDER must be set}" +target=${DOCS_RSYNC_URL-rsync://docs-connections:873/content} +while [[ "$target" == */ ]]; do + target=${target%/} +done +command=(rsync -rlt --mkpath --timeout=120 --contimeout=10) +temporary=$(mktemp -d) +trap 'rm -rf -- "$temporary"' EXIT +trap 'exit 130' INT +trap 'exit 143' TERM +touch "$temporary/.ready" + +while true; do + read -r generation < /proc/sys/kernel/random/uuid + generation=${generation//-/} + destination="$target/$DOCS_PROVIDER/$generation" + + # The receiver ignores this generation until the separate marker arrives. + if "${command[@]}" /content/ "$destination/data/" && + "${command[@]}" "$temporary/.ready" "$destination/"; then + printf 'Uploaded %s %s\n' "$DOCS_PROVIDER" "$generation" + break + else + status=$? + printf 'Upload failed (rsync exit %s); retrying in 10 seconds\n' "$status" >&2 + sleep 10 + fi +done