Environment Lifecycle

This page shows the status of an environment, what each action removes, and when an environment expires.

Life of an Environment

An environment goes through these stages. You start each stage, except the automatic end of the lifetime.

Stage Who starts it Status after What happens

1. Create

You: Create-Environment

configured

Jenkins writes the configuration on the Jenkins controller. The lifetime starts now. No containers run, and the agent has no files.

2. Deploy

You: Deploy-Environment

deployed

Jenkins copies the configuration to the agent and starts the containers. If the deploy fails in Deploy Services or later, the status is failed. If it fails earlier, the status stays as it was.

3. Test

You

deployed

You use the access addresses from the build log.

4. Change

You: Update-Environment, then Deploy-Environment

Same status after Update, deployed after Deploy

Update changes the configuration only. Deploy applies the change to the containers.

5. Pause

You: Manage-Environment with Stop, later Start

stopped, then deployed

Stop removes the containers and keeps the data. Start creates the containers again.

6. End

You: Manage-Environment with Delete. Or automatic: the lifetime ends.

No status. The environment no longer exists.

Jenkins removes the containers, data and configuration. See What Stays and What You Lose.

A failed environment can go back to stage 2. A stopped environment can go to stage 4, and each environment can reach stage 6 from any status.

States

Each environment has one status. An arrow shows a job that you start, or an automatic event where the label says so.

states
Status Meaning

configured

The configuration exists. No containers run yet.

deploying

A deploy is running now.

deployed

The last deploy or start succeeded.

stopped

You stopped the environment. The containers do not exist. The data stays.

failed

The last deploy failed in Deploy Services or later. See What Stays and What You Lose.

unknown

Jenkins cannot read the meta.json file, or the file has no status.

What Stays and What You Lose

A failed first deploy clears the database data of the environment. An administrator can keep this data with QA_KEEP_FAILED_STATE=true.
Action What stays What you lose

Deploy-Environment on an existing environment

Your other files on the agent, the data and the logs. Jenkins adds only missing files.

Your edits to docker-compose.yml and the .env files on the agent.

Deploy-Environment with Reset Configs

The data, the logs, ftacs/config-legacy/build and files without a Jenkins copy.

Your edits to each file with a Jenkins copy.

Deploy-Environment fails before Deploy Services

Everything. Running containers keep running.

Nothing.

Deploy-Environment fails in Deploy Services or later, and the environment may hold data from an earlier deploy or start

The database data, the logs and the configuration.

The containers.

Deploy-Environment fails in Deploy Services or later, and the environment was never deployed or started

The logs and the configuration.

The containers and the database data: mysql/data, oracle/data and postgres/data.

Update-Environment

The running containers and the files on the agent. Run Deploy-Environment to apply the change.

Nothing on the agent.

Manage-Environment: Stop

Volumes, data, logs and configuration.

The containers and files outside the mounted folders.

Manage-Environment: Delete

Only the optional backup. The backup contains the configuration from the Jenkins controller, not database data.

The containers, volumes, networks, data, logs and configuration.

The lifetime ends

Nothing. Jenkins makes no backup.

The containers, volumes, networks, data, logs and configuration.

The files of an environment are in /opt/qa-envs/<env>/ on the agent.

Lifetime

Cleanup-Environments runs every day at about 02:00 on the Jenkins clock. You do not need to start this job.

lifetime-cleanup

The lifetime counts from the creation date, also after you change Time To Live.

You can also run Cleanup-Environments yourself. A manual run affects only your own environments, unless you are an administrator.

For Developers

meta.json schema

Each env owns a meta.json under /var/jenkins_home/qa-data/envs/<env>/. Typical content:

{
  "env_name":       "andromeda-1745",
  "database_type":  "mysql",
  "services":       ["mysql", "hazelcast", "ftacs", "ui-backend"],
  "image_versions": { "ftacs": "5.12.3", "ui-backend": "5.12.3" },
  "release_base":   "v7-1-3",
  "qa_issues":      ["DEV-1234", "DEV-1235"],
  "runner":         "qa-runner-04",
  "status":         "deployed",
  "ttl":            "1w",
  "created_at":     "2026-04-22T09:14:51Z",
  "created_by":     "alice",
  "owners":         ["bob", "carol"],
  "last_action":    "deploy",
  "last_action_at": "2026-04-22T09:17:02Z"
}
Field Notes

env_name

Must match QAConfig.Validation.ENV_NAME_PATTERN. Immutable.

database_type

mysql / oracle / postgres. Changeable via Update-Environment.

services

Sorted list of enabled services. Must be a subset of the keys in resources/services/compose-<db>.yml.

image_versions

Per-service tag map; omitted entries fall back to the template default (${*_IMAGE:-…​}).

release_base

The release the versions came from. Update-Environment removes it when a version no longer matches this release.

qa_issues

The tickets the form applied at creation.

runner

Last agent the env was deployed on. Updated by deployEnvStep.

status

One of QAConfig.Status.ALL.

ttl

One of QAConfig.TTL.ALL. cleanupEnvsStep enforces it.

created_at / created_by

Set once by createEnvStep. created_by is immutable and cannot be changed, not even by manage-owners.

owners

Mutable list of Jenkins logins granted the same RBAC rights as the creator (except they can also be removed). See RBAC & Ownership.

last_action / last_action_at

Written on every successful action for auditability.

All writes to meta.json go through utils.atomicWriteMeta(path, data) — temp file + rename — to avoid torn reads if a second job reads the file mid-write.

Who drives which transition

Job / step Transition Notes

createEnvStep

[*] → configured

Renders compose + .env.<db> + per-service .env + meta.json. Enforces MAX_ENVS_PER_USER for non-admins.

deployEnvStep

configured → deployed, stopped → deployed

Runs port-conflict check, docker compose up -d, updates meta.runner / meta.status.

updateEnvStep

stays in current state

Re-renders compose with new services / tags / vars. Starts no containers. Strips Compose profiles from services it plans to start.

manageEnvStep with action=start / restart

configured, stopped or failed → deployed

docker compose up -d --build --pull always on the recorded runner. restart runs stop first.

manageEnvStep(action=stop)

deployed → stopped

docker compose down --remove-orphans. Removes containers. Volumes and config stay.

manageEnvStep(action=delete)

any → deleted

docker compose down -v, removes both env dirs, optional backup of the master env dir under MASTER_BACKUPS_DIR (last 10 kept).

manageEnvStep(action=manage-owners)

no state change

Rewrites meta.owners[]. Skips the duplicate-audit code path used by the other actions.

cleanupEnvsStep

expired → deleted

Cron H 2 * * *, set in the step. Ownership-aware: non-admins only see their own envs, cron runs see all.