50 likes
·
14.2K reads
16 comments
Thank you so much for this content. Its really helpful.I feel there is some wonderful projects over MR. DevOps YouTube channel as well. It would be great if you try that as well.
Sure Ramailo, I will check. This way we can learn and explore more concepts. Thanks for sharing.
Amazing presentation but when I ran my build it shows me an errors which is
Started by user Admin ERROR: Unable to find blob/main/java-maven-sonar-argocd-helm-k8s/spring-boot-app/JenkinsFile from git github.com/BroDevOps/Jenkins-Zero-To-Hero Finished: FAILURE
Sagar, please make changes to your Jenkins-Zero-To-Hero/java-maven-sonar-argocd-helm-k8s/spring-boot-app/JenkinsFile
- replace iam-veeramalla with you repo name (BroDevOps)
- replace with your email and username. git config user.email "abhishek.xyz@gmail.com" git config user.name "Abhishek Veeramalla"
- Make sure u are creating creditials in Jenkins as mentioned in blog.
Hope this solve your issue.
DOCKER_IMAGE = "abhishekf5/ultimate-cicd:${BUILD_NUMBER}"
for above line replace abhishekf5 with your dockeruser.
Jenkins-Zero-To-Hero/java-maven-sonar-argocd-helm-k8s/spring-boot-app-manifests/deployment.yml
in above file, change abhishekf5 with your dockerhub username
hii this is amazing but i ran into an error in build stage can anyone help Started by user Ashish Mondal Obtained java-maven-sonar-argocd-helm-k8s/spring-boot-app/JenkinsFile from git github.com/Hawk-95/Jenkins-integration.git [Pipeline] Start of Pipeline [Pipeline] node Running on Jenkins in /var/lib/jenkins/workspace/ultimate-demo [Pipeline] { [Pipeline] stage [Pipeline] { (Declarative: Checkout SCM) [Pipeline] checkout Selected Git installation does not exist. Using Default The recommended git tool is: NONE No credentials specified
git rev-parse --resolve-git-dir /var/lib/jenkins/workspace/ultimate-demo/.git # timeout=10 Fetching changes from the remote Git repository git config remote.origin.url github.com/Hawk-95/Jenkins-integration.git # timeout=10 Fetching upstream changes from github.com/Hawk-95/Jenkins-integration.git git --version # timeout=10 git --version # 'git version 2.34.1' git fetch --tags --force --progress -- github.com/Hawk-95/Jenkins-integration.git +refs/heads/:refs/remotes/origin/ # timeout=10 git rev-parse refs/remotes/origin/main^{commit} # timeout=10 Checking out Revision acaf393f80b94a5b905e891661d5da7e7af51868 (refs/remotes/origin/main) git config core.sparsecheckout # timeout=10 git checkout -f acaf393f80b94a5b905e891661d5da7e7af51868 # timeout=10 Commit message: "Update JenkinsFile" git rev-list --no-walk b96312af3baf66c1301f51c409f6cb589166b549 # timeout=10 [Pipeline] } [Pipeline] // stage [Pipeline] withEnv [Pipeline] { [Pipeline] isUnix [Pipeline] withEnv [Pipeline] { [Pipeline] sh
- docker inspect -f . ashishm95/maven-abhishek-docker-agent:v1
Error: No such object: ashishm95/maven-abhishek-docker-agent:v1 [Pipeline] isUnix [Pipeline] withEnv [Pipeline] { [Pipeline] sh
- docker pull ashishm95/maven-abhishek-docker-agent:v1 Error response from daemon: pull access denied for ashishm95/maven-abhishek-docker-agent, repository does not exist or may require 'docker login': denied: requested access to the resource is denied [Pipeline] } [Pipeline] // withEnv [Pipeline] } [Pipeline] // withEnv [Pipeline] } [Pipeline] // withEnv [Pipeline] } [Pipeline] // node [Pipeline] End of Pipeline ERROR: script returned exit code 1 Finished: FAILURE
I used agent created by Abhishek Veeramalla. He explained this agent image is with docker and maven. I haven't tried to create my own agent image. When we run application manually in first step, we first installed maven and docker then created image. docker pull ashishm95/maven-abhishek-docker-agent:v1 Did you created your own agent with maven and docker? if not then use 'abhishekf5/maven-abhishek-docker-agent:v1' as it is. Thanks.
Sunita Actually i have redo that agent thing i kept it as it is the below is my jenkinsfile but the error is still the same its not getting the git
pipeline { agent { docker { image 'abhishekf5/maven-abhishek-docker-agent:v1' args '--user root -v /var/run/docker.sock:/var/run/docker.sock' // mount Docker socket to access the host's Docker daemon } } stages { stage('Checkout') { steps { sh 'echo passed' //git branch: 'main', url: 'github.com/sunitabachhav2007/Jenkins-Zero-…' } } stage('Build and Test') { steps { sh 'ls -ltr' // build the project and create a JAR file sh 'cd java-maven-sonar-argocd-helm-k8s/spring-boot-app && mvn clean package' } } stage('Static Code Analysis') { environment { SONAR_URL = "35.172.186.121:9000" } steps { withCredentials([string(credentialsId: 'sonarqube', variable: 'SONAR_AUTH_TOKEN')]) { sh 'cd java-maven-sonar-argocd-helm-k8s/spring-boot-app && mvn sonar:sonar -Dsonar.login=$SONAR_AUTH_TOKEN -Dsonar.host.url=${SONAR_URL}' } } } stage('Build and Push Docker Image') { environment { DOCKER_IMAGE = "ashishm95/ultimate-cicd:${BUILD_NUMBER}" // DOCKERFILE_LOCATION = "java-maven-sonar-argocd-helm-k8s/spring-boot-app/Dockerfile" REGISTRY_CREDENTIALS = credentials('docker-cred') } steps { script { sh 'cd java-maven-sonar-argocd-helm-k8s/spring-boot-app && docker build -t ${DOCKER_IMAGE} .' def dockerImage = docker.image("${DOCKER_IMAGE}") docker.withRegistry('index.docker.io/v1', "docker-cred") { dockerImage.push() } } } } stage('Update Deployment File') { environment { GIT_REPO_NAME = "Jenkins-integration" GIT_USER_NAME = "Hawk-95" } steps { withCredentials([string(credentialsId: 'github', variable: 'GITHUB_TOKEN')]) { sh ''' git config user.email "mondalashish74@gmail.com" git config user.name "Hawk-95" BUILD_NUMBER=${BUILD_NUMBER} sed -i -e "s/ultimate-cicd.*/ultimate-cicd:${BUILD_NUMBER}/g" java-maven-sonar-argocd-helm-k8s/spring-boot-app-manifests/deployment.yml git add java-maven-sonar-argocd-helm-k8s/spring-boot-app-manifests/deployment.yml git commit -m "Update deployment image to version ${BUILD_NUMBER}" git push https://${GITHUB_TOKEN}@github.com/${GIT_USER_NAME}/${GIT_REPO_NAME} HEAD:main ''' } } } } }
error
Started by user Ashish Mondal Obtained java-maven-sonar-argocd-helm-k8s/spring-boot-app/JenkinsFile from git github.com/Hawk-95/Jenkins-integration.git [Pipeline] Start of Pipeline [Pipeline] node Running on Jenkins in /var/lib/jenkins/workspace/jenkins-git-intigration [Pipeline] { [Pipeline] stage [Pipeline] { (Declarative: Checkout SCM) [Pipeline] checkout Selected Git installation does not exist. Using Default The recommended git tool is: NONE No credentials specified
git rev-parse --resolve-git-dir /var/lib/jenkins/workspace/jenkins-git-intigration/.git # timeout=10 Fetching changes from the remote Git repository git config remote.origin.url github.com/Hawk-95/Jenkins-integration.git # timeout=10 Fetching upstream changes from github.com/Hawk-95/Jenkins-integration.git git --version # timeout=10 git --version # 'git version 2.34.1' git fetch --tags --force --progress -- github.com/Hawk-95/Jenkins-integration.git +refs/heads/:refs/remotes/origin/ # timeout=10 git rev-parse refs/remotes/origin/main^{commit} # timeout=10 Checking out Revision a3526aec3aa9886f89e5d46286ba2af7f2b49080 (refs/remotes/origin/main) git config core.sparsecheckout # timeout=10 git checkout -f a3526aec3aa9886f89e5d46286ba2af7f2b49080 # timeout=10 Commit message: "Update deployment.yml" git rev-list --no-walk a3526aec3aa9886f89e5d46286ba2af7f2b49080 # timeout=10 [Pipeline] } [Pipeline] // stage [Pipeline] withEnv [Pipeline] { [Pipeline] isUnix [Pipeline] withEnv [Pipeline] { [Pipeline] sh
- docker inspect -f . abhishekf5/maven-abhishek-docker-agent:v1
Got permission denied while trying to connect to the Docker daemon socket at unix:///var/run/docker.sock: Get "http://%2Fvar%2Frun%2Fdocker.sock/v1.24/containers/abhishekf5/maven-abhishek-docker-agent:v1/json": dial unix /var/run/docker.sock: connect: permission denied [Pipeline] isUnix [Pipeline] withEnv [Pipeline] { [Pipeline] sh
- docker pull abhishekf5/maven-abhishek-docker-agent:v1 Got permission denied while trying to connect to the Docker daemon socket at unix:///var/run/docker.sock: Post "http://%2Fvar%2Frun%2Fdocker.sock/v1.24/images/create?fromImage=abhishekf5%2Fmaven-abhishek-docker-agent&tag=v1": dial unix /var/run/docker.sock: connect: permission denied [Pipeline] } [Pipeline] // withEnv [Pipeline] } [Pipeline] // withEnv [Pipeline] } [Pipeline] // withEnv [Pipeline] } [Pipeline] // node [Pipeline] End of Pipeline ERROR: script returned exit code 1 Finished: FAILURE
Hi Sunita, Thank you for this content. It will help me a lot. Can you please confirm me where I can get SonarQube URL?
Hello Birendra, It is your EC2 Public IP Address where you are going install sonarqube. (Steps for same are mentioned "Configure a Sonar Server locally")
Thanks Sunita. I built my own image agent with the jdk 17 but I'm getting error "fatal: not in a git directory" when running git commands. Looks like git recognizes root is not the same user that fetch the git files. Did you do something special to you image abhishekf5/maven-abhishek-docker-agent:v1 ? Thanks again
I used agent created by Abhishek Veeramalla. He explained this agent image is with docker and maven. I haven't tried to create my own agent image. When we run application manually in first step, we first installed maven and docker then created image.
Thank you :) Sunita
Thank you so much for this content. Its really helpful.I implemented this setup, every thing went good but in minikube i listed all the services after converting cluster ip to NodePort, i got the URLs to access from browser, When i tried to access its not coming up(this site can't be reached), but all the pods are up on running, i am not sure what might be the reason, i implemented minikube setup in ubuntu medium server in aws, but nodeport should be accessible from outside also right, can you please suggest me what will be the reason for not getting argocd running on browser?
Reply
In this blog, I provided a guide on achieving continuous deployment on Minikube. However, I understand that for Windows OS users, the process of setting up Virtual Box can be quite daunting, especially for those who are not familiar with the technology. Additionally, configuring Minikube and ArgoCD on a Virtual Box/EC2 instance can require more manual setup and configuration. Given these challenges, I would like to offer an alternative solution by explaining how to deploy the Java application on Amazon EKS. Please follow this blog only for CD part. Means instead of minikube, u use AWS EKS, so that u can access ur running application on browser. Thanks.