SkybuDocs

Ferdigheter · Apper

Previews and approval

Work with pull request previews and their own databases, and handle production deployments that wait for an owner's approval.

skill://apps/previews-and-approvalAgenter leser den med resources/read eller skills_read. Den er skrevet på engelsk, for agentene.

Two things sit between a change and production. A preview runs each pull request (merge request on GitLab) on its own address, with its own empty database, so it can be tried before it is merged. The organisation's approval rule can make production deployments wait until an owner approves them. Agents can use previews freely, but they can never approve.

In short

  1. Previews need an app linked to GitHub or GitLab (skill://apps/deploy-from-git). Each pull request then gets one.
  2. list_previews gives their addresses and latest deployments.
  3. get_preview_database_credentials and reset_preview_database work on a preview's database.
  4. A production deployment in awaiting_approval waits for an owner. list_pending_approvals shows them. Tell the user; do not try to get around it.

Previews

Opening or reopening a pull request, or pushing to one, builds its head commit into a preview. Closing or merging it deletes the preview, its database included.

{ "name": "list_previews", "arguments": { "appId": "<app id>" } }

Each preview has its pull request number, title, branch, its address, url (set once it is live), the latest deployment's status, error and commit, and database.status. The address is usually <app>-pr-<n>.<org>.skybu.app. Follow a build with get_deployment like any other (skill://apps/fix-a-failed-deploy); if a new commit fails, the previous preview keeps answering.

What a preview gets:

  • The app's preview variables only, at build and run time; never production's (skill://apps/environment-variables).
  • Its own empty database when the project has a database (not one set up for a Supabase import). Nothing is copied from production.
  • The app's size and its access setting: a members-only app has members-only previews (skill://access/members-only-apps).
  • No file storage variables (SKYBU_S3_*).

Limits: a few open previews per app (previewsPerApp from get_github_status, 3 by default). Another pull request gets a comment saying the limit is reached; closing one and pushing again gives it a preview. Pull requests from forks get no preview at all, so their code never runs with the preview variables; a maintainer can push the branch to the repository instead. Previews never wait for approval and do not count against the organisation's app quota.

The preview's database

Created with the preview, kept across pushes, dropped when the pull request closes. The preview gets DATABASE_URL (read and write rows) and DATABASE_URL_DIRECT (owner, for migrations). Since it starts empty, the app must create its tables and any seed data itself when it starts.

{ "name": "get_preview_database_credentials", "arguments": { "appId": "<app id>", "number": 42 } }

number is the pull request number (the merge request's IID on GitLab). Every read is logged. It needs deployments:write, not secrets:read. database_not_ready means it is still being created. The connection strings work from apps in the same project; from the user's machine, skybu db connect <app id> --preview <n> opens a tunnel.

To start over with an empty database (destructive; the preview restarts against the new one):

{ "name": "reset_preview_database", "arguments": { "appId": "<app id>", "number": 42 } }

If previews use more than their share of the project database's disk, Skybu pauses the largest preview database (database.status is paused). It stays paused until it is reset.

Approval before production

Owners choose a rule under Settings → General in the dashboard (https://platform.skybu.no/#/org/settings/general):

RuleProduction deployments that wait
Off (the default)None
Apps with personal dataApps whose data class is personal, sensitive, or not set
All appsEvery app

A covered deployment builds as usual, then stops as awaiting_approval instead of going live. Every route waits: a deploy from files or an upload, a Git push (the commit status says so), and rollback_app, which answers approval: "pending". The current version keeps serving meanwhile.

{ "name": "list_pending_approvals", "arguments": {} }

Lists the waiting deployments with app, project, data class, owner, number, kind (deploy or rollback), commit, who asked and when.

Agents cannot approve or reject, and no tool does it. When a deployment waits, tell the user which app and number, and that an organisation owner must decide:

  • in the dashboard, in the app's deployment history, or
  • with the CLI: skybu approve <app> <number> [--note text] or skybu reject <app> <number> [--note text] (skybu approvals lists them).

Approving starts the rollout; follow it with get_deployment until live. Rejecting a deploy sets it to rejected and the current version stays live; rejecting a rollback leaves the app where it is.

Things to know

  • Never lower an app's data class with update_app_details to get past the rule. The data class describes the app's data, and changes are in the audit log.
  • Requests, approvals and rejections are in the audit log with who asked, who decided and the note.
  • A preview build starts with an empty build cache, so it takes as long as a first build.
  • Previews run in the app's project, next to the production app, but have no production credentials.
  • A key or connection limited to previews can use preview databases but cannot touch production.