Skip to main content

Overview

A Lifecycle Job is a Kubernetes job that is triggered by environment lifecycle events (deploy, stop, or delete). Unlike Cron Jobs that run on a schedule, Lifecycle Jobs execute when specific environment events occur. Key Features:
  • Triggered by environment events (deploy, stop, delete)
  • Can output variables to other services in the environment
  • Supports both Git and Container Registry sources
Common Use Cases:
  • Seed databases in preview environments
  • Create external resources not managed by Qovery (S3 buckets, DNS records)
  • Run database migrations
  • Generate dynamic configuration or API keys
  • Clean up resources on environment deletion

Deployment Sources

Qovery supports two deployment sources for Lifecycle Jobs:

Git Repository

Qovery pulls your code from a Git repository, builds the application, and deploys it to your Kubernetes cluster. Supported Providers: GitHub, GitLab, Bitbucket

Container Registry

Qovery pulls a pre-built container image from your configured registry and deploys it to your Kubernetes cluster.

Creating a Lifecycle Job

1

Select Source

Choose Git Repository or Container Registry as your deployment source
2

Configure Source

For Git Repository:
  • Select Git provider
  • Choose repository
  • Select branch
  • Specify root path (if not at repository root)
  • Configure Dockerfile path
For Container Registry:
  • Select configured registry
  • Enter image name
  • Specify image tag
3

Configure Triggers

Select which lifecycle events should trigger this job:
  • Deploy: Run when environment is deployed
  • Stop: Run when environment is stopped
  • Delete: Run when environment is deleted
For each selected event, configure:
  • Custom entrypoint (optional)
  • CMD arguments (optional)
  • Restart policy
  • Max duration
  • Port (if needed for health checks)
4

Configure Resources

  • vCPU: Default 500m (0.5 cores)
  • RAM: Default 512MB
5

Input Variables

Configure environment variables that the job needs
6

Review and Deploy

Review configuration and click Create to deploy

Configuration

General Settings

Name: Unique identifier for your Lifecycle Job within the environment Source Configuration:
  • Git: Provider, repository, branch, root path, Dockerfile path, build arguments, target stage
  • Registry: Image name and tag

Triggers

Configure which lifecycle events trigger this job: Deploy Event: Triggered when the environment is deployed. Use for:
  • Running database migrations
  • Seeding initial data
  • Creating cloud resources
  • Generating API keys or configuration
Stop Event: Triggered when the environment is stopped. Use for:
  • Creating backups
  • Archiving data
  • Notifying external systems
Delete Event: Triggered when the environment is deleted. Use for:
  • Cleaning up external resources
  • Deleting cloud resources
  • Removing API keys or tokens
For each event, configure:
  • Entrypoint: Override container entrypoint
  • CMD Arguments: Provide command arguments
  • Restart Policy: Configure failure handling
  • Max Duration: Execution timeout (in seconds)
  • Port: For health checks (optional)

Resources

  • vCPU: CPU allocation in millicores (default: 500m)
  • Memory: RAM allocation (default: 512MB)

Input Variables

Lifecycle Jobs have access to:
  • Built-in Qovery variables (environment ID, project ID, service connections)
  • Custom environment variables
  • Secrets

Job Output Variables

Lifecycle Jobs can output data that gets injected as environment variables into other services in your environment.

Output File

Write your output to:
/qovery-output/qovery-output.json

Output Format

The output file must be valid JSON:
{
  "VARIABLE_NAME": {
    "sensitive": false,
    "value": "variable-value"
  },
  "API_KEY": {
    "sensitive": true,
    "value": "secret-key-value"
  }
}
Fields:
  • Key: Variable name (will be prefixed with QOVERY_OUTPUT_JOB_<JOB_ID>_)
  • sensitive: Boolean indicating if value is sensitive
  • value: The actual value to inject

Variable Naming

Output variables are automatically prefixed:
QOVERY_OUTPUT_JOB_<JOB_ID>_<VARIABLE_NAME>
Example: If your job outputs API_KEY, it will be available as:
QOVERY_OUTPUT_JOB_a1b2c3d4_API_KEY

Using Output Variables

After the Lifecycle Job completes, output variables are automatically available to all services in the environment via environment variables.

Force Run

Manually trigger a Lifecycle Job with a specific event type:
1

Navigate to Job

Go to your Lifecycle Job in the Qovery console
2

Click Force Run

Click the Play button or Force Run action
3

Select Event Type

Choose which event to simulate:
  • Deploy
  • Stop
  • Delete
4

Monitor Execution

View real-time logs and verify output variables are generated
Force Run allows testing specific event types without triggering the full environment lifecycle event.

Clone Service

Duplicate a Lifecycle Job configuration to the same or different environment:
1

Select Job

Go to the Lifecycle Job you want to clone
2

Clone Job

Click ActionsClone
3

Configure Clone

  • New name for cloned job
  • Target environment
  • Settings to copy
Cloning excludes custom domains and some built-in environment variables to prevent conflicts.

Delete Lifecycle Job

To delete a Lifecycle Job:
  1. Navigate to the Lifecycle Job settings
  2. Click Delete
  3. Confirm deletion
Deleting a Lifecycle Job is permanent and cannot be undone.