What are build triggers?
Build triggers are an essential component of modern software development workflows. They enable developers to automate the process of building and testing code changes, ensuring that any new code is validated and integrated into the larger system as quickly and efficiently as possible. Build triggers are essentially rules that are defined within a Continuous Integration (CI) system, which monitors a code repository and automatically initiates a build process whenever certain criteria are met. In the case of Git-based repositories, the most common trigger is the Git push event, which initiates a build whenever new code is pushed to a specific branch.
Triggers in CodeNOW
One of the features offered by CodeNow is the ability to configure Git push triggers that automatically run a specified CI pipeline. This means that whenever a developer pushes new code to a specific branch of a Git repository, the corresponding CI pipeline is automatically triggered and runs a predefined sequence of build and test steps.
There is also an option to automatically deploy the component to a specified environment after a successful build. By leveraging CodeNow's Git push triggers feature, developers can streamline their development workflows and focus on delivering high-quality software to end-users.
The configuration is stored in
.codenow.triggers.yaml in the root of your repository. CodeNOW always uses configuration from the git default branch.
- Scroll down to Continuous Integration Triggers section in the detail of your component and click on the
- Choose the type of the build (Preview or Release)
- For release build you also need to specify version type and corresponding version or branch pattern
- Define the branch on which the trigger will listen for git push events and choose the CI pipeline that will be triggered
You can set the trigger to listen on multiple branches by using glob pattern that matches with the name of the branches.
If two or more triggers listen on the same branch, only the first matching trigger defined will be executed.
- For Release build, you can choose to create a new Application Package after a succesful build
- If you want to trigger a deployment after the triggered pipeline, continue to Deployment, otherwise, save your configuration in order to push the changes
You can also add deployments that will deploy the component to a specific environment after successful build.
If you want to automatically deploy a component to a specific environment, you have to enable the
Allow deployment from pipelines option in the configuration of that environment.
Actions panel in the detail of the environment)
- Click on the
- Select an environment on which you want to deploy your component
- Choose which Deployment configuration should be used
- Latest will use the last used configuration
- Branch will use the configuration defined in the
codenow/config/application.yamlfile in the gitlab repository of your component
- Click on the
- Save the settings (at the end of the Continuous Integration section)