visit
In software engineering, CI/CD or CICD generally refers to the combined practices of continuous integration and either continuous delivery or continuous deployment.
CI/CD bridges the gaps between development and operation activities and teams by enforcing automation in building, testing and deployment of applications. Modern day DevOps practices involve continuous development, continuous testing, continuous integration, continuous deployment and continuous monitoring of software applications throughout its development life cycle. The CI/CD practice or CI/CD pipeline forms the backbone of modern day DevOps operations.Continuous integration
Developers practicing continuous integration merge their changes back to the main branch as often as possible. The developer's changes are validated by creating a build and running automated tests against the build. By doing so, you avoid integration challenges that can happen when waiting for release day to merge changes into the release branch.Continuous integration puts a great emphasis on testing automation to check that the application is not broken whenever new commits are integrated into the main branch.Continuous delivery
Continuous delivery is an extension of continuous integration since it automatically deploys all code changes to a testing and/or production environment after the build stage.This means that on top of automated testing, you have an automated release process and you can deploy your application any time by clicking a button.In theory, with continuous delivery, you can decide to release daily, weekly, fortnightly, or whatever suits your business requirements. However, if you truly want to get the benefits of continuous delivery, you should deploy to production as early as possible to make sure that you release small batches that are easy to troubleshoot in case of a problem.Continuous deployment
Continuous deployment goes one step further than continuous delivery. With this practice, every change that passes all stages of your production pipeline is released to your customers. There's no human intervention, and only a failed test will prevent a new change to be deployed to production.Continuous deployment is an excellent way to accelerate the feedback loop with your customers and take pressure off the team as there isn't a Release Day anymore. Developers can focus on building software, and they see their work go live minutes after they've finished working on it.source =Sample workflow
Below you'll find the definition of a sample API which uses JWT for its authentication mechanism:{
"test_name": "Platform with JWT based auth",
"num_clients": 250,
"hatch_rate": 250,
"run_time": 60,
"threads_per_region": 1,
"domain_name": "my-jwt-platform.com",
"protocol": "https",
"test_region": [ "us-east-1" ],
"workflow": [
{
"path": "/login_path",
"method": "POST",
"headers": {
"Content-Type": "application/x-www-form-urlencoded"
},
"data": "user=user&password=pass",
"extract": [
{
"parameter_name": "authtoken",
"location": "body",
"key": "access_token"
}
]
},
{
"path": "/my/profile",
"method": "GET",
"data": "",
"headers": {
"Authorization": "Bearer ${authtoken}"
}
},
{
"path": "/results",
"method": "POST",
"data": "{\"result_id\": \"1\"}"
"headers": {
"Authorization": "Bearer ${authtoken}"
}
}
]
}
{
"num_clients": 1,
"hatch_rate": 1,
"run_time": 10,
"threads_per_region": 1,
"workflow": [
{
"path": "/v1/api/tests/list",
"method": "POST",
"data": "{\"team_id\":\"rungutan\"}",
"headers": {
"X-Api-Key": "${vault.api_key}",
"content-type": "application/json"
},
"extract": [
{
"parameter_name": "testId",
"location": "body",
"key": "Tests.0.test_id"
}
]
},
{
"path": "/v1/api/tests/get",
"method": "POST",
"data": "{\"test_id\": \"${testId}\",\"team_id\": \"rungutan\"}",
"headers": {
"X-Api-Key": "${vault.api_key}",
"content-type": "application/json"
},
"extract": []
}
],
"domain_name": "api.rungutan.com",
"protocol": "https",
"test_region": [
"us-east-1"
],
"min_wait": 1000,
"max_wait": 1000,
"test_name": "DEMO - slow test with only successful results"
}
GitLab pipelines
image: "python:3.7-alpine"
stages:
- load_test
variables:
RUNGUTAN_TEAM_ID: your_team
RUNGUTAN_API_KEY: your_api_key
before_script:
- pip install rungutan
load_test:
stage: load_test
script:
- rungutan tests add --test_file test_file.json --wait_to_finish --test_name ${CI_PROJECT_PATH_SLUG}-${CI_PIPELINE_ID}
Jenkins
def RUNGUTAN_TEAM_ID=your_team
def RUNGUTAN_API_KEY=your_api_key
pipeline {
agent any
stages {
stage('LoadTest') {
agent {
docker {
image 'rungutancommunity/rungutan-cli:latest'
args '-u root -e ${RUNGUTAN_TEAM_ID} -e ${RUNGUTAN_API_KEY}'
reuseNode true
}
}
steps {
script {
rungutan tests add --test_file test_file.json --wait_to_finish --test_name ${BUILD_TAG}
}
}
}
}
}
GitHub Actions
name: Load test with Rungutan
on:
release:
types:
- created
jobs:
load:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- name: Load test your platform with Rungutan
uses: Rungutan/[email protected]
env:
RUNGUTAN_TEAM_ID: ${{ secrets.RUNGUTAN_TEAM_ID }}
RUNGUTAN_API_KEY: ${{ secrets.RUNGUTAN_API_KEY }}
RUNGUTAN_TEST_FILE: test_file.json
RUNGUTAN_TEST_NAME: ${{ github.repository }}-${{ github.ref }}
You must store workflow files in the .github/workflows directory of your repository.
GitHub also has a which contains a lot of free tools to help you improve your workflow. One of them is of course ->In order to set up a GitHub workflow, all you have to do is create a folder called .github and then follow the below structure of files to define your workflow locations:
~/.github (main) $ tree
.
└── workflows
└── main.yml
1 directory, 1 file
GitHub secrets are a set of encrypted (and obfuscated) strings that are defined (usually) on a per-repository basis which contain sensitive informations to be used as part of the GitHub Actions workflows.
In our case, these are:~/.github (main) $ cat workflows/main.yml
name: Load test with Rungutan
on:
# Triggers the workflow on push events but only for the "main" branch
push:
branches: [ main ]
jobs:
load:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- name: Load test your platform with Rungutan
uses: Rungutan/[email protected]
env:
RUNGUTAN_TEAM_ID: ${{ secrets.RUNGUTAN_TEAM_ID }}
RUNGUTAN_API_KEY: ${{ secrets.RUNGUTAN_API_KEY }}
RUNGUTAN_TEST_FILE: test_file.json
RUNGUTAN_TEST_NAME: ${{ github.repository }}-${{ github.ref }}
The logic behind this assumption is pretty straightforward -> each and every code or infrastructure change has the potential to either optimize or downgrade the speed of your platform which in turn affects of your course user experience.
That is why load testing after each and every release will provide you an accurate overall of how your platform is running and how it feels like for your customers.If you need any help implementing this, we're more than welcome to assist you .Previously published at