CI/CD Pipeline Tool Integration Adapters

Introduction

You can leverage the Calibo Accelerate platform's adapter development framework to integrate a new CI/CD tool and enhance the built-in DevOps capabilities of the platform. This section provides the details about the interface, methods, and classes that can be leveraged for building an adapter for a CI/CD tool like GitHub Actions, Atlassian Bamboo and GitLab Runner, among others.

Contents

Prerequisites

Before you start with your adapter development work, make sure you complete the following prerequisites:


Interface and Classes

The interface for building a CI/CD pipeline tool integration adapter is called DevopsPipelineService. This is the single interface that is responsible for managing the entire life cycle of a CI/CD pipeline.

Use the following methods and classes in your implementation of the CI/CD pipeline tool integration adapter.

Methods

Your adapter development team must provide implementation for the following methods for the DevopsPipelineService interface:

Note:

Mandatory parameters that are required for the following methods are passed through API requests sent from the Calibo Accelerate platform . If any additional parameters are required by your adapter development team, communicate these requirements to the Lazsa Team.

1. Configuration and Connection Verification

The following method is used to ensure the correct configuration of your desired CI/CD tool and to verify the connection with the CI/CD tool.

Method Description
void testConnection(DevopsRequest devopsRequest) throws PlatformGenericException Establishes connection with the configured instance.

 

2. CI/CD Pipeline Operations

The following table contains methods for the core operations of CI/CD pipelines, such as triggering pipelines, fetching build data, and managing credentials. These methods are important for automating the deployment process and managing build life cycle.

Method Description
String getCiCdUrl(DevopsRequest devopsRequest) throws PlatformGenericException Provides the URL to the pipeline in the respective CI/CD tool.
void createSecretCredentials(DevopsRequest devopsRequest) throws PlatformGenericException Generates secret credentials which are used in pipeline/build.
void upsertSecretCredentials(DevopsRequest devopsRequest) throws PlatformGenericException Creates or updates secret text credentials which are used in pipeline/build.
void upsertCredentials(DevopsRequest devopsRequest) throws PlatformGenericException Stores username and password as credentials in the CI/CD tool.
void upsertCertificateCredentials(DevopsRequest devopsRequest) throws PlatformGenericException Creates credentials to store certificate data.
Integer getLastBuildNumber(DevopsRequest devopsRequest) throws PlatformGenericException Fetches the number of the most recent pipeline build.
Map<String, Boolean> createJob(DevopsRequest devopsRequest) throws PlatformGenericException

Creates a pipeline in the tool and manages user permissions.

Ensures governance implementation through policy template.

Returns the status map for each user permission .

JobInfoResponse getJobInfo(DevopsRequest devopsRequest) throws PlatformGenericException Gathers information about the pipeline.
void addOrReplaceJobParameters(DevopsRequest devopsRequest) throws PlatformGenericException; Updates existing parameters or adds new parameters to pipeline jobs.
String triggerPipeline(DevopsRequest devopsRequest) throws PlatformGenericException Initiates the DevOps pipeline.
String getBuildStatus(DevopsRequest devopsRequest) throws PlatformGenericException Gets the current status of the pipeline.
Boolean getBuildRunningStatus(DevopsRequest devopsRequest) throws PlatformGenericException Checks if the pipeline is actively running (returns true if running).
BuildResponse getLastBuildData(DevopsRequest devopsRequest) throws PlatformGenericException Fetches data from the latest build/pipeline.
String getLastBuildOutput(DevopsRequest devopsRequest) throws PlatformGenericException Retrieves latest pipeline logs after execution.
List<PipelineStageResponse> getStageDetailsByBuildNumber(DevopsRequest devopsRequest) throws PlatformGenericException Retrieves stage details (for example, Build, Unit Tests, Sonar Qube, etc.) for a specific build number.
List<PipelineStageResponse> getStageDetails(DevopsRequest devopsRequest) throws PlatformGenericException Gathers stage information (for example, Build, Unit Tests, Sonar Qube, etc.) from the last build.
Map<String, Boolean> createDatabricksJob(DevopsRequest devopsRequest) throws PlatformGenericException Creates a Databricks job.
Map<String, Boolean> createHelmJob(DevopsRequest devopsRequest) throws PlatformGenericException Creates a job for executing Helm scripts, facilitating Kubernetes deployments.
Map<String, Boolean> upsertDeployJob(DevopsRequest devopsRequest) throws PlatformGenericException Creates or updates deployment-specific jobs only.
Map<String, Boolean> createCIJob(DevopsRequest devopsRequest) throws PlatformGenericException Creates or updates a continuous integration job.
void deleteJob(DevopsRequest devopsRequest) throws PlatformGenericException Deletes a specified pipeline.

 

3. Monitoring and Reporting:

The following table contains methods used for generating dashboard reports, providing insights into build logs, metrics, and commit history. This is important for maintaining transparency and continuous improvement in the development process.

Method Description
String getBuildLog(DevopsRequest devopsRequest) throws PlatformGenericException Retrieves the build log for all builds.
String getBuildLogByBuildNumber(DevopsRequest devopsRequest) throws PlatformGenericException Retrieves the build log for a specific build number.
BuildResponse getBuildDataByBuildNumber(DevopsRequest devopsRequest) throws PlatformGenericException Fetches data for the most recent build by build number.
GetAllBuildResponse getBuildMetrics(DevopsRequest devopsRequest) throws PlatformGenericException Gathers build metrics for all builds in the tool.
List<JobChangeItemResponse> getJobCommits(DevopsRequest devopsRequest) throws PlatformGenericException Retrieves source code commits included in the last build.

 

4. User Management:

The following table contains methods used for user onboarding and user offboarding processes in the tool.

Method Description
boolean addUserPermission(DevopsRequest devopsRequest) throws PlatformGenericException Assigns permission to a user in the tool.
boolean removeUserPermission(DevopsRequest devopsRequest) throws PlatformGenericException Removes a user's permission in the tool.

 

Classes

Refer to the following core classes that provide the attributes required for the implementation of the DevopsPipelineService interface for successful integration of your desired CI/CD pipeline tool with the Calibo Accelerate platform.

1. DevopsRequest

This is the fundamental request class that contains all necessary parameters to connect with tools like Jenkins, ensuring secure and efficient tool interaction.

Attribute Description
String jobFolder Designates the directory where the pipeline is created.
String jobName The name of the pipeline.
Map<String, String> params Parameters required to trigger pipeline.
String stageType Specifies the pipeline stage, such as Development (Dev), Quality Assurance (QA), User Acceptance Testing (UAT), or Production (Prod).
Integer buildNumber The pipeline build number.
String credentialID The ID for the secret credentials created in the tool.
String url Base URL of the tool.
String username Username for authentication with the tool.
String token A secret used to connect to the tool.
Map<String, Set<String>> permissions Assigns tool permissions to users.
String clusterUrl The URL of the Kubernetes cluster used for deployment.
String cert The certificate for Kubernetes, used in the deployment.
String kubeToken A token used for Kubernetes deployment.
byte[] kubeConfig Kubernetes kube config file which is used for deployment
String sourceCodeRepoURL The URL of the source code repository that is built by the build tool.
String sourceCodeCredentialId Source code repository credential ID that is used for cloning the repository.
String sourceCodeBranch The branch of the source code that is built.
String imageRepoUrl The URL to the artifactory image repository where the image is published.
String appPort Specifies the application port for deployment.
String imageTag The tag of the container image to be deployed to a Virtual Machine or Kubernetes Cluster.
String deploymentType Defines the deployment method, such as VM, Kubernetes, or Openshift.
String kubeSecret The credential ID for Kubernetes operations.
String artifactory Specifies the type of artifactory used (e.g., JFROG, ECR, ACR).
String artifactoryCredentialId The credential ID for connecting to the artifactory.
String sonarTokenCredentialId Credential ID for connecting to the Sonar instance for code quality checks.
List<UserPermission> userList Provides a list of each user's email with associated roles and permissions.
DatabricksJobCreationRequest databricksJobCreationRequest Databricks job request object to create a Databricks job.

 

2. BuildResponse

This class is used to fetch build-specific information, offering insights into the outcomes and statuses of various builds.

Attribute Description
long duration The total duration of the build process.
String result Provides a summary or outcome of the build flow.
int number Build number.
boolean building Indicates whether the build is currently in progress (true if yes).
boolean isSuccessful Indicates the success status of the build (true if successful).
long timestamp The timestamp when the build was triggered.
String url The build URL.
String name The name of the build.
String path The file path or location of the build in the system.
String state The current state of the build.
String workflowId The build workflow ID.

 

3. JobInfoResponse

This class is used to get information related to job executions within the CI/CD pipeline.

Attribute Description
String url The URL of the pipeline.
String name The name of the pipeline.
String description The description of the pipeline.
String color The designated color for the pipeline, often used for status indication.
boolean buildable Indicates whether the pipeline can be built (true if yes).
boolean inQueue Indicates whether the pipeline is currently queued for execution (true if yes).
boolean concurrentBuild Specifies whether concurrent builds are permitted (true if allowed).
int nextBuildNumber The number assigned to the next build in the pipeline.

 

4. PipelineStageResponse

This class provides details on each stage of the pipeline, enabling a deeper understanding of the pipeline's execution flow.

Attribute Description
String id The unique identifier of the pipeline.
String name The name of the pipeline.
String status The current status of the pipeline (for example, running, succeeded, failed).
Long startTimeMillis The start time of the pipeline, in milliseconds.
Long endTimeMillis The end time of the pipeline, in milliseconds.
Long durationMillis The total duration of the pipeline execution, in milliseconds.
Integer buildId The identifier for a specific build within the pipeline.

 

5. JobChangeItemResponse

Focused on commit-related information, this class tracks changes and commits associated with each build, crucial for version control and audit trails.

Attribute Description
String commitid The unique identifier of the commit.
String timestamp The timestamp of the commit
String comment A comment associated with the commit.
String date The date on which the commit was made.

 

6. GetAllBuildResponse

This is a response class that aggregates all build-related details, offering a holistic view of the build history and its attributes.

Attribute Description
List<BuildResponse> allBuilds Returns all build details.

 

7. UserPermission

This class is used for managing and assigning user permissions within the framework, ensuring secure access control.

Attribute Description
String userName The username of the individual for whom you want to apply permissions.
Map<String, Set<String>> permissions The set of roles and permissions to be applied to the user specified by userName.

 

8. DatabricksJobCreationRequest

This class is used to create a Databricks job from within the Calibo Accelerate platform.

Attribute Description
String databricksUrl URL of the Databricks workspace account.
String databricksTokenId Token ID for making REST calls to Databricks.
String databricksClusterId Cluster ID for executing Databricks jobs.
String databricksOrgId Organization ID required for notebook redirection in Databricks.
String parentFolder Specifies the parent folder for storing integration and transformation job notebooks.
String autoClone Ensures Databricks notebooks and Git repositories remain synchronized.

 

9. PlatformGenericException

This class is designed to encapsulate information about exceptions, including HTTP status codes and tool-specific messages, to be handled within the Calibo Accelerate platform.

Attribute Description
org.springframework.http.HttpStatus status Represents the HTTP status code associated with the exception. This status code is propagated to the Calibo Accelerate platform UI indicating the type of HTTP response (for example, 404 for Not Found, 500 for Internal Server Error) and helps users understand the nature of the error that occurred.
String code A custom code that uniquely identifies the specific exception.
String message The main message to be displayed on the Calibo Accelerate platform UI. This message provides a user-friendly description of the error or issue encountered, which helps users understand the problem.
List<String> subMessages A list of additional messages that provide more detailed information or context about the exception. These sub-messages can be useful for debugging or providing further insights into the error, in addition to the main message.

 

 

Related Topics Link IconRecommended Topics What's next? Deploying Adapters