Usage

This page shows QA engineers how to use the environment jobs in Jenkins. An environment is a set of services on one Jenkins agent. All jobs are in the QA-Environments folder.

Order of the Jobs

You start each job yourself. A job does not start the next job.

qa-job-order

These jobs start without you:

Job Starts when Result

Cleanup-Environments

Every day at about 02:00 on the Jenkins clock

Deletes each environment with an expired lifetime. See Lifetime.

Cleanup-Images

A Jira rule starts the job when a ticket closes

Deletes image tags of finished branches. See Harbor image cleanup.

Some actions remove data. Read What Stays and What You Lose before you delete or redeploy an environment.

Tasks

Create and Start an Environment

  1. Open Create-Environment and click Build with Parameters.

  2. Check Environment Name. Jenkins generates a name, and you can change the name.

  3. Select Database Type.

  4. Select a preset in Environment Preset, or select Services one by one.

  5. Check the version of each image in Docker Image Versions. A Friendly Technologies image gets dev. Change it if you need another build.

  6. Select Time To Live. Jenkins deletes the environment when this time ends.

  7. Read Preview.

  8. Click Build. The new environment has the status configured. No containers run yet.

  9. Open Deploy-Environment and click Build with Parameters.

  10. Select the environment in Environment to Deploy.

  11. Select the agent in Target Agent.

    If the first deploy fails, Jenkins clears the database data of the environment. See What Stays and What You Lose.
  12. Click Build.

  13. Open Stages on the build page to follow each service. When the build ends, the log shows the access addresses.

Build stays blocked while a required choice is missing. The text next to Build names the problem.

Create an Environment from Jira Tickets

  1. Open the Create-Environment link in the Jira ticket. The form opens with QA Tickets filled in.

  2. Read the ticket summary above Docker Image Versions. The summary shows how many tickets the form applied.

  3. Check Services and Docker Image Versions. The form selects the services of each ticket and the dependencies of these services.

  4. Complete the form and click Build.

  5. Run Deploy-Environment.

You can also type ticket keys in QA Tickets, for example DEV-1234,DEV-1235.

The form only fills values. You can change any value, and you decide when to click Build.

The link in the Jira panel includes linked tickets. The link in a Jira email contains only the ticket of that email.

The ticket summary can show these results:

Result Meaning

A version and a tag

The form uses this build.

the build is still running

The form does not use a version from this ticket yet.

no successful build

The ticket has no good build. The form does not use a version from this ticket.

no builds in the last 10 days

The form finds no recent build. The form does not use a version from this ticket.

Version conflict

Two tickets built the same image. The form uses the first ticket in the list.

If the form cannot apply all tickets, it shows Not all tickets applied next to Build. Build stays active. You decide if the environment is good enough for your test.

Create an Environment from a Release

  1. Open Create-Environment and click Build with Parameters.

  2. Select the release in Release. The form fills each image version from this release.

  3. Check Docker Image Versions.

  4. Complete the form and click Build.

  5. Run Deploy-Environment.

If the registry does not have a tag of the release, the form reports the missing tag. The form does not select this tag.

If the release list is not available, Release shows Pick versions by hand. The form still works. Select each version yourself.

Copy an Environment

  1. Open Create-Environment and click Build with Parameters.

  2. Select the source in Clone From Existing Environment.

  3. Check the values and click Build.

  4. Run Deploy-Environment.

Change an Environment

If you add or remove services on a deployed environment, first run Manage-Environment with Stop. Otherwise Update-Environment stops with an error.
  1. Open Update-Environment and click Build with Parameters.

  2. Select the environment.

  3. Change the values. Read Change Diff and Preview.

  4. Click Build. The containers do not change yet.

  5. Run Deploy-Environment for this environment. The containers now use the change.

Deploy-Environment always pulls the images again.

Get a New dev Build

  1. Open Update-Environment and click Build with Parameters.

  2. Select the environment.

  3. Select Pull only.

  4. Click Build.

The environment must be deployed. The versions and the configuration do not change.

Stop, Start or Delete an Environment

  1. Open Manage-Environment and click Build with Parameters.

  2. Select the environment.

  3. Select the action. The form disables actions that do not fit the current status.

    Delete cannot be undone. The backup contains configuration only. The backup does not contain database data.
  4. For Delete, select Create backup before deletion if you need the configuration.

  5. For Delete, select I confirm permanent deletion.

  6. Click Build.

Give Another Person Access

  1. Open Manage-Environment and click Build with Parameters.

  2. Select the environment.

  3. Select Manage owners.

  4. Select the Jenkins users in Co-owners. Clear a user to remove the access of that user.

  5. Read Planned change to owners list and click Build. The containers do not change.

The creator is not in the list and always keeps access. See RBAC and ownership for the limits.

Find Environments

Run List-Environments. You can filter by status, database, agent and lifetime, and you can search by text. The job shows all environments to each user, with the creator of each environment.

Find the Cause of a Failed Build

  1. Read the description of the build in the build history. The description names the stage and the cause.

  2. Read the error box near the end of the build log.

  3. Open the build Artifacts and download .qa-build.log. This file has the full trace.

If a form field shows only a placeholder, an administrator must check Script Approval. If you click Build with a services placeholder, the build stops with The services list did not load.

Actions

Action Result

Start

Starts the containers on the recorded agent of the environment. The status becomes deployed. Safe to repeat. To use another agent, run Deploy-Environment.

Stop

Removes the containers. The status becomes stopped. Volumes and configuration stay.

Restart

Stops and starts the containers. The status becomes deployed.

Delete

Removes the containers, volumes, networks and configuration.

Manage owners

Changes the co-owner list. The containers and the status do not change.

Parameters

Create-Environment

Field Description

Environment Name

3 to 50 characters: lowercase letters, digits and hyphens. The first character is a letter or a digit.

QA Tickets

Ticket keys. See Create an Environment from Jira Tickets.

Clone From Existing Environment

Copies the choices of an environment. See Copy an Environment.

Database Type

mysql, oracle or postgres.

Environment Preset

Selects a set of services. Dependency management lists the presets.

Services

The form selects mandatory services. You cannot clear locked services.

Release

Fills all image versions from a release. Saved in meta.json as release_base.

Docker Image Versions

A Friendly Technologies image gets dev. Without dev, it gets the newest release, such as v7.1.3-b0.0.3. Without both, you must select a version. Other images keep their default version.

Time To Live

1d, 3d, 1w, 1m, 2m, 3m, 1y or infinity.

I intentionally omit these dependencies

Appears only when a mandatory dependency is missing. Select the box only if you split services across environments on purpose.

Global Variables

Variables for all services. The editor keeps comments and blank lines.

Service Variables

Variables for one service.

Debug Mode

Keeps a failed environment on disk for inspection. This option does not change the logs.

IPV6_ENABLED

Enables IPv6 on the network of the environment. Default: off. The agent must support IPv6. You can set this value only at creation. To change it, clone or create the environment again.

IPv6 changes port exposure. All service ports publish without a host address. On an agent with IPv6 enabled in Docker, the ports open on the IPv6 addresses of the agent. Firewall rules for IPv4 do not protect these ports. See IPv6 environments.

Limit: you can own 5 environments by default. If you reach the limit, the build stops with an error. Administrators have no limit.

Deploy-Environment

Field Description

Environment to Deploy

All environments, grouped by status. The form keeps Build blocked until you select one.

Target Agent

Online agents only. The Jenkins controller is never in the list. The form selects the last agent by default.

Force Rebuild

Recreates the containers even without a change.

Reset Configs

Overwrites the configuration files on the agent. See What Stays and What You Lose.

Dry Run

Runs the checks and starts no containers.

Before it starts the containers, the job checks the ports and the free capacity of the agent. If a port is in use, the error names the owner of the port.

Deploy-Environment runs only for the creator, a co-owner or an admin.

You cannot move an environment with reserved ports to another agent. To move the environment, delete it and create it again.

Update-Environment

Field Description

Select environment to update

All environments, grouped by status. The build stops if you are not an owner or an administrator.

Database Type

Select another type to switch the database. An environment with emulators only has no database, and this change stops the build with an error.

Services

Add or remove services. A removed service keeps its configuration files.

Release, Docker Image Versions

Same as in Create-Environment. Saved versions stay selected. A new Friendly Technologies service gets dev, or the newest release.

Pull only

Pulls the images of a deployed environment again and recreates the containers with a changed image, for example a new dev build. The form ignores the other fields. The versions and the configuration do not change.

Time To Live

The new lifetime still counts from the creation date.

Target Agent

The agent of the environment.

Global Variables, Service Variables

Same as in Create-Environment.

Change Diff

Shows the pending changes.

Port Preview

Shows the ports of the environment.

Refresh the Parameters

An administrator refreshes the parameters of a job after a library change:

  1. Open Configure for the job.

  2. Clear This project is parameterized and click Save.

  3. Click Build Now. The build ends green, creates nothing and registers the parameters.

  4. Approve the new scripts in Script Approval.

For Developers

  • Parameter names: ENV_NAME, QA_ISSUES, CLONE_FROM, DATABASE_TYPE, PRESET, SELECTED_SERVICES, RELEASE_BASE, IMAGE_VERSIONS, TTL, ALLOW_MISSING_DEPS, GLOBAL_VARIABLES, SERVICE_VARIABLES, DEBUG, IPV6_ENABLED, DEPLOY_RUNNER, FORCE_REBUILD, RESET_CONFIGS, DRY_RUN, ACTION, OWNERS_LIST, OWNERS_PREVIEW, CREATE_BACKUP, CONFIRM.

  • The name pattern is QAConfig.Validation.ENV_NAME_PATTERN.

  • The limit is QAConfig.Limits.MAX_ENVS_PER_USER.

  • The forms read /api/machine/releases, /api/machine/releases/<id>/images and /api/machine/qa-env of cicd-manager. They use the cicd-machine-token credential. QA_CICD_URL overrides the address.

  • DEBUG and QA_LOG_VERBOSE are independent. QA_LOG_VERBOSE is a Jenkins global variable and switches verbose logging. See Logging.

  • QA_KEEP_FAILED_STATE=true keeps the database data after a failed deploy.

  • Create-Environment renders docker-compose.yml, .env.<db>, a .env for each service and meta.json under MASTER_ENVS_DIR/<env>/.

  • The library also has restoreEnvStep, rollbackEnvStep and switchDatabaseStep. The production Jenkins has no jobs for these steps.