Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 2 additions & 5 deletions .github/workflows/aot.yml
Original file line number Diff line number Diff line change
Expand Up @@ -32,13 +32,10 @@ jobs:
env:
AWS_DEFAULT_REGION: us-west-1
REG_MAX_VERSIONS: 3
REG_MAX_AGE_MONTHS: 6
REG_WEBSITE_DIR: _deno_website
REG_MAX_AGE_MONTHS: 6
REG_WEBSITE_DIR: _website
REG_PROVIDER_PATH: providers/dist
REG_ARTIFACT_REPO_BUCKET: stackql-registry-artifacts
REG_DENO_DEPLOY_ASSET_REPO: deno-deploy-registry
REG_DENO_DEPLOY_API_DEV: stackql-dev-registry
REG_DENO_DEPLOY_API_PROD: stackql-registry

steps:
- uses: actions/checkout@v7
Expand Down
64 changes: 9 additions & 55 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -21,13 +21,10 @@ jobs:
env:
AWS_DEFAULT_REGION: us-west-1
REG_MAX_VERSIONS: 3
REG_MAX_AGE_MONTHS: 6
REG_WEBSITE_DIR: _deno_website
REG_MAX_AGE_MONTHS: 6
REG_WEBSITE_DIR: _website
REG_PROVIDER_PATH: providers/dist
REG_ARTIFACT_REPO_BUCKET: stackql-registry-artifacts
REG_DENO_DEPLOY_ASSET_REPO: deno-deploy-registry
REG_DENO_DEPLOY_API_DEV: stackql-dev-registry
REG_DENO_DEPLOY_API_PROD: stackql-registry

steps:
- uses: actions/checkout@v7
Expand Down Expand Up @@ -132,7 +129,7 @@ jobs:
#

- name: "[PUBLISH] configure aws credentials"
uses: aws-actions/configure-aws-credentials@v4
uses: aws-actions/configure-aws-credentials@v6
if: env.REG_EVENT == 'push'
with:
aws-access-key-id: ${{ secrets.AWS_ACCESS_KEY_ID }}
Expand All @@ -144,32 +141,18 @@ jobs:
run: |
python scripts/publish/publish-provider-docs-to-artifact-repo.py

- name: "[DEPLOY] setup SSH"
uses: MrSquaare/ssh-setup-action@v3.1.0
if: env.REG_EVENT == 'push'
with:
host: github.com
private-key: ${{ secrets.SSH_PRIVATE_KEY }}

- name: "[DEPLOY] pull deno deploy assets"
if: env.REG_EVENT == 'push'
run: |
git clone git@github.com:stackql/${REG_DENO_DEPLOY_ASSET_REPO}.git
cp ${REG_DENO_DEPLOY_ASSET_REPO}/website/index.ts $REG_WEBSITE_DIR

- name: "[DEPLOY] pull additional docs from artifact repo"
if: env.REG_EVENT == 'push'
run: |
python scripts/deploy/pull-additional-docs-from-artifact-repo.py

#
# Cloudflare (green) dual-publish. Runs here, BEFORE clean-deploy-dir.py
# flattens/destroys the working tree (which removes the origin/ Worker
# source). The full docs tree (changed providers + everything pulled from
# the artifact repo, plus the freshly generated providers.yaml) lives at
# ${REG_WEBSITE_DIR}/${REG_PROVIDER_PATH} at this point, byte-identical to
# what the Deno origin is about to deploy. Same push/branch gating as the
# Deno steps, so blue and green stay in sync during the transition window.
# Cloudflare serving layer. S3 (stackql-registry-artifacts) remains the
# master/archive: the steps above publish changed providers to S3 and
# reconstruct the full docs tree from it. Here that full tree (changed
# providers + everything pulled from the artifact repo, plus the freshly
# generated providers.yaml) lives at ${REG_WEBSITE_DIR}/${REG_PROVIDER_PATH}
# and is mirrored to R2, which the Worker serves from at the edge.
#

- name: "[DEPLOY-CF] install worker deps"
Expand Down Expand Up @@ -228,32 +211,3 @@ jobs:
CLOUDFLARE_ACCOUNT_ID: ${{ secrets.CLOUDFLARE_ACCOUNT_ID }}
run: |
cd origin && npx wrangler deploy --env production

- name: "[DEPLOY] install deno"
if: env.REG_EVENT == 'push'
uses: denoland/setup-deno@main
with:
deno-version: 1.18.2

- name: "[DEPLOY] clean deploy dir"
if: env.REG_EVENT == 'push'
run: |
python scripts/deploy/clean-deploy-dir.py
echo "deployment dir contents: "
tree .
echo "providers.yaml contents: "
cat ${REG_PROVIDER_PATH}/providers.yaml

- name: "[DEPLOY] deploy to deno deploy (dev)"
if: env.REG_TARGET_BRANCH == 'dev' && env.REG_EVENT == 'push'
uses: denoland/deployctl@1.13.1
with:
project: ${{ env.REG_DENO_DEPLOY_API_DEV }}
entrypoint: index.ts

- name: "[DEPLOY] deploy to deno deploy (prod)"
if: env.REG_TARGET_BRANCH == 'main' && env.REG_EVENT == 'push'
uses: denoland/deployctl@1.13.1
with:
project: ${{ env.REG_DENO_DEPLOY_API_PROD }}
entrypoint: index.ts
9 changes: 3 additions & 6 deletions .github/workflows/regression.yml
Original file line number Diff line number Diff line change
Expand Up @@ -76,13 +76,10 @@ jobs:
env:
AWS_DEFAULT_REGION: us-west-1
REG_MAX_VERSIONS: 3
REG_MAX_AGE_MONTHS: 6
REG_WEBSITE_DIR: _deno_website
REG_MAX_AGE_MONTHS: 6
REG_WEBSITE_DIR: _website
REG_PROVIDER_PATH: providers/dist
REG_ARTIFACT_REPO_BUCKET: stackql-registry-artifacts
REG_DENO_DEPLOY_ASSET_REPO: deno-deploy-registry
REG_DENO_DEPLOY_API_DEV: stackql-dev-registry
REG_DENO_DEPLOY_API_PROD: stackql-registry

steps:
- uses: actions/checkout@v7
Expand Down Expand Up @@ -120,7 +117,7 @@ jobs:
python-version: '3.12'

- name: Download python package dist folder
uses: actions/download-artifact@v4.1.2
uses: actions/download-artifact@v8
with:
name: python-package-dist-folder
path: test/dist
Expand Down
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -11,3 +11,4 @@ stackql-core-pkg/
stackql-any-sdk/
.venv/
*.py[co]
/tmp
31 changes: 14 additions & 17 deletions docs/build-and-deployment.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,10 +12,11 @@ The following diagram shows the CI/CD flow for this repository.
SignAndPackage --> Tests[provider\ne2e tests]
end
subgraph Push[triggered by protected branch merge commit]
Tests --> PushArtifacts[/register\nand publish\nartifacts/]
PushArtifacts --> Deno((Deno\nDeploy))
Tests --> PushArtifacts[/register\nand publish\nartifacts to S3/]
PushArtifacts --> SyncR2[/sync docs\nto R2/]
SyncR2 --> Worker((Cloudflare\nWorker))
end
Deno --> End(end)
Worker --> End(end)
ProvUpd -->|no| End
end
```
Expand All @@ -27,7 +28,7 @@ The nodes in the above graph are described in the sections below:
* [package artifacts](#package-artifacts)
* [provider tests](#provider-tests)
* [register and store artifacts](#register-and-store-artifacts)
* [Deno Deploy](#deno-deploy)
* [serve from Cloudflare](#serve-from-cloudflare)
<!--te-->

The following steps are performed on all pull requests to protected branches `dev` or `main` (if providers were updated):
Expand Down Expand Up @@ -73,27 +74,23 @@ Steps include:

#### Publish Artifacts to Provider Registry Artifact Repository

Packaged artifacts are published to the artifact repository in AWS S3 bucket (`stackql-registry-artifacts`). Steps include:
Packaged artifacts are published to the master/archive artifact repository in AWS S3 bucket (`stackql-registry-artifacts`). The full registry tree is then reconstructed from S3 so the complete set of provider docs (plus a freshly generated `providers.yaml`) is available for the serving layer. Steps include:

- `[PUBLISH] configure aws credentials`
- `[PUBLISH] publish provider docs to artifact repo`
- `[DEPLOY] pull additional docs from artifact repo`

#### Deno Deploy
#### Serve from Cloudflare

Provider docs are prepared for distribution via [Deno Deploy](https://deno.com/deploy); this includes pulling the latest versions of the provider docs from the artifact repository and preparing the `index.ts` file for distribution. Steps include:
S3 remains the master/archive store. The reconstructed docs tree is mirrored to Cloudflare R2, and a [Cloudflare Worker](../origin) (source in [origin/](../origin)) serves provider docs from R2 at the edge, logging download analytics to D1. Steps include:

- `[DEPLOY] setup SSH`
- `[DEPLOY] pull deno deploy assets`
- `[DEPLOY] pull additional docs from artifact repo`
- `[DEPLOY] install deno`
- `[DEPLOY-CF] install worker deps`
- `[DEPLOY-CF] sync docs to R2 (dev)` / `[DEPLOY-CF] sync docs to R2 (prod)`
- `[DEPLOY-CF] deploy worker (dev)` / `[DEPLOY-CF] deploy worker (prod)`

The public StackQL Provider Registry is distributed via [Deno Deploy](https://deno.com/deploy), using the following endpoints:
The public StackQL Provider Registry is served from Cloudflare, using the following endpoints:

| Endpoint | Description |
| --- | --- |
| [registry.stackql.app](https://registry.stackql.app/ping) | Production registry (built from `main`) |
| [registry-dev.stackql.app](https://registry.stackql.app/ping) | Development registry (built from `dev`) |

Steps include:

- `[DEPLOY] deploy to deno deploy`
| [registry-dev.stackql.app](https://registry-dev.stackql.app/ping) | Development registry (built from `dev`) |
Loading
Loading