Manage Branches
This page describes how to manage branches in the created Project, whether it is an application, library, autotest or infrastructure. It also briefly explains two approaches of managing custom pipelines for codebases.
Pipeline Management​
There are two approaches to define codebases with Tekton pipelines:
- Using build tool and framework;
- Using codebase branch settings.
Build Tool/Framework Approach​
This approach involves adding your application operating with language type and framework.
In this approach, it is essential to create a pipeline name using the pattern: git_server_name-build_tool-framework-codebase_type-pipeline_type-codebase_versioning_type.
Follow this approach if you need to define multiple similar applications with identical settings, as this approach would be more beneficial.
Codebase Branch Settings​
This approach involves creating a Project with Tekton pipelines and selecting it in the codebase branch settings.
In contrast to the approach based on build tool and framework, this one offers two main advantages:
- Simplified management: This method eliminates the requirement for strict resource naming conventions. With this approach, pipelines can be created without following any predefined pattern.
- Branch-based logic: With this method, pipelines can be defined not just for an application but also for specific branches within the application.
If you need to frequently and quickly redefine a build or review pipeline, this approach is highly recommended.
Add New Branch​
When working with libraries, pay attention to specifying the branch name: the branch name is involved in the formation of the library version, so it must comply with the semantic versioning rules for the library.
When adding a Project, the default branch is main. To add a new branch, follow the steps below:
-
Navigate to the Branches block by clicking the Project name link in the Projects list and click the + Create branch button:
-
Fill in the required fields to create a new branch:
Release branch - select this option to make a release branch. Codebases from release branches are marked with a different tag.
noteWhen working with release branches, keep in mind that only the semver versioning type supports release branches. In the default versioning type, this option is unavailable. Additionally, the SNAPSHOT version is reset each time you create a release branch.
When the Release branch option is selected, you will also need to specify release tag the Codebase will be marked:
Branch name - type the branch name.
noteThe Branch name field remains static if you create a release branch. If you want to onboard an existing branch, enter the name of the existing branch in the Branch name fields.
From - by default, the KubeRocketCI portal will suggest creating a branch from the main branch. If you want to create a branch from another branch or commit hash, change this field:
- Commit hash
- Another branch
In the From field, select the Commit hash option. In the field to the right, specify the full SHA of the commit you want to create a branch from. Note that if the From commit hash field is empty, the latest commit from the branch name will be used.
In the From field, select the Branch option. In the field to the right, specify the name of the source branch you want to create a branch from:
Branch version - specify the application version and tag (SNAPSHOT by default).
Build pipeline - select the build pipeline you want to use to build the application or leave the default one.
Review pipeline - select the review pipeline you want to use to review the application or leave the default one.
-
Click Create.
Use additional tools to get guidance for the process:
-
View diagram: Visualizes the selected pipeline to make sure it matches your needs.
-
Form Guide: Shows details about each field of the form.
noteTo get the most out of managing build/review pipelines via KubeRocketCI portal, you should follow the Add-Ons approach for pipeline management.
infoAdding of a new branch is indicated in the context of the
semverversioning type.
Add Existing Branch​
Onboarding a branch that has already been created in Git to the platform follows the same steps as when you add a new branch. When adding an existing branch, specify its name in the Branch name fields.
Edit Existing Branch​
To edit branch properties, follow the steps below:
-
Navigate to the Branches block by clicking the Project name link in the Project list.
-
Click the actions button and select Edit.
-
Change the branch options and click Apply.
Build Branch​
In order to build branch from the latest commit, do the following:
-
Navigate to the Branches block by clicking the library name link in the Libraries list.
-
Click the Build button.
The pipeline run status is displayed near the branch name in the Branches block.The corresponding item appears in the Pipelines section.
As an alternative way, click the tree diagram icon to observe the real-time status of the pipeline run.
Delete Branch​
The default master/main branch cannot be removed. Additionally, deleting a branch in the portal doesn’t remove it from Git. It is required to delete it there as well if necessary.
In order to delete the added branch with the corresponding record in the KubeRocketCI portal database, do the following:
- Click the Project name link in the Projects list.
- Select the Branches tab.
- Define the branch you want to delete.
- On the branch block, click the actions button and select Delete.
- Confirm deletion of the branch by typing its name and clicking Confirm.