Lokasi ngalangkungan proxy:   [ UP ]  
[Ngawartoskeun bug]   [Panyetelan cookie]                
Skip to Content
PyoDocs

Deploy from CI

Use the CLI in a pipeline with an API key.

In CI there's no browser to sign in with, so use an API key. Create one with deploy access and an expiry you'll remember to renew. Then give the CLI your Pyo's URL and the key:

curl -fsSL https://pyo.dev/cli.sh | sh
export PATH="$HOME/.local/bin:$PATH"
export PYO_URL=https://your-pyo
export PYO_API_KEY=<api-key>
pyo deploy

You can pass --url and --token instead. Both work on every command.

If the folder has no pyo.jsonc, say which service to deploy:

pyo deploy --service shop/api

A service built from a folder gets the folder CI checked out, the same as pyo deploy on your computer. A new one needs its name and project, since there's no one to ask, and an API key with full access:

pyo deploy --name web --project shop

pyo deploy exits with an error when the build or deploy fails, so the pipeline fails too.

Deploy a tag or digest

When CI builds and pushes the image itself, deploy exactly that image with --ref. A key with deploy access is enough:

pyo deploy --service shop/web --ref v1.2.3
pyo deploy --service shop/web --ref sha256:<64 hex>
  • It's for services that run an image. It changes only the tag or digest, never the image's registry or repository.
  • The service keeps the reference, so the next pyo deploy runs it again.
  • Pyo looks a tag up in its registry before the rollout and runs the digest the tag points to now. An older image a server has under that tag never runs. A digest is safest when the same tag is pushed more than once.
  • If the deploy fails, is rolled back or is cancelled, the service gets its reference from before back.

Two cases print a warning and still deploy:

  • The cluster's agent is older than 0.52.1. It may run an older image already on the server for that tag. Update the cluster, or deploy a digest.
  • Pyo can't reach the registry to look the tag up, for example on a cluster that pulls through a registry mirror. The servers then pull the tag fresh, and Pyo records the digest they run. Rollbacks use that digest.

A registry that answers but has no such tag, or refuses Pyo's login, fails the deploy. Nothing changes then.

The same works over a deploy hook, the deploy operation's reference in the API, and the reference of the MCP tool deploy_service.

Without the CLI

A deploy hook is simpler when all you need is to trigger a deploy.