1111App\Models\Blog Object ( [table:protected] => blogs [fillable:protected] => Array ( [0] => user_id [1] => date [2] => image [3] => title [4] => slug [5] => detail [6] => post_excerpt [7] => status [8] => tags [9] => related_blog_id [10] => category_id [11] => meta_detail [12] => meta_keyword ) [casts:protected] => Array ( [tags] => array ) [connection:protected] => mysql [primaryKey:protected] => id [keyType:protected] => int [incrementing] => 1 [with:protected] => Array ( ) [withCount:protected] => Array ( ) [preventsLazyLoading] => [perPage:protected] => 15 [exists] => 1 [wasRecentlyCreated] => [escapeWhenCastingToString:protected] => [attributes:protected] => Array ( [id] => 60 [user_id] => 4 [category_id] => 9 [title] => Achieve Continuous Deployments with Jenkins and ArgoCD [slug] => achieve-continuous-deployments-with-jenkins-and-argocd [image] => 1709793921Continuous Deployments with Jenkins and ArgoCD.webp [date] => 2022-03-09 [detail] =>
Jenkins and ArgoCD are well-known and widely used DevOps project development tools by DevOps engineers. They help DevOps teams achieve continuous deployments on highly configured environments. In this article, we've explained steps to achieve continuous deployment on higher environments using Jenkins and ArgoCD while running functional application code tests in the lower environment, fixing bugs, and preparing it to run on high configuration platforms.
The process we’ll follow:
1. Use Jenkins and ArgoCD to build and deploy application code in Build(bld) environment.
2. Once the build is ready, the deployment environment will trigger the functional application tests and move code into the Integration(int) and Production(prd) environment.
3. In the production environment, a manual approval stage will be created before it shifts build for the deployment.
Step 1: Build and specify the version of the latest code image and then push it onto the Image repository.
Step 2: Update the build environment helm chart with the latest image tag.
Once steps 1 and 2 are done, ArgoCD will sync the latest code, start its deployment process, and trigger the post-sync-hooks to start running functional tests.
1. Successfully completed tests will finish the post-sync job and invoke the integration process of the Jenkins job.
2. Further, integrating Jenkins's job will amend the helm chart respectively.
3. With each new update on the helm chart, ArgoCD will trigger the code deployment process.
4. In the integration environment, once the deployment process completes successfully, it will trigger the approval process, and after getting approval, it will update the production environment helm charts.
(Note: Build the docker_build file and push the image onto the repository by specifying the image version tag with nginx:v1.0.0)
Use the following code to update the image tag and push it onto the GitHub repository:
stage('tag update and git commit') {
steps {
withCredentials([gitUsernamePassword(credentialsId: 'github-token', gitToolName: 'Default')]){
sh script:'''
#!/bin/bash
sed -i "s/`cat bld-values.yaml | grep tag: | awk {'print $2'} | head -1`/"$version"/g" bld-values.yaml
git status
gitstatus=`git status |grep -i 'nothing to commit' |awk -F, {'print $1'}`
echo $gitstatus
if [ "$gitstatus" = "nothing to commit" ]
then
echo "Pass the pipeline"
else
git status
git add .
git config --global user.email "jenkins@devops.com"
git config --global user.name "jenkins"
git commit -m "Modified bld-values.yaml by jenkins"
git push --set-upstream origin HEAD:main
fi
'''
}
}
}
Note: If a function test fails, it will result in the failed job and update the user regarding the failure. Tips: Set up argocs-notifications-controller to configure Jenkins as webhook and generate notification regarding sync or sync job failure. Jenkins details will be stored in the config-map format. Refer to the following lines of code:
#argocd-notifications-controller configmap
apiVersion: v1
data:
service.webhook.jenkins-int: |
url: http://jenkins.devops.online/job/int-argocd-job/build?token=jenkins-int-job
basicAuth:
username: devops
password: #################
service.webhook.jenkins-prd: |
url: http://jenkins.devops.online/job/prd-argocd-job/build?token=jenkins-prd-job
basicAuth:
username: devops
password: #################
AND
additionalApplications:
- name: nginx-bld
namespace: argocd
additionalLabels: {}
additionalAnnotations:
notifications.argoproj.io/subscribe.on-sync-failed.teams: channelName
notifications.argoproj.io/subscribe.on-sync-succeeded.jenkins-int: "" //application specific annotation
finalizers:
- resources-finalizer.argocd.argoproj.io
project: default
source:
repoURL: git@github.com:aa-playground/argocd-test-nginx.git
targetRevision: HEAD
path: nginx
helm:
valueFiles:
- bld-values.yaml
destination:
server: https://kubernetes.default.svc
namespace: default
syncPolicy:
automated:
prune: false
selfHeal: false
When you create an Argo project, you will get many supported controllers, such as:
You can take the information mentioned in this article as a beginners’ guide to achieving continuous deployment using Jenkins and ArgoCD, integrated with possible features needed to build a great solution Have any queries related to DevOps solutions or services? Write us your requirements at marketing@cloudstakes.com. Or Book your first free 60 minutes of DevOps consultation with our DevOps experts.
[post_excerpt] => In this article, we've explained steps to achieve continuous deployment on higher environments using Jenkins and ArgoCD while running functional application code... [tags] => ["445","446"] [related_blog_id] => 60 [status] => 1 [featured] => 0 [meta_detail] => In this article, we've explained steps to achieve continuous deployment on higher environments using Jenkins and ArgoCD while running functional application code... [meta_keyword] => [created_at] => 2023-01-10 03:44:50 [updated_at] => 2024-03-07 12:15:22 ) [original:protected] => Array ( [id] => 60 [user_id] => 4 [category_id] => 9 [title] => Achieve Continuous Deployments with Jenkins and ArgoCD [slug] => achieve-continuous-deployments-with-jenkins-and-argocd [image] => 1709793921Continuous Deployments with Jenkins and ArgoCD.webp [date] => 2022-03-09 [detail] =>
Jenkins and ArgoCD are well-known and widely used DevOps project development tools by DevOps engineers. They help DevOps teams achieve continuous deployments on highly configured environments. In this article, we've explained steps to achieve continuous deployment on higher environments using Jenkins and ArgoCD while running functional application code tests in the lower environment, fixing bugs, and preparing it to run on high configuration platforms.
The process we’ll follow:
1. Use Jenkins and ArgoCD to build and deploy application code in Build(bld) environment.
2. Once the build is ready, the deployment environment will trigger the functional application tests and move code into the Integration(int) and Production(prd) environment.
3. In the production environment, a manual approval stage will be created before it shifts build for the deployment.
Step 1: Build and specify the version of the latest code image and then push it onto the Image repository.
Step 2: Update the build environment helm chart with the latest image tag.
Once steps 1 and 2 are done, ArgoCD will sync the latest code, start its deployment process, and trigger the post-sync-hooks to start running functional tests.
1. Successfully completed tests will finish the post-sync job and invoke the integration process of the Jenkins job.
2. Further, integrating Jenkins's job will amend the helm chart respectively.
3. With each new update on the helm chart, ArgoCD will trigger the code deployment process.
4. In the integration environment, once the deployment process completes successfully, it will trigger the approval process, and after getting approval, it will update the production environment helm charts.
(Note: Build the docker_build file and push the image onto the repository by specifying the image version tag with nginx:v1.0.0)
Use the following code to update the image tag and push it onto the GitHub repository:
stage('tag update and git commit') {
steps {
withCredentials([gitUsernamePassword(credentialsId: 'github-token', gitToolName: 'Default')]){
sh script:'''
#!/bin/bash
sed -i "s/`cat bld-values.yaml | grep tag: | awk {'print $2'} | head -1`/"$version"/g" bld-values.yaml
git status
gitstatus=`git status |grep -i 'nothing to commit' |awk -F, {'print $1'}`
echo $gitstatus
if [ "$gitstatus" = "nothing to commit" ]
then
echo "Pass the pipeline"
else
git status
git add .
git config --global user.email "jenkins@devops.com"
git config --global user.name "jenkins"
git commit -m "Modified bld-values.yaml by jenkins"
git push --set-upstream origin HEAD:main
fi
'''
}
}
}
Note: If a function test fails, it will result in the failed job and update the user regarding the failure. Tips: Set up argocs-notifications-controller to configure Jenkins as webhook and generate notification regarding sync or sync job failure. Jenkins details will be stored in the config-map format. Refer to the following lines of code:
#argocd-notifications-controller configmap
apiVersion: v1
data:
service.webhook.jenkins-int: |
url: http://jenkins.devops.online/job/int-argocd-job/build?token=jenkins-int-job
basicAuth:
username: devops
password: #################
service.webhook.jenkins-prd: |
url: http://jenkins.devops.online/job/prd-argocd-job/build?token=jenkins-prd-job
basicAuth:
username: devops
password: #################
AND
additionalApplications:
- name: nginx-bld
namespace: argocd
additionalLabels: {}
additionalAnnotations:
notifications.argoproj.io/subscribe.on-sync-failed.teams: channelName
notifications.argoproj.io/subscribe.on-sync-succeeded.jenkins-int: "" //application specific annotation
finalizers:
- resources-finalizer.argocd.argoproj.io
project: default
source:
repoURL: git@github.com:aa-playground/argocd-test-nginx.git
targetRevision: HEAD
path: nginx
helm:
valueFiles:
- bld-values.yaml
destination:
server: https://kubernetes.default.svc
namespace: default
syncPolicy:
automated:
prune: false
selfHeal: false
When you create an Argo project, you will get many supported controllers, such as:
You can take the information mentioned in this article as a beginners’ guide to achieving continuous deployment using Jenkins and ArgoCD, integrated with possible features needed to build a great solution Have any queries related to DevOps solutions or services? Write us your requirements at marketing@cloudstakes.com. Or Book your first free 60 minutes of DevOps consultation with our DevOps experts.
[post_excerpt] => In this article, we've explained steps to achieve continuous deployment on higher environments using Jenkins and ArgoCD while running functional application code... [tags] => ["445","446"] [related_blog_id] => 60 [status] => 1 [featured] => 0 [meta_detail] => In this article, we've explained steps to achieve continuous deployment on higher environments using Jenkins and ArgoCD while running functional application code... [meta_keyword] => [created_at] => 2023-01-10 03:44:50 [updated_at] => 2024-03-07 12:15:22 ) [changes:protected] => Array ( ) [classCastCache:protected] => Array ( ) [attributeCastCache:protected] => Array ( ) [dates:protected] => Array ( ) [dateFormat:protected] => [appends:protected] => Array ( ) [dispatchesEvents:protected] => Array ( ) [observables:protected] => Array ( ) [relations:protected] => Array ( ) [touches:protected] => Array ( ) [timestamps] => 1 [hidden:protected] => Array ( ) [visible:protected] => Array ( ) [guarded:protected] => Array ( [0] => * ) )