Configure Components

Through the function of automatic construction, the component can automatically trigger the construction and deployment after the code or image is submitted. Kato provides three ways to trigger the automatic deployment of the component based on the code repository Webhooks, the mirror repository Webhooks and the custom API. The function of automatic construction can assist developers to realize agile development conveniently.

Prerequisites

  • The components are created from source code (except the official demo) and can support the code repository Webhooks. The currently supported code repositories are GitHub, GitLab, Gitee and Gogs.
  • The component is created by the mirror image, which can support the mirror repository Webhooks, and currently supports the Docker official repository and Alibaba Cloud mirror repository.
  • Create component A based on the source code and put it in a normal operating state.

Based on Source Code Operation Process

Enable component Git-Webhook In the component management panel/build source management, please turn on the Git-Webhook automatic construction function, and copy the generated hook address.

After Kato is automatically built, it will deploy by default, so in general, developers do not want to deploy every code submission. Therefore, Kato hook automatically triggers a prerequisite, and the action is triggered only when the Commit information contains @keyword . This keyword can be set by the developer.

Please note that the domain name generated here is based on the domain name of the current access platform. If it is incorrect, you can directly use the correct access domain name of the platform.

Configure code repository

If your project is stored in Github, please refer to the screenshot below:

If your project is stored in Gitlab, please refer to the screenshot below:

The configuration of other code repositories is similar. It should be noted that the current Kato hook trigger does not support security request verification.

Based on the Mirror Repository Operation Process

The automatic construction of the mirror repository can realize the automatic construction of the application after the mirror is pushed, and it is convenient to connect to the third-party automation process. When the mirror update event arrives, the following conditions are judged, and automatic construction is triggered when all are met.

  • The application is created by the image, and the image repository is Docker Hub, version 5.1.2 and later supports Alibaba Cloud image repository.
  • Whether the default updated image name and tag are consistent with the current component build source image name (does not include the domain name of the mirror repository when judging), version 5.1.3 and later support the configuration of Tag trigger regular strategy, dynamically match and change the component’s image tag.
  • The component has opened the mirror repository Webhook function.
  • The application status is not closed.

Enable automatic construction of mirror repository Webhook

The automatic construction function needs to be enabled in the application, and the webhooks url of the application needs to be configured into the webhooks of the target mirror repository.

Tag triggers automatic modification strategy

By default, the image name and tag of the Webhook update event must be consistent with the image name and tag configuration of the component’s current build source to trigger the build and deployment. After configuring the Tag trigger strategy, according to the configured regular expression, if the mirror tag of the received push event can correctly match the regular expression, the update event is considered valid, and the current component’s build source is upgraded according to the updated Tag information Information and automatic construction.

For example, set the Tag policy as: v5.* When the Tag is v5.1, v5.2, v5.9, etc., it will be allowed.

Configure the mirror repository

  • Configure Docker Hub

Please refer to the following screenshot for the configuration method:

API Triggers Automatic Build

By opening the API to automatically construct the returned url, the POST method calls the API, and the secret key can trigger the automatic API construction. The secret key can be customized

API usage is as follows:

curl -d'{"secret_key":"<Secret Key>"}' -H "Content-type: application/json" -X POST <API address>

Automatic construction based on API triggering is one of the most flexible ways, mainly used to integrate with third-party CI systems.