CI/CD
Run lly in a CI pipeline. Unattended pipelines are not possible yet.
Unattended pipelines are not possible yet
A pipeline needs a credential that stays valid between runs. LILY does not issue one yet. Access tokens expire about 15 minutes after they are issued, and no command creates a token for CI. Dedicated pipeline credentials are planned. Until then, the workflow on this page only works for short jobs that receive a fresh token. Do not copy your local session into a pipeline: sessions rotate on renewal, and a copied session is terminated as soon as both copies are used.
LILY does not deploy automatically on push. This page describes how lly behaves in a CI pipeline, so that a pipeline can deploy on push once pipeline credentials are available.
lly has no separate CI mode. Without a terminal it does not prompt, so all input must come from flags, environment variables or a lily.toml. The exit code reports the result.
Authentication
In a pipeline, lly reads an access token from LLY_ACCESS_TOKEN instead of a browser sign-in. The token is used as is: it is not stored and not renewed. It belongs to one workspace; -w and lly workspace <name> cannot change it. For deploy, init and redeploy, the token also authorizes the fetch from GitHub.
export LLY_ACCESS_TOKEN="<token>" # from the CI secret store
lly whoamiProvide all input
Without a terminal, lly exits with code 2 if a choice is open and names the flag to set:
error: which roots? pass --apps ROOT,... or --all; supported: apps/web, services/apiSet project, ref and apps with flags or in a lily.toml:
lly deploy --project shop --ref main --apps apps/web,services/apiDefaults with -y
| Situation | With -y |
|---|---|
| Roots to deploy | All supported roots |
| Project name taken | Suggested name, for example shop-2 |
| Proposed variable without value | Skipped |
| Proposed connection | Accepted |
delete, domain remove | Confirmed |
Without -y and without a terminal, lly exits if the roots are not set or a confirmation defaults to no. Prompts that default to yes, such as proposed connections, are accepted.
Pipeline setup for deploy on push
This setup does not run unattended today. The token in LLY_ACCESS_TOKEN expires about 15 minutes after it is issued, so a job only works while the token is fresh. The section shows how a pipeline is wired, so that it works once pipeline credentials are available.
lly deploy with the same repository and ref redeploys the existing apps. The same command works for the first and every following deploy. It reads the repository from the origin remote of the checkout, which must point to GitHub.
GitHub Actions
name: Deploy
on:
push:
branches: [main]
jobs:
deploy:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- run: curl -fsSL https://get.lilylabs.io/install.sh | sh -s -- --system
- run: lly deploy --project shop --ref main -y
env:
LLY_ACCESS_TOKEN: ${{ secrets.LLY_ACCESS_TOKEN }}Other CI systems
If the checkout does not come from GitHub, name the repository:
lly deploy acme/shop --project shop --ref main -ySingle app at a specific commit
lly redeploy copperfox --project shop --ref "$GITHUB_SHA"Results
lly deploy follows the build and exits when all apps are deployed or one has failed. The job result matches the deploy result.
| Code | Meaning |
|---|---|
0 | Deployed |
2 | Open choice. The message names the flag. |
3 | Token missing, expired or without permission |
5 | Another build or command is running |
6 | LILY or GitHub unreachable, or timeout. Retry the job. |
7 | Build or rollout failed. lly attach --build <slug> shows the cause. |
--detachreturns after the configuration is accepted. The job succeeds even if the build fails later.--jsonprints results as JSON on stdout and progress on stderr.deployprints two JSON documents: configuration and summary.- Without a terminal, colors are disabled.
NO_COLORor--no-colordisable them explicitly.
Environment variables
| Variable | Description |
|---|---|
LLY_ACCESS_TOKEN | Access token |
LLY_PROJECT, LLY_APP | Same as --project and --app |
LLY_WORKSPACE | Same as --workspace. Must match the workspace of the token. |
NO_COLOR | Disable colors |