├── Jenkinsfile ├── README.md └── deployment.yaml /Jenkinsfile: -------------------------------------------------------------------------------- 1 | node { 2 | def app 3 | 4 | stage('Clone repository') { 5 | 6 | 7 | checkout scm 8 | } 9 | 10 | stage('Update GIT') { 11 | script { 12 | catchError(buildResult: 'SUCCESS', stageResult: 'FAILURE') { 13 | withCredentials([usernamePassword(credentialsId: 'github', passwordVariable: 'GIT_PASSWORD', usernameVariable: 'GIT_USERNAME')]) { 14 | //def encodedPassword = URLEncoder.encode("$GIT_PASSWORD",'UTF-8') 15 | sh "git config user.email raj@cloudwithraj.com" 16 | sh "git config user.name RajSaha" 17 | //sh "git switch master" 18 | sh "cat deployment.yaml" 19 | sh "sed -i 's+raj80dockerid/test.*+raj80dockerid/test:${DOCKERTAG}+g' deployment.yaml" 20 | sh "cat deployment.yaml" 21 | sh "git add ." 22 | sh "git commit -m 'Done by Jenkins Job changemanifest: ${env.BUILD_NUMBER}'" 23 | sh "git push https://${GIT_USERNAME}:${GIT_PASSWORD}@github.com/${GIT_USERNAME}/kubernetesmanifest.git HEAD:main" 24 | } 25 | } 26 | } 27 | } 28 | } 29 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | ## What this does? 2 | This repo along with https://github.com/saha-rajdeep/kubernetescode creates a Jenkins pipeline with GitOps to deploy code into a Kubernetes cluster. CI part is done via Jenkins and CD part via ArgoCD (GitOps). 3 | 4 | 5 | Please refer to the https://github.com/saha-rajdeep/kubernetescode/blob/main/README.md for the instructions on how to use the codes. 6 | -------------------------------------------------------------------------------- /deployment.yaml: -------------------------------------------------------------------------------- 1 | apiVersion: apps/v1 2 | kind: Deployment 3 | metadata: 4 | creationTimestamp: null 5 | labels: 6 | app: flaskdemo 7 | name: flaskdemo 8 | spec: 9 | replicas: 3 10 | selector: 11 | matchLabels: 12 | app: flaskdemo 13 | strategy: {} 14 | template: 15 | metadata: 16 | creationTimestamp: null 17 | labels: 18 | app: flaskdemo 19 | spec: 20 | containers: 21 | - image: raj80dockerid/test:6 22 | name: flaskdemo 23 | resources: {} 24 | status: {} 25 | --- 26 | apiVersion: v1 27 | kind: Service 28 | metadata: 29 | name: lb-service 30 | labels: 31 | app: lb-service 32 | spec: 33 | type: LoadBalancer 34 | ports: 35 | - port: 80 36 | targetPort: 5000 37 | selector: 38 | app: flaskdemo 39 | --------------------------------------------------------------------------------