Skip to content

Continuous integration (CI)

Continuous Integration (CI) is a software development practice in which code changes are frequently and automatically built, tested, and integrated into a shared code repository, often several times a day. The goal is to detect and address integration issues early in the development process.

01Cloud is a robust Platform as a Service (PaaS), seamlessly integrates Tekton as a core component for Continuous Integration (CI) capabilities. Users can harness the power of Tekton to create, customize and execute CI/CD pipelines.

01Cloud leverages Tekton's flexibility and scalability to streamline cloud-native application development and deployment processes, ensuring efficiency and consistency throughout software development lifecycle. Whether a platform engineer crafting tailored CI/CD systems or a developer benefitting from these systems.

browser-image

Section :- 1 (Default)

CI pipeline is the heart of custom environment in 01Cloud. It consists of tasks that automate software development process. 01Cloud provides default built-in CI support for various programming languages. A default CI pipeline include following tasks:

  1. Git Clone

This task responsible for cloning Git repository, ensuring that the latest code is available for further processing.

  1. Build and Push Image

This task encompasses two essential steps: building software and pushing it to a container registry. It helps in packaging and distributing applications efficiently.

Each step in CI pipeline generates detailed logs, providing visibility into the execution of tasks. Visualize logs for monitoring and debugging purposes.

Section :- 2 (Custom)

Create Tekton Custom Resource Definitions (CRDs) such as Task, Pipeline, and PipelineRun manifest files within a .01cloud folder in project repository. If .01cloud folder, found in project repository, It will execute the defined CI Pipeline. Execute every tasks defined in CI pipeline and monitor its progress, check the logs for every steps of task.If all tasks in the CI pipeline succeed then mark the CI Pipeline state as "Succeeded." If any task fails, mark the CI Pipeline state as "Failed. Ensure that you have a mechanism in place to collect and store logs from each step of every tasks. This is essential for debugging and troubleshooting when something goes wrong.

Task

A Task is a set of ordered steps that define for continuous integration process. It's like a recipe for work. Each Task runs in its own Pod on Kubernetes cluster. here

Example

apiVersion: tekton.dev/v1
kind: Task
metadata:
  name: git-clone
spec:
  params:
  - name: url
    type: string
    description: The URL of the Git repository to clone.
    default: "https://github.com/babulalt/one-time-secret.git"
  - name: revision
    description: git revision to checkout (branch, tag, sha, ref…)
    type: string
    default: pipeline-sucess
  - name: sub_directory
    description: subdirectory change
    default: "/"
  workspaces:
  - name: workspace
  steps:
  - name: check-directory
    image: alpine
    script: |
      if [ -d "$(workspaces.workspace.path)" ] && [ -z "$(ls -A $(workspaces.workspace.path))" ]; then
        echo "Directory is empty, proceeding with git clone..."
      else
        echo "Directory is not empty, skipping git clone..."
        exit 0
      fi
  - name: git-clone
    image: alpine/git
    script: |
      git clone -b "$(params.revision)" "$(params.url)" "$(workspaces.workspace.path)/app"
  - name: list-contents
    image: alpine
    script: |
      echo "Contents of the workspace directory:"
      ls -al "$(workspaces.workspace.path)/app"

Pipeline

Pipeline is a way to define and organize the tasks that make up continuous integration or continuous delivery (CI/CD) process. It's a structured blueprint for software development workflow. here

Example


apiVersion: tekton.dev/v1
kind: Pipeline
metadata:
  name: ci-pipeline
spec:
  workspaces:
  - name: workspace
  tasks:
    - name: git-clone
      params:
       - name: url
         value: "https://github.com/babulalt/one-time-secret.git"
       - name: revision
         value: "pipeline-sucess"
      workspaces:
      - name: workspace
        workspace: workspace
      taskRef:
        name: git-clone

PipelineRun

A PipelineRun is a way to put a Pipeline into action on your cluster. A Pipeline is like a set of ordered tasks, and a PipelineRun executes these tasks in the specified sequence until they all succeed or a problem occurs. here


apiVersion: tekton.dev/v1beta1
kind: PipelineRun
metadata:
  generateName: zro-pipeline-run
spec:
  pipelineRef:
    name: zro-pipeline
  workspaces:
    - name: workspace
      volumeClaimTemplate:
       spec:
        accessModes:
        - ReadWriteOnce
        resources:
          requests:
            storage: 500Mi