Introduction

CI/CD (Continuous Integration/Continuous Deployment) is critical for maintaining the reliability and stability of Cilium as it evolves. This documentation provides an in-depth guide to deploying CI/CD for the Cilium project using a bare metal cloud environment.

Setup Overview

For leveraging CI/CD, the Cilium project utilizes a CI infrastructure that facilitates complex test execution involving container orchestration systems such as Kubernetes and Docker. The environment harnesses the capabilities of packet.net’s bare metal cloud for efficient provisioning and testing.

CI Deployment Using Jenkins

The implementation leverages Jenkins, a popular CI tool, and integrates with the existing developer environment using Vagrant. The following steps detail the CI setup process.

Step 1: Jenkinsfile Creation

Create a Jenkinsfile in the root of the Cilium project repository. This file defines the CI pipeline stages. Below is a sample Jenkinsfile:

pipeline {
    agent {
        label 'vagrant'
    }
    options {
        timeout(time: 30, unit: 'MINUTES')
    }
    stages {
        stage('Build') {
            environment {
                MEMORY = '4096'
                RUN_TEST_SUITE = '1'
            }
            steps {
                sh './contrib/vagrant/start.sh'
            }
        }
    }
    post {
        always {
            sh 'vagrant destroy -f'
        }
    }
}

Step 2: Vagrant Configuration

Make sure your Vagrant configuration is set up to replicate the appropriate development environment. The start.sh script should contain the logic to provision the environment necessary for running your tests.

Step 3: Utilizing Bare Metal Cloud

Utilizing packet.net simplifies provisioning. Provision a machine with the existing Vagrant setup. The ability to directly use bare metal resources is beneficial for performance-intensive tests.

vagrant up

Execute the above command to start your Vagrant environment. Once it is initiated, the pipeline will automatically trigger the test suite defined in the Jenkins stage.

Step 4: Running Tests

Ensure the test suite can run within the provisioned environment. The integration with Jenkins handles automatic triggering of tests whenever a commit is made to the repository.

Step 5: Destruction of Vagrant Environment

After test execution, the environment will automatically destroy itself according to the post conditions set in the Jenkinsfile:

post {
    always {
        sh 'vagrant destroy -f'
    }
}

This cleanup step ensures no residual resource allocations are left behind, optimizing cost and resource usage.

Conclusion

The CI/CD setup for the Cilium project effectively utilizes Jenkins and Vagrant in a bare metal cloud infrastructure, enabling robust testing capabilities. This design not only mirrors developers’ working environments but also enhances performance through the use of bare metal.

Acknowledgments

Special thanks to packet.net for their support in building this CI environment and improving the capabilities of Cilium.

Source: Why We Love the Packet.net Cloud for CI/CD