Repository navigation
app/: processing holds no long transaction and no blob locks; ProcessBuild timeout fits big builds #752
Workflow file for this run
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| # VisualCI's CI: lint, test (Rust with Postgres and MinIO, the Ruby client, the frontend build), then on main build and | |
| # push the server and renderer images and deploy them by committing their digests to talira-ai/infra | |
| # (k3s/resources/visualci/kustomization.yaml), which ArgoCD applies. That commit is the deploy; reverting it is the | |
| # rollback. | |
| name: CI | |
| on: | |
| push: | |
| branches: [main] | |
| pull_request: | |
| workflow_dispatch: | |
| permissions: | |
| contents: read | |
| concurrency: | |
| group: ci-${{ github.ref }} | |
| cancel-in-progress: ${{ github.ref != 'refs/heads/main' }} | |
| env: | |
| CARGO_TERM_COLOR: always | |
| jobs: | |
| lint: | |
| runs-on: ${{ fromJSON(vars.CI_RUNNER || '"ubuntu-latest"') }} | |
| environment: ${{ github.ref == 'refs/heads/main' && 'kache-write' || '' }} | |
| timeout-minutes: 30 | |
| steps: | |
| - uses: actions/checkout@v4 | |
| # Compile cache (kache, as Cargo's rustc wrapper): the R2 bucket every machine shares (KACHE_BUCKET), else the | |
| # GitHub Actions cache. Only main writes it: the read-write key is a secret of the kache-write environment, | |
| # which only main may use, so a pull request (whatever its ci.yml says) gets the read-only key. | |
| - uses: kunobi-ninja/kache-action@061011817fd04b0e460f79d6bb3c115b1fc8f029 # v1 | |
| with: | |
| version: "2.4.0" | |
| cache-key-prefix: kache-${{ github.job }} | |
| save-cache: ${{ github.ref == 'refs/heads/main' }} | |
| pr-comment: false | |
| s3-bucket: ${{ vars.KACHE_BUCKET }} | |
| s3-endpoint: ${{ vars.KACHE_ENDPOINT }} | |
| s3-region: auto | |
| s3-prefix: visualci | |
| s3-access-key-id: ${{ github.ref == 'refs/heads/main' && secrets.KACHE_RW_ACCESS_KEY_ID || secrets.KACHE_RO_ACCESS_KEY_ID }} | |
| s3-secret-access-key: ${{ github.ref == 'refs/heads/main' && secrets.KACHE_RW_SECRET_ACCESS_KEY || secrets.KACHE_RO_SECRET_ACCESS_KEY }} | |
| - run: rustup show active-toolchain || rustup toolchain install | |
| - run: cargo fmt --all --check | |
| - run: cargo clippy --locked --workspace --all-targets -- -D warnings | |
| # snapshot-diff goes on crates.io: it builds without its schemars feature too. | |
| - run: cargo clippy --locked -p snapshot-diff --no-default-features --all-targets -- -D warnings | |
| # The Laravel Rust app (app/, sc-8900): its own workspace until it replaces server/ at cutover. Not deployed yet. | |
| app: | |
| runs-on: ${{ fromJSON(vars.CI_RUNNER || '"ubuntu-latest"') }} | |
| environment: ${{ github.ref == 'refs/heads/main' && 'kache-write' || '' }} | |
| timeout-minutes: 40 | |
| services: | |
| postgres: | |
| image: postgres:17 | |
| env: | |
| POSTGRES_USER: visualci | |
| POSTGRES_PASSWORD: visualci | |
| POSTGRES_DB: visualci_app_test | |
| ports: ["55433:5432"] | |
| options: --health-cmd pg_isready --health-interval 5s --health-timeout 5s --health-retries 10 | |
| defaults: | |
| run: | |
| working-directory: app | |
| steps: | |
| - uses: actions/checkout@v4 | |
| # S3 storage for the blob tests: RustFS, as the visual job uses. | |
| - run: | | |
| docker run -d --name s3 -p 59000:9000 \ | |
| -e RUSTFS_ACCESS_KEY=visualci -e RUSTFS_SECRET_KEY=visualci-dev-secret rustfs/rustfs:1.0.6 | |
| for _ in $(seq 1 30); do curl -s -o /dev/null http://127.0.0.1:59000/ && break; sleep 1; done | |
| # Trial (c) on this job: rust-cache restores target/ (incremental state and our own crates), with kache behind | |
| # it for dependency misses. Its key covers Cargo.lock and the toolchain; only main saves it, like kache. | |
| - uses: Swatinem/rust-cache@v2 | |
| with: | |
| workspaces: app | |
| save-if: ${{ github.ref == 'refs/heads/main' }} | |
| # Compile cache (kache, as Cargo's rustc wrapper): the R2 bucket every machine shares (KACHE_BUCKET), else the | |
| # GitHub Actions cache. Only main writes it: the read-write key is a secret of the kache-write environment, | |
| # which only main may use, so a pull request (whatever its ci.yml says) gets the read-only key. | |
| - uses: kunobi-ninja/kache-action@061011817fd04b0e460f79d6bb3c115b1fc8f029 # v1 | |
| with: | |
| version: "2.4.0" | |
| cache-key-prefix: kache-${{ github.job }} | |
| save-cache: ${{ github.ref == 'refs/heads/main' }} | |
| pr-comment: false | |
| s3-bucket: ${{ vars.KACHE_BUCKET }} | |
| s3-endpoint: ${{ vars.KACHE_ENDPOINT }} | |
| s3-region: auto | |
| s3-prefix: visualci | |
| s3-access-key-id: ${{ github.ref == 'refs/heads/main' && secrets.KACHE_RW_ACCESS_KEY_ID || secrets.KACHE_RO_ACCESS_KEY_ID }} | |
| s3-secret-access-key: ${{ github.ref == 'refs/heads/main' && secrets.KACHE_RW_SECRET_ACCESS_KEY || secrets.KACHE_RO_SECRET_ACCESS_KEY }} | |
| - run: rustup show active-toolchain || rustup toolchain install | |
| - run: cargo fmt --check | |
| - run: cargo clippy --locked --all-targets -- -D warnings | |
| - run: cargo test --locked | |
| # The CLI changed since its last release without a version bump: the docs would describe a CLI nobody can download. | |
| # Not needed by deploy, so it never holds back the server. | |
| cli-version: | |
| runs-on: ubuntu-latest | |
| timeout-minutes: 5 | |
| steps: | |
| - uses: actions/checkout@v4 | |
| with: | |
| fetch-depth: 0 | |
| - run: scripts/ci/cli_version.sh | |
| # The CircleCI orb's scripts (clients/circleci-orb), rendered and linted: validating it with CircleCI needs a token. | |
| orb: | |
| runs-on: ubuntu-latest | |
| timeout-minutes: 5 | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - run: command -v shellcheck >/dev/null || (sudo apt-get update && sudo apt-get install -y shellcheck) | |
| - run: python3 -c 'import yaml' 2>/dev/null || pip install pyyaml | |
| - run: python3 scripts/ci/check_orb.py | |
| test: | |
| runs-on: ${{ fromJSON(vars.CI_RUNNER || '"ubuntu-latest"') }} | |
| environment: ${{ github.ref == 'refs/heads/main' && 'kache-write' || '' }} | |
| timeout-minutes: 40 | |
| services: | |
| postgres: | |
| image: postgres:17 | |
| env: | |
| POSTGRES_USER: loco | |
| POSTGRES_PASSWORD: loco | |
| POSTGRES_DB: visualci_server_test | |
| ports: ["55433:5432"] | |
| options: --health-cmd pg_isready --health-interval 5s --health-timeout 5s --health-retries 10 | |
| steps: | |
| - uses: actions/checkout@v4 | |
| # Compile cache (kache, as Cargo's rustc wrapper): the R2 bucket every machine shares (KACHE_BUCKET), else the | |
| # GitHub Actions cache. Only main writes it: the read-write key is a secret of the kache-write environment, | |
| # which only main may use, so a pull request (whatever its ci.yml says) gets the read-only key. | |
| - uses: kunobi-ninja/kache-action@061011817fd04b0e460f79d6bb3c115b1fc8f029 # v1 | |
| with: | |
| version: "2.4.0" | |
| cache-key-prefix: kache-${{ github.job }} | |
| save-cache: ${{ github.ref == 'refs/heads/main' }} | |
| pr-comment: false | |
| s3-bucket: ${{ vars.KACHE_BUCKET }} | |
| s3-endpoint: ${{ vars.KACHE_ENDPOINT }} | |
| s3-region: auto | |
| s3-prefix: visualci | |
| s3-access-key-id: ${{ github.ref == 'refs/heads/main' && secrets.KACHE_RW_ACCESS_KEY_ID || secrets.KACHE_RO_ACCESS_KEY_ID }} | |
| s3-secret-access-key: ${{ github.ref == 'refs/heads/main' && secrets.KACHE_RW_SECRET_ACCESS_KEY || secrets.KACHE_RO_SECRET_ACCESS_KEY }} | |
| # The request tests also write the MCP tools' and REST API's answers as JSON snapshots, for the visual job. | |
| - run: cargo test --locked --workspace | |
| env: | |
| VISUALCI_JSON_SNAPSHOTS: ${{ github.workspace }}/tmp/json-snapshots/json | |
| # Every customer email (server/src/notify.rs), rendered with sample data, as HTML and text. | |
| VISUALCI_EMAIL_SNAPSHOTS: ${{ github.workspace }}/tmp/json-snapshots/emails | |
| - uses: actions/upload-artifact@v4 | |
| with: | |
| name: json-snapshots | |
| path: tmp/json-snapshots | |
| if-no-files-found: error | |
| retention-days: 7 | |
| # VisualCI tests itself: screenshots of the landing page, docs and app (against seeded data), Vitest component | |
| # snapshots and the JSON snapshots from `test`, sent as one build to the docspring/visualci project. A changed | |
| # snapshot doesn't fail this job: the GitHub check waits for review. Pull requests from forks have no token and skip | |
| # the upload. | |
| visual: | |
| needs: [test] | |
| runs-on: ${{ fromJSON(vars.CI_RUNNER || '"ubuntu-latest"') }} | |
| environment: ${{ github.ref == 'refs/heads/main' && 'kache-write' || '' }} | |
| timeout-minutes: 30 | |
| services: | |
| postgres: | |
| image: postgres:17 | |
| env: | |
| POSTGRES_USER: loco | |
| POSTGRES_PASSWORD: loco | |
| POSTGRES_DB: visualci_screenshots | |
| ports: ["55433:5432"] | |
| options: --health-cmd pg_isready --health-interval 5s --health-timeout 5s --health-retries 10 | |
| steps: | |
| - uses: actions/checkout@v4 | |
| with: | |
| # The CLI sends parent commits, so the build finds its baseline. | |
| fetch-depth: 101 | |
| # S3 storage for the seeded blobs: RustFS (Apache-2.0), since MinIO's images are no longer public. A step rather | |
| # than a service, so the job doesn't wait on a health check the image doesn't define. | |
| - run: | | |
| docker run -d --name s3 -p 59000:9000 \ | |
| -e RUSTFS_ACCESS_KEY=visualci -e RUSTFS_SECRET_KEY=visualci-dev-secret rustfs/rustfs:1.0.6 | |
| for _ in $(seq 1 30); do curl -s -o /dev/null http://127.0.0.1:59000/ && break; sleep 1; done | |
| # Compile cache (kache, as Cargo's rustc wrapper): the R2 bucket every machine shares (KACHE_BUCKET), else the | |
| # GitHub Actions cache. Only main writes it: the read-write key is a secret of the kache-write environment, | |
| # which only main may use, so a pull request (whatever its ci.yml says) gets the read-only key. | |
| - uses: kunobi-ninja/kache-action@061011817fd04b0e460f79d6bb3c115b1fc8f029 # v1 | |
| with: | |
| version: "2.4.0" | |
| cache-key-prefix: kache-${{ github.job }} | |
| save-cache: ${{ github.ref == 'refs/heads/main' }} | |
| pr-comment: false | |
| s3-bucket: ${{ vars.KACHE_BUCKET }} | |
| s3-endpoint: ${{ vars.KACHE_ENDPOINT }} | |
| s3-region: auto | |
| s3-prefix: visualci | |
| s3-access-key-id: ${{ github.ref == 'refs/heads/main' && secrets.KACHE_RW_ACCESS_KEY_ID || secrets.KACHE_RO_ACCESS_KEY_ID }} | |
| s3-secret-access-key: ${{ github.ref == 'refs/heads/main' && secrets.KACHE_RW_SECRET_ACCESS_KEY || secrets.KACHE_RO_SECRET_ACCESS_KEY }} | |
| - run: cargo build --locked -p visualci_server -p visualci-cli | |
| - uses: pnpm/action-setup@v4 | |
| with: | |
| package_json_file: server/frontend/package.json | |
| - uses: actions/setup-node@v4 | |
| with: | |
| node-version: "24" | |
| # skills/ is generated from the docs pages: fail when someone edited one without the other. | |
| - run: node scripts/skills.mjs --check | |
| working-directory: server/frontend | |
| - run: pnpm install --frozen-lockfile && pnpm build | |
| working-directory: server/frontend | |
| - run: pnpm install --frozen-lockfile && pnpm exec playwright install --with-deps chromium | |
| working-directory: scripts/screenshots | |
| - run: scripts/ci/visual.sh capture | |
| - uses: actions/download-artifact@v4 | |
| with: | |
| name: json-snapshots | |
| path: tmp/json-snapshots | |
| # VisualCI's own GitHub Action (clients/github-action), with the CLI this commit built. | |
| - uses: ./clients/github-action | |
| with: | |
| token: ${{ secrets.VISUALCI_TOKEN }} | |
| cli: target/debug/visualci | |
| upload: | | |
| tmp/visual/screenshots --prefix screenshots/ --platform chrome-linux | |
| tmp/visual/site --prefix site/ | |
| tmp/visual/site/docs/quick-start.md --prefix site/docs/ --format text | |
| server/frontend/src --from vitest --prefix components/ | |
| tmp/json-snapshots/json --prefix json/ --format json | |
| tmp/json-snapshots/emails --prefix emails/ --keep-extension | |
| - if: failure() | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: visual | |
| path: tmp/visual | |
| retention-days: 7 | |
| clients: | |
| runs-on: ${{ fromJSON(vars.CI_RUNNER || '"ubuntu-latest"') }} | |
| environment: ${{ github.ref == 'refs/heads/main' && 'kache-write' || '' }} | |
| timeout-minutes: 15 | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - uses: ruby/setup-ruby@v1 | |
| with: | |
| ruby-version: "3.4" | |
| - run: ruby -Ilib spec/visualci_spec.rb | |
| working-directory: clients/ruby | |
| - uses: pnpm/action-setup@v4 | |
| with: | |
| package_json_file: server/frontend/package.json | |
| - uses: actions/setup-node@v4 | |
| with: | |
| node-version: "24" | |
| # The Compare two PDFs page runs crates/visualci-wasm in the browser (scripts/wasm.mjs builds it). | |
| - run: rustup target add wasm32-unknown-unknown | |
| # Compile cache (kache, as Cargo's rustc wrapper): the R2 bucket every machine shares (KACHE_BUCKET), else the | |
| # GitHub Actions cache. Only main writes it: the read-write key is a secret of the kache-write environment, | |
| # which only main may use, so a pull request (whatever its ci.yml says) gets the read-only key. | |
| - uses: kunobi-ninja/kache-action@061011817fd04b0e460f79d6bb3c115b1fc8f029 # v1 | |
| with: | |
| version: "2.4.0" | |
| cache-key-prefix: kache-${{ github.job }} | |
| save-cache: ${{ github.ref == 'refs/heads/main' }} | |
| pr-comment: false | |
| s3-bucket: ${{ vars.KACHE_BUCKET }} | |
| s3-endpoint: ${{ vars.KACHE_ENDPOINT }} | |
| s3-region: auto | |
| s3-prefix: visualci | |
| s3-access-key-id: ${{ github.ref == 'refs/heads/main' && secrets.KACHE_RW_ACCESS_KEY_ID || secrets.KACHE_RO_ACCESS_KEY_ID }} | |
| s3-secret-access-key: ${{ github.ref == 'refs/heads/main' && secrets.KACHE_RW_SECRET_ACCESS_KEY || secrets.KACHE_RO_SECRET_ACCESS_KEY }} | |
| # The production site: with the Plausible snippets (analytics.ts) and, required, the WebAssembly. | |
| - run: pnpm install --frozen-lockfile && VISUALCI_ANALYTICS=1 VISUALCI_REQUIRE_WASM=1 pnpm build | |
| working-directory: server/frontend | |
| # visualci.com's static site: assembled from the build and checked (every docs page has its Markdown copy, and | |
| # llms.txt links each one), then deployed by the site job. | |
| - run: VISUALCI_ANALYTICS=1 node scripts/site.mjs | |
| working-directory: server/frontend | |
| env: | |
| GITHUB_TOKEN: ${{ github.token }} | |
| VISUALCI_REQUIRE_WASM: "1" | |
| - uses: actions/upload-artifact@v4 | |
| with: | |
| name: dist-site | |
| path: server/frontend/dist-site | |
| # .well-known/agent-skills/ is hidden, and upload-artifact leaves hidden files out by default. | |
| include-hidden-files: true | |
| retention-days: 7 | |
| # visualci.com is a Cloudflare Worker with static assets (server/frontend/site/wrangler.jsonc), deployed on main | |
| # before the server, so the apex never points at a server that no longer serves it. Needs the repo secret | |
| # CLOUDFLARE_API_TOKEN (Workers Scripts on the DocSpring Products account, Workers Routes on visualci.com) and the | |
| # repo variable CLOUDFLARE_ACCOUNT_ID; without them it warns and skips. | |
| site: | |
| needs: [lint, test, clients] | |
| if: github.ref == 'refs/heads/main' && github.event_name != 'pull_request' | |
| runs-on: ${{ fromJSON(vars.CI_RUNNER || '"ubuntu-latest"') }} | |
| timeout-minutes: 10 | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - uses: actions/download-artifact@v4 | |
| with: | |
| name: dist-site | |
| path: server/frontend/dist-site | |
| - uses: actions/setup-node@v4 | |
| with: | |
| node-version: "24" | |
| - name: Deploy to Cloudflare | |
| working-directory: server/frontend/site | |
| env: | |
| CLOUDFLARE_API_TOKEN: ${{ secrets.CLOUDFLARE_API_TOKEN }} | |
| CLOUDFLARE_ACCOUNT_ID: ${{ vars.CLOUDFLARE_ACCOUNT_ID }} | |
| WRANGLER_SEND_METRICS: "false" | |
| run: | | |
| if [ -z "$CLOUDFLARE_API_TOKEN" ] || [ -z "$CLOUDFLARE_ACCOUNT_ID" ]; then | |
| echo "::warning::CLOUDFLARE_API_TOKEN or CLOUDFLARE_ACCOUNT_ID isn't set: visualci.com wasn't deployed." | |
| exit 0 | |
| fi | |
| npx --yes wrangler@4.168.0 deploy | |
| images: | |
| needs: [lint, test, clients] | |
| if: github.ref == 'refs/heads/main' && github.event_name != 'pull_request' | |
| runs-on: ${{ fromJSON(vars.CI_RUNNER || '"ubuntu-latest"') }} | |
| timeout-minutes: 60 | |
| permissions: | |
| contents: read | |
| packages: write | |
| outputs: | |
| server: ${{ steps.server.outputs.digest }} | |
| app: ${{ steps.app.outputs.digest }} | |
| renderer: ${{ steps.renderer.outputs.digest }} | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - id: version | |
| run: echo "renderer=$(cat docker/renderer.version)" >>"$GITHUB_OUTPUT" | |
| - uses: docker/setup-buildx-action@v3 | |
| - uses: docker/login-action@v3 | |
| with: | |
| registry: ghcr.io | |
| username: ${{ github.actor }} | |
| password: ${{ secrets.GITHUB_TOKEN }} | |
| - id: server | |
| uses: docker/build-push-action@v6 | |
| with: | |
| context: . | |
| file: docker/server.Dockerfile | |
| push: true | |
| build-args: | | |
| BUILD_SHA=${{ github.sha }} | |
| RENDERER_VERSION=${{ steps.version.outputs.renderer }} | |
| VISUALCI_ANALYTICS=1 | |
| tags: ghcr.io/docspring/visualci-server:${{ github.sha }} | |
| cache-from: type=gha,scope=server | |
| cache-to: type=gha,mode=max,scope=server | |
| # VisualCI on Laravel Rust (app/, sc-8900): built on main so the cutover has an image ready, deployed only at | |
| # cutover (talira-ai/infra k3s/resources/visualci/laravel) | |
| - id: app | |
| uses: docker/build-push-action@v6 | |
| with: | |
| context: . | |
| file: docker/app.Dockerfile | |
| push: true | |
| build-args: | | |
| BUILD_SHA=${{ github.sha }} | |
| RENDERER_VERSION=${{ steps.version.outputs.renderer }} | |
| VISUALCI_ANALYTICS=1 | |
| tags: ghcr.io/docspring/visualci-app:${{ github.sha }} | |
| cache-from: type=gha,scope=app | |
| cache-to: type=gha,mode=max,scope=app | |
| # The renderer is rebuilt only when its inputs change, so its digest (and the running renderers) stay put | |
| # through deploys that only touch the server. Rebuilding an unchanged renderer would give a new digest and roll | |
| # the renderers mid-build for nothing. | |
| - id: renderer_inputs | |
| run: | | |
| hash=$(git ls-files -s docker/renderer.Dockerfile docker/renderer.version crates/visualci-core crates/visualci-renderer Cargo.toml Cargo.lock rust-toolchain.toml | sha256sum | cut -c1-24) | |
| echo "tag=ghcr.io/docspring/visualci-renderer:inputs-$hash" >>"$GITHUB_OUTPUT" | |
| if digest=$(docker buildx imagetools inspect "ghcr.io/docspring/visualci-renderer:inputs-$hash" --format '{{json .Manifest}}' 2>/dev/null | python3 -c 'import json,sys; print(json.load(sys.stdin)["digest"])'); then | |
| echo "existing=$digest" >>"$GITHUB_OUTPUT" | |
| echo "::notice::Renderer inputs unchanged: reusing $digest" | |
| fi | |
| - id: renderer_build | |
| if: steps.renderer_inputs.outputs.existing == '' | |
| uses: docker/build-push-action@v6 | |
| with: | |
| context: . | |
| file: docker/renderer.Dockerfile | |
| push: true | |
| build-args: RENDERER_VERSION=${{ steps.version.outputs.renderer }} | |
| tags: | | |
| ${{ steps.renderer_inputs.outputs.tag }} | |
| ghcr.io/docspring/visualci-renderer:${{ github.sha }} | |
| cache-from: type=gha,scope=renderer | |
| cache-to: type=gha,mode=max,scope=renderer | |
| - id: renderer | |
| run: echo "digest=${{ steps.renderer_inputs.outputs.existing || steps.renderer_build.outputs.digest }}" >>"$GITHUB_OUTPUT" | |
| deploy: | |
| needs: [images, site] | |
| if: github.ref == 'refs/heads/main' && github.event_name != 'pull_request' && vars.DEPLOY_ENABLED == 'true' | |
| runs-on: ${{ fromJSON(vars.CI_RUNNER || '"ubuntu-latest"') }} | |
| timeout-minutes: 5 | |
| env: | |
| SERVER_DIGEST: ${{ needs.images.outputs.server }} | |
| RENDERER_DIGEST: ${{ needs.images.outputs.renderer }} | |
| KUSTOMIZATION: infra/k3s/resources/visualci/kustomization.yaml | |
| steps: | |
| - uses: actions/checkout@v4 | |
| with: | |
| fetch-depth: 0 | |
| # A write deploy key on talira-ai/infra, used for this push only; it also signs the commit. | |
| - name: talira-ai/infra | |
| env: | |
| INFRA_DEPLOY_KEY: ${{ secrets.INFRA_DEPLOY_KEY }} | |
| run: | | |
| install -m 700 -d ~/.ssh | |
| printf '%s\n' "$INFRA_DEPLOY_KEY" >~/.ssh/infra | |
| chmod 600 ~/.ssh/infra | |
| echo 'github.com ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIOMqqnkVzrm0SdG6UOoqKLsabgH5C9okWi0dh2l9GKJl' >~/.ssh/known_hosts | |
| export GIT_SSH_COMMAND="ssh -i $HOME/.ssh/infra -o IdentitiesOnly=yes" | |
| git clone -q --depth 50 git@github.com:talira-ai/infra.git infra | |
| git -C infra config user.name 'VisualCI CI' | |
| git -C infra config user.email 'ci@visualci.com' | |
| git -C infra config gpg.format ssh | |
| git -C infra config user.signingkey "$HOME/.ssh/infra" | |
| git -C infra config commit.gpgsign true | |
| # Production only moves forward: the commit production runs must be an ancestor of this one. | |
| - name: Commit the digests | |
| run: | | |
| export GIT_SSH_COMMAND="ssh -i $HOME/.ssh/infra -o IdentitiesOnly=yes" | |
| deployed=$(sed -n 's/^# visualci commit: \([0-9a-f]\{40\}\)$/\1/p' "$KUSTOMIZATION") | |
| # The placeholder commit (all zeros) means nothing is deployed yet. | |
| if [ -n "$deployed" ] && [ "$deployed" != 0000000000000000000000000000000000000000 ] && | |
| ! git merge-base --is-ancestor "$deployed" "$GITHUB_SHA"; then | |
| echo "::notice::Not deployed: production runs $deployed, which this commit doesn't come after"; exit 0 | |
| fi | |
| for _ in 1 2 3 4 5; do | |
| python3 scripts/ci/set_digests.py "$KUSTOMIZATION" "$GITHUB_SHA" "$SERVER_DIGEST" "$RENDERER_DIGEST" | |
| git -C infra commit -qam "visualci: deploy ${GITHUB_SHA::12}" -m "$(git log -1 --format=%s "$GITHUB_SHA" | cut -c1-120)" | |
| if git -C infra push -q origin HEAD:main; then exit 0; fi | |
| git -C infra fetch -q origin main && git -C infra reset -q --hard origin/main | |
| done | |
| exit 1 |