The Console is able to generate new services starting from a git project or from an existing docker image.
To make sure that the Console can create new services starting from a template it is necessary to create the template on Gitlab and to register it in the configuration of the Dev-console.
The templates must be registered in the CRUD, in the
services collection, indicating a label that will display the user and the path to the git repository.
The Console will create a repository in which it will copy the template files replacing all occurrences of the following strings between
% or the ones starting with
mia_template and ending with
mia_template_image_name_placeholder-> name of the nexus image entered by the user
%CUSTOM_PLUGIN_PROJECT_NAME%-> name (label) of the Console project
mia_template_project_id_placeholder-> id of the Console project
mia_template_service_name_placeholder-> service name chosen by the user
%CUSTOM_PLUGIN_SERVICE_DESCRIPTION%-> description of the service chosen by the user
%CUSTOM_PLUGIN_CREATOR_USERNAME%-> username of the user who created the service
%CUSTOM_PLUGIN_PROJECT_FULL_PATH%-> full Gitlab path
%GITLAB_PROJECT%-> name of the Gitlab project entered by the user
%GITLAB_GROUP%-> name of the user-entered Gitlab group
%GITLAB_BASE_URL%-> URL base of Gitlab
%NEXUS_HOSTNAME%-> Nexus hostname
The following strings can still be used but are deprecated:
%CUSTOM_PLUGIN_IMAGE_NAME%-> name of the nexus image entered by the user
%CUSTOM_PLUGIN_PROJECT_ID%-> id of the Console project
%CUSTOM_PLUGIN_PROJECT_NAMESPACE%-> id of the Console project
%CUSTOM_PLUGIN_SERVICE_NAME%-> service name chosen by the user
Below is an example of the body of a template:
and the example curl to create the template:
archiveUrl field must be a URL to the tar.gz version of the git project;
below is an example for project hosted on gitlab:
Note that you can now specify an
image and a
supportedByImage for the template;
both fields are
array of objects that cointain the image file data; the result will be as the following:
If you have an image to upload, you should upload to dev console using, for example:
Example response for this call:
So, as imageUrl params in template body, you should use:
You can directly use the response body as image file object of your custom template, as described in the Example of template upload paragraph.
To change a custom template, you can use the postman collection below to modify the project.
First, fill with your cookie sid to authenticate. Once authenticated, get the template to modify using
Get templates collection to find the correct id.
With the correct template id,
Change existing template with the id, remove the unchanged fields and modify the correct one.
Create a JSON file with the following content, then import this collection into Postman:
From CMS you can configure the environment variables of each template by adding the property
defaultEnvironmentVariables inside the data model of each template. By modifying the map of the environment variables, you can overwrite the default environment variables applied by DevOps Console.
To use this feature, you have to fill the
defaultEnvironmentVariables in this way:
You can also add a description field.
Here there is an example of the React Template configuration, which environment variables can be modified in order to overwrite the defaults applied by DevOps Console: