Configuring CI/CD for Customized Template

Once all required modifications are prescribed within Dockerfile, let’s automate the process of the appropriate image creation so that it will be rebuilt with new parameters upon any commitment to this project.

1. Return to the Project tab and click the Set up CI button.

set up ci

Editor with the appropriate configuration file will be opened.

2. Expand integration templates list at the top pane and choose Jelastic to insert the appropriate code into the automatically created .yml file.

In case you need to modify the default CI/CD scenario, provided within .gitlab-ci.yml sample by Jelastic, use this instruction to get more information on possible customization options.

gitlab ci

Note: Since each stack at a Platform should have a unique Node Type identifier, the system automatically generates and assigns it while building your Docker image based on the appropriate GitLab project name and user ID. If needed, such default identifier can be manually redefined with a custom value within the docker build operation:

--label nodeType={custom_nodetype}

where {custom_nodetype} is a prefered identifier (only letters, numbers and “-” character are allowed)

Subsequently, this value should be used within the appropriate nodeType parameter when referring to this image via API, JPS packages, CS scripts, etc. In addition, custom templates are assigned Node Type aliases based on source image tags’ meta-information.

Click Commit Changes to proceed.

3. When CI/CD configuration file is saved, build of your custom template from Dockerfile will be instantly initiated by the appropriate job. The process status can be checked within the Pipelines tab.

ci pipeline

Tip: Upon clicking on a particular pipeline, you can view the included jobs and track their execution within the console.

ci jobs

Once the status switches to passed, the integration is finished. Also, you’ll receive the appropriate email notification.

Now, any change committed to this project will automatically rebuild your image.

Note: Changes within Jelastic-managed base images do not initiate automatic update of your custom templates; to apply them, make a commit to the appropriate custom project or re-run the corresponding job manually.
4. To see the details on a newly created template, switch to the Registry tab.

gitlab registry

Here, you can review and manage list of tags for your project (in our case, it includes just a single latest version).

Tip: To provide template with multiple tags (so that a user can choose the required one while container creation), you’ll need to:
  • create a separate project branch for each stack version (where branches are named according to the appropriate version labels)
  • modify the FROM jelastic/image:tag instruction within each branch's Dockerfile, specifying the required base image tag

Subsequently, when adding such image to a Platform as a stack template, you’ll be able to define which versions should be available at the dashboard and mark one of them to be used by default.

When your CI/CD pipeline is up and running, perform test deployment before publishing template to your dashboard.