GitHub Actions + CAEPE:  Turbocharging Your CI/CD Pipeline (Part 2)

In part 1, we explored the benefits and use cases of using GitHub Actions for your CI/CD pipeline and how integrating a CD tool such as CAEPE provides additional advantages of enabling different teams to carry out deployment independently, executing progressive delivery strategies and deploying applications across different cloud platforms and environments.

Here we will focus on how to integrate CAEPE with GitHub Actions. 

Integrating CAEPE with GitHub Actions for Kubernetes application deployments

The roles of the various tools are as follows:

GitHub is the source control system

GitHub Actions will be used to build applications

CAEPE takes care of deploying and promoting releases between environments

Within your GitHub Action workflows, a CAEPE action enables interaction with CAEPE. This action initiates deployments, rollbacks, and other tasks related to continuous deployment. One simple step of defining necessary parameters such application name and version allows you to automate the entire deployment process with one action.

The following diagram illustrates how the different tools work together.

Setting up the integration

Before we begin, you should have CAEPE and GitHub set up. CAEPE can be set up as a SaaS or on your own infrastructure.

Learn more about setting up CAEPE.

1. Set up a GitHub Actions workflow:

  • Create a new workflow file in your GitHub repository, using the YAML syntax.
  • Define the triggers for the workflow, such as a push event or a pull request.
  • Specify the steps required to build, test, and package your application.

2. Add the CAEPE action:

Within your GitHub Actions workflow, add the CAEPE action to trigger deployments to your Kubernetes clusters. Configure the action with the necessary parameters, such as the application name, version, and target environment. CAEPE provides different options for this. You can use CLI, API or webhooks. I have provided information on all three options below.

CAEPE CLI

In your repository, create the .github/workflows/ directory to store your workflow files.

In the .github/workflows/ directory, create a new file called mypipeline.yml and add the code below.

name: Build, Test and Publish

on:
  push:
    branches: [main]
  pull_request:
    branches: [main]

jobs:
  pipeline:
    runs-on: ubuntu-latest

    steps:

    - name: Checkout code
      uses: actions/checkout@v2

    - name: Set up Python Environment
      uses: actions/setup-python@v2
      with:
        python-version: '3.x'
    - name: Install Dependencies
      run: |
        python -m pip install --upgrade pip
        pip install -r requirements.txt
  
    - name: Run Tests
      run: |
        python manage.py test

    - name: Install CAEPE CLI
      run: |
        python manage.py test

    - name: Trigger CAEPE CLI
      run: |
        caepe deployment create myapp mycluster mydeployment

Learn more about CAEPE CLI.

CAEPE API

name: Build, Test and Publish

on:
  push:
    branches: [main]
  pull_request:
    branches: [main]

jobs:
  pipeline:
    runs-on: ubuntu-latest

    steps:

    - name: Checkout code
      uses: actions/checkout@v2

    - name: Set up Python Environment
      uses: actions/setup-python@v2
      with:
        python-version: '3.x'
    - name: Install Dependencies
      run: |
        python -m pip install --upgrade pip
        pip install -r requirements.txt
  
    - name: Run Tests
      run: |
        python manage.py test

    - name: Trigger CAEPE API
      uses: wei/curl@master
      with:
        args: -X POST https://www/v2/Deployments -H accept: application/json -H organization: myorg -H Content-Type: application/json -d {"name":"string","description":"string","namespace":"string","cluster":{"clusterName":"string","clusterId":"string"},"application":"string","deploymentType":"standard","postDeployActivities":[{"postDeployActivities":"smoketest"}],"release":{"branch":"string","message":"string"},"accessGroups":[{"name":"string","id":"string"}],"strategy":{"name":"string"},"arguments":[{"key":"string","value":"string","clusterOrGroup":"string"}]}

Learn more about CAEPE API.

CAEPE Webhook

name: Build, Test and Publish

on:
  push:
    branches: [main]
  pull_request:
    branches: [main]

jobs:
  pipeline:
    runs-on: ubuntu-latest

    steps:

    - name: Checkout code
      uses: actions/checkout@v2

    - name: Set up Python Environment
      uses: actions/setup-python@v2
      with:
        python-version: '3.x'
    - name: Install Dependencies
      run: |
        python -m pip install --upgrade pip
        pip install -r requirements.txt
  
    - name: Run Tests
      run: |
        python manage.py test

    - name: Trigger CAEPE Webhook
      uses: jasongitmail/fast-webhook@v1
      with:
        url: "https://hook.caepe.sh/serviceid/trigger/jobid"
        json: '{"foo": "bar"}'

3. Test the integration:

Commit and push your changes to trigger the GitHub Actions workflow. Monitor the workflow execution in the GitHub Actions dashboard and verify that the deployment to your Kubernetes clusters is successful.

With the integration set up, you can now use CAEPE to automate deployment tasks and workflows. CAEPE can be used to manage multiple environments, rollbacks, and versioning of your applications.

View key deployment information in real-time

Deploy across different environments

Find issues quickly through smoke tests

Run progressive delivery strategies

Conclusion: Turbocharge Your CI/CD Pipeline with CAEPE and GitHub Actions

By following the step-by-step guide provided in this article, seamlessly integrate CAEPE with GitHub Actions and leverage their combined capabilities for efficient Kubernetes deployments. Integrating CAEPE with GitHub Actions can greatly streamline your DevOps workflow, especially for Kubernetes deployments. As a CD tool, CAEPE automates the deployment process, allowing for faster and more reliable software releases.

Check out these other resources:

Scroll to Top