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.
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
-
Open Create-Environment and click Build with Parameters.
-
Check Environment Name. Jenkins generates a name, and you can change the name.
-
Select Database Type.
-
Select a preset in Environment Preset, or select Services one by one.
-
Check the version of each image in Docker Image Versions. A Friendly Technologies image gets
dev. Change it if you need another build. -
Select Time To Live. Jenkins deletes the environment when this time ends.
-
Read Preview.
-
Click Build. The new environment has the status
configured. No containers run yet. -
Open Deploy-Environment and click Build with Parameters.
-
Select the environment in Environment to Deploy.
-
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. -
Click Build.
-
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
-
Open the Create-Environment link in the Jira ticket. The form opens with QA Tickets filled in.
-
Read the ticket summary above Docker Image Versions. The summary shows how many tickets the form applied.
-
Check Services and Docker Image Versions. The form selects the services of each ticket and the dependencies of these services.
-
Complete the form and click Build.
-
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 form does not use a version from this ticket yet. |
|
The ticket has no good build. The form does not use a version from this ticket. |
|
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
-
Open Create-Environment and click Build with Parameters.
-
Select the release in Release. The form fills each image version from this release.
-
Check Docker Image Versions.
-
Complete the form and click Build.
-
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
-
Open Create-Environment and click Build with Parameters.
-
Select the source in Clone From Existing Environment.
-
Check the values and click Build.
-
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. |
-
Open Update-Environment and click Build with Parameters.
-
Select the environment.
-
Change the values. Read Change Diff and Preview.
-
Click Build. The containers do not change yet.
-
Run Deploy-Environment for this environment. The containers now use the change.
Deploy-Environment always pulls the images again.
Get a New dev Build
-
Open Update-Environment and click Build with Parameters.
-
Select the environment.
-
Select Pull only.
-
Click Build.
The environment must be deployed. The versions and the configuration do not change.
Stop, Start or Delete an Environment
-
Open Manage-Environment and click Build with Parameters.
-
Select the environment.
-
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. -
For Delete, select Create backup before deletion if you need the configuration.
-
For Delete, select I confirm permanent deletion.
-
Click Build.
Give Another Person Access
-
Open Manage-Environment and click Build with Parameters.
-
Select the environment.
-
Select Manage owners.
-
Select the Jenkins users in Co-owners. Clear a user to remove the access of that user.
-
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
-
Read the description of the build in the build history. The description names the stage and the cause.
-
Read the error box near the end of the build log.
-
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 |
Stop |
Removes the containers. The status becomes |
Restart |
Stops and starts the containers. The status becomes |
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 |
|
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 |
Docker Image Versions |
A Friendly Technologies image gets |
Time To Live |
|
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 |
Pull only |
Pulls the images of a deployed environment again and recreates the containers with a changed image, for example a new |
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:
-
Open Configure for the job.
-
Clear This project is parameterized and click Save.
-
Click Build Now. The build ends green, creates nothing and registers the parameters.
-
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>/imagesand/api/machine/qa-envof cicd-manager. They use thecicd-machine-tokencredential.QA_CICD_URLoverrides the address. -
DEBUGandQA_LOG_VERBOSEare independent.QA_LOG_VERBOSEis a Jenkins global variable and switches verbose logging. See Logging. -
QA_KEEP_FAILED_STATE=truekeeps the database data after a failed deploy. -
Create-Environment renders
docker-compose.yml,.env.<db>, a.envfor each service andmeta.jsonunderMASTER_ENVS_DIR/<env>/. -
The library also has
restoreEnvStep,rollbackEnvStepandswitchDatabaseStep. The production Jenkins has no jobs for these steps.