From dc00d032fca2ec2634781b1c5f186e2b85e32fe7 Mon Sep 17 00:00:00 2001 From: Dasmanth Date: Thu, 29 Feb 2024 16:42:23 +0530 Subject: [PATCH 01/58] jenkins mofi --- Jenkinsfile | 132 ++++++++-------------------------------------------- 1 file changed, 19 insertions(+), 113 deletions(-) diff --git a/Jenkinsfile b/Jenkinsfile index 7fecd3c2b..22921d708 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -1,122 +1,28 @@ pipeline { - - agent any -/* - tools { - maven "maven3" - + agent any + tools { + maven "MAVEN3" + jdk "OracleJDK17" } -*/ + environment { - NEXUS_VERSION = "nexus3" - NEXUS_PROTOCOL = "http" - NEXUS_URL = "172.31.40.209:8081" - NEXUS_REPOSITORY = "vprofile-release" - NEXUS_REPO_ID = "vprofile-release" - NEXUS_CREDENTIAL_ID = "nexuslogin" - ARTVERSION = "${env.BUILD_ID}" + SNAP_REPO = 'vprofile-snapshot' + NEXUS_USER = 'admin' + NEXUS_PASS = 'Dasmanth1@' + RELEASE_REPO = 'vprofile-release' + CENTRAL_REPO = 'vpro-maven-central' + NEXUS_IP = '172.31.25.15' #nexus server private ip + NEXUS_PORT = '8081' + NEXUS_GRP_REPO = 'vpro-maven-group' + NEXUS_LOGIN = 'nexuslogin' } - - stages{ - - stage('BUILD'){ - steps { - sh 'mvn clean install -DskipTests' - } - post { - success { - echo 'Now Archiving...' - archiveArtifacts artifacts: '**/target/*.war' - } - } - } - - stage('UNIT TEST'){ - steps { - sh 'mvn test' - } - } - - stage('INTEGRATION TEST'){ - steps { - sh 'mvn verify -DskipUnitTests' - } - } - - stage ('CODE ANALYSIS WITH CHECKSTYLE'){ - steps { - sh 'mvn checkstyle:checkstyle' - } - post { - success { - echo 'Generated Analysis Result' - } - } - } - - stage('CODE ANALYSIS with SONARQUBE') { - - environment { - scannerHome = tool 'sonarscanner4' - } - - steps { - withSonarQubeEnv('sonar-pro') { - sh '''${scannerHome}/bin/sonar-scanner -Dsonar.projectKey=vprofile \ - -Dsonar.projectName=vprofile-repo \ - -Dsonar.projectVersion=1.0 \ - -Dsonar.sources=src/ \ - -Dsonar.java.binaries=target/test-classes/com/visualpathit/account/controllerTest/ \ - -Dsonar.junit.reportsPath=target/surefire-reports/ \ - -Dsonar.jacoco.reportsPath=target/jacoco.exec \ - -Dsonar.java.checkstyle.reportPaths=target/checkstyle-result.xml''' - } - - timeout(time: 10, unit: 'MINUTES') { - waitForQualityGate abortPipeline: true - } - } - } - stage("Publish to Nexus Repository Manager") { + stages { + stage('Build'){ steps { - script { - pom = readMavenPom file: "pom.xml"; - filesByGlob = findFiles(glob: "target/*.${pom.packaging}"); - echo "${filesByGlob[0].name} ${filesByGlob[0].path} ${filesByGlob[0].directory} ${filesByGlob[0].length} ${filesByGlob[0].lastModified}" - artifactPath = filesByGlob[0].path; - artifactExists = fileExists artifactPath; - if(artifactExists) { - echo "*** File: ${artifactPath}, group: ${pom.groupId}, packaging: ${pom.packaging}, version ${pom.version} ARTVERSION"; - nexusArtifactUploader( - nexusVersion: NEXUS_VERSION, - protocol: NEXUS_PROTOCOL, - nexusUrl: NEXUS_URL, - groupId: pom.groupId, - version: ARTVERSION, - repository: NEXUS_REPOSITORY, - credentialsId: NEXUS_CREDENTIAL_ID, - artifacts: [ - [artifactId: pom.artifactId, - classifier: '', - file: artifactPath, - type: pom.packaging], - [artifactId: pom.artifactId, - classifier: '', - file: "pom.xml", - type: "pom"] - ] - ); - } - else { - error "*** File: ${artifactPath}, could not be found"; - } - } + sh 'mvn -s settings.xml -DskipTests install' } + } - - - } - - + } } From f4fd5741383a845dc75a4865c5283a91d46e7502 Mon Sep 17 00:00:00 2001 From: Dasmanth Date: Thu, 29 Feb 2024 17:02:00 +0530 Subject: [PATCH 02/58] jenkins new --- Jenkinsfile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Jenkinsfile b/Jenkinsfile index 22921d708..a795148ae 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -11,7 +11,7 @@ pipeline { NEXUS_PASS = 'Dasmanth1@' RELEASE_REPO = 'vprofile-release' CENTRAL_REPO = 'vpro-maven-central' - NEXUS_IP = '172.31.25.15' #nexus server private ip + NEXUS_IP = '172.31.25.15' NEXUS_PORT = '8081' NEXUS_GRP_REPO = 'vpro-maven-group' NEXUS_LOGIN = 'nexuslogin' From 60998c0535d8e9660aff102c908ca3a1acb3b7a1 Mon Sep 17 00:00:00 2001 From: Dasmanth Date: Thu, 29 Feb 2024 17:10:17 +0530 Subject: [PATCH 03/58] build stage changes --- Jenkinsfile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Jenkinsfile b/Jenkinsfile index a795148ae..e004c1757 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -20,7 +20,7 @@ pipeline { stages { stage('Build'){ steps { - sh 'mvn -s settings.xml -DskipTests install' + sh 'mvn -s pom.xml -DskipTests install' } } From eb649b2453eac6bd3e3959a5bf401d36e64152ed Mon Sep 17 00:00:00 2001 From: Dasmanth Date: Thu, 29 Feb 2024 17:19:36 +0530 Subject: [PATCH 04/58] archiving stage added --- Jenkinsfile | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/Jenkinsfile b/Jenkinsfile index e004c1757..9e13e2b97 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -24,5 +24,11 @@ pipeline { } } - } + } + post { + success { + echo 'Archiving' + archiveArtifacts artifacts: '**/*.war' + } + } } From 81420eb0c6798aa57d8727955653dfb5c4bf90b4 Mon Sep 17 00:00:00 2001 From: Dasmanth Date: Thu, 29 Feb 2024 17:27:05 +0530 Subject: [PATCH 05/58] new stages added --- Jenkinsfile | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/Jenkinsfile b/Jenkinsfile index 9e13e2b97..63c0fd182 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -31,4 +31,16 @@ pipeline { archiveArtifacts artifacts: '**/*.war' } } + stage('Test') { + steps { + sh 'mvn -s pom.xml test' + } + } + + stage('Checkstyle Analysis') { + steps { + sh 'mvn -s pom.xml checkstyle:checkstyle' + } + } + } From 106beea752345c29979cc27713039a4566e6c723 Mon Sep 17 00:00:00 2001 From: Dasmanth Date: Thu, 29 Feb 2024 17:29:45 +0530 Subject: [PATCH 06/58] new --- Jenkinsfile | 2 ++ 1 file changed, 2 insertions(+) diff --git a/Jenkinsfile b/Jenkinsfile index 63c0fd182..55636fa6b 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -36,6 +36,8 @@ pipeline { sh 'mvn -s pom.xml test' } } + + stage('Checkstyle Analysis') { steps { From 8fb15da0f758c88ea114cdba0f730c5b9c0259df Mon Sep 17 00:00:00 2001 From: Dasmanth Date: Thu, 29 Feb 2024 17:31:58 +0530 Subject: [PATCH 07/58] new changes --- Jenkinsfile | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/Jenkinsfile b/Jenkinsfile index 55636fa6b..789bb2e42 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -30,15 +30,14 @@ pipeline { echo 'Archiving' archiveArtifacts artifacts: '**/*.war' } - } + } + stage('Test') { steps { sh 'mvn -s pom.xml test' } } - - stage('Checkstyle Analysis') { steps { sh 'mvn -s pom.xml checkstyle:checkstyle' From f4aafbc5eaf76602802b82dad46642f4f1ed52dd Mon Sep 17 00:00:00 2001 From: Dasmanth Date: Thu, 29 Feb 2024 17:41:28 +0530 Subject: [PATCH 08/58] indi --- Jenkinsfile | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/Jenkinsfile b/Jenkinsfile index 789bb2e42..e03776736 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -32,15 +32,15 @@ pipeline { } } - stage('Test') { - steps { - sh 'mvn -s pom.xml test' + stage('Test') { + steps { + sh 'mvn -s pom.xml test' } } - stage('Checkstyle Analysis') { - steps { - sh 'mvn -s pom.xml checkstyle:checkstyle' + stage('Checkstyle Analysis') { + steps { + sh 'mvn -s pom.xml checkstyle:checkstyle' } } From e3af250bff067cff998f82a7a0478b13b4df96b9 Mon Sep 17 00:00:00 2001 From: Dasmanth Date: Thu, 29 Feb 2024 17:44:43 +0530 Subject: [PATCH 09/58] inid --- Jenkinsfile | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/Jenkinsfile b/Jenkinsfile index e03776736..ae268e2d2 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -31,17 +31,18 @@ pipeline { archiveArtifacts artifacts: '**/*.war' } } - + stages { stage('Test') { steps { sh 'mvn -s pom.xml test' + } } } - + stages { stage('Checkstyle Analysis') { steps { sh 'mvn -s pom.xml checkstyle:checkstyle' + } } } - } From fe9c8b28d29ebc72745ffd95be772b0b750b39e0 Mon Sep 17 00:00:00 2001 From: Dasmanth Date: Thu, 29 Feb 2024 17:46:33 +0530 Subject: [PATCH 10/58] l --- Jenkinsfile | 15 +-------------- 1 file changed, 1 insertion(+), 14 deletions(-) diff --git a/Jenkinsfile b/Jenkinsfile index ae268e2d2..7ce5c61ed 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -31,18 +31,5 @@ pipeline { archiveArtifacts artifacts: '**/*.war' } } - stages { - stage('Test') { - steps { - sh 'mvn -s pom.xml test' - } - } - } - stages { - stage('Checkstyle Analysis') { - steps { - sh 'mvn -s pom.xml checkstyle:checkstyle' - } - } - } + } From 7362615d4fb82f22707f15beabcef39e75fa33d2 Mon Sep 17 00:00:00 2001 From: Dasmanth Date: Fri, 1 Mar 2024 14:01:03 +0530 Subject: [PATCH 11/58] new jenkins file --- Jenkinsfile | 48 ++++++++++++++++++++++++++++++++++++++++-------- 1 file changed, 40 insertions(+), 8 deletions(-) diff --git a/Jenkinsfile b/Jenkinsfile index 7ce5c61ed..373d1a618 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -15,21 +15,53 @@ pipeline { NEXUS_PORT = '8081' NEXUS_GRP_REPO = 'vpro-maven-group' NEXUS_LOGIN = 'nexuslogin' + SONARSERVER = 'sonarserver' + SONARSCANNER = 'sonarscanner' } stages { stage('Build'){ steps { - sh 'mvn -s pom.xml -DskipTests install' + sh 'mvn -s settings.xml -DskipTests install' + } + post { + success { + echo 'Archiving' + archiveArtifacts artifacts: '**/*.war' + } } } - } - post { - success { - echo 'Archiving' - archiveArtifacts artifacts: '**/*.war' + + stage('Test') { + steps { + sh 'mvn -s settings.xml test' + } + } + + stage('Checkstyle Analysis') { + steps { + sh 'mvn -s settings.xml checkstyle:checkstyle' + } + } + + stage ('Sonar Analysis') { + environment { + scannerHome = tool "${SONARSCANNER}" + } + steps { + withSonarQubeEnv("${SONARSERVER}") { + sh '''${scannerHome}/bin/sonar-scanner -Dsonar.projectKey=vprofile \ + -Dsonar.projectName=vprofile \ + -Dsonar.projectVersion=1.0 \ + -Dsonar.sources=src/ \ + -Dsonar.java.binaries=target/test-classes/com/visualpathit/account/controllerTest/ \ + -Dsonar.junit.reportsPath=target/surefire-reports/ \ + -Dsonar.jacoco.reportsPath=target/jacoco.exec \ + -Dsonar.java.checkstyle.reportPaths=target/checkstyle-result.xml''' } - } + } + } -} + } +} \ No newline at end of file From 454a1ead6dfa80c74efe49907fd721677a3f378e Mon Sep 17 00:00:00 2001 From: Dasmanth Date: Fri, 1 Mar 2024 14:04:20 +0530 Subject: [PATCH 12/58] new file From 5db5e934e442eef2328b389f519dd7d7df5c9ee7 Mon Sep 17 00:00:00 2001 From: Dasmanth Date: Fri, 1 Mar 2024 15:20:45 +0530 Subject: [PATCH 13/58] quality gate --- Jenkinsfile | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/Jenkinsfile b/Jenkinsfile index 373d1a618..59aacac46 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -63,5 +63,11 @@ pipeline { } } - } + } + stage ("Quality Gate") { + steps { + timeout(time:1, unit: 'HOURS') { + waitForQualityGate abortPipeline: true + } + } } \ No newline at end of file From 3d8da6fef1145e2b61840710fd7ba758bb9e27b5 Mon Sep 17 00:00:00 2001 From: Dasmanth Date: Fri, 1 Mar 2024 15:24:56 +0530 Subject: [PATCH 14/58] Quality gate --- Jenkinsfile | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/Jenkinsfile b/Jenkinsfile index 59aacac46..fc19cbb76 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -70,4 +70,6 @@ pipeline { waitForQualityGate abortPipeline: true } } -} \ No newline at end of file + + } +} \ No newline at end of file From f16a0bb0ed7b2e9e6ef779dec28364d4af645f58 Mon Sep 17 00:00:00 2001 From: Dasmanth Date: Fri, 1 Mar 2024 15:27:27 +0530 Subject: [PATCH 15/58] Quality gate new --- Jenkinsfile | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Jenkinsfile b/Jenkinsfile index fc19cbb76..072bbd44b 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -64,12 +64,12 @@ pipeline { } } - stage ("Quality Gate") { + stage ('Quality Gate') { steps { timeout(time:1, unit: 'HOURS') { waitForQualityGate abortPipeline: true } } - } + } } \ No newline at end of file From fde2c1819909afc8f8435ba448117500fb33bd14 Mon Sep 17 00:00:00 2001 From: Dasmanth Date: Fri, 1 Mar 2024 15:34:11 +0530 Subject: [PATCH 16/58] complete file --- Jenkinsfile | 44 ++++++++++++++++++++++++++++++++++++++------ 1 file changed, 38 insertions(+), 6 deletions(-) diff --git a/Jenkinsfile b/Jenkinsfile index 072bbd44b..adf14ae5d 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -1,3 +1,8 @@ +def COLOR_MAP = [ + 'SUCCESS': 'good', + 'FAILURE': 'danger', +] + pipeline { agent any tools { @@ -62,14 +67,41 @@ pipeline { } } } - - } - stage ('Quality Gate') { + + stage ("Quality Gate") { steps { timeout(time:1, unit: 'HOURS') { waitForQualityGate abortPipeline: true + } + } + } + + stage ("Upload Artifact") { + steps { + nexusArtifactUploader( + nexusVersion: 'nexus3', + protocol: 'http', + nexusUrl: "${NEXUS_IP}:${NEXUS_PORT}", + groupId: 'QA', + version: "${env.BUILD_ID}-${env.BUILD_TIMESTAMP}", + repository: "${RELEASE_REPO}", + credentialsId: "${NEXUS_LOGIN}", + artifacts: [ + [artifactId: 'vproapp', + classifier: '', + file: 'target/vprofile-v2.war', + type: 'war'] + ] + ) } - } - + } + } + post { + always{ + echo 'Slack Notifications' + slackSend channel: '#cicd', + color: COLOR_MAP[currentBuild.currentResult], + message: "*${currentBuild.currentResult}:* Job ${env.JOB_NAME} build ${env.BUILD_NUMBER} \n More info at: ${env.BUILD_URL}" + } } -} \ No newline at end of file +} \ No newline at end of file From a87b17034fd94d9711c834c88c960b1860f014ec Mon Sep 17 00:00:00 2001 From: Dasmanth Date: Sun, 3 Mar 2024 23:19:48 +0530 Subject: [PATCH 17/58] nexus --- Jenkinsfile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Jenkinsfile b/Jenkinsfile index adf14ae5d..fa058ad4d 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -81,7 +81,7 @@ pipeline { nexusArtifactUploader( nexusVersion: 'nexus3', protocol: 'http', - nexusUrl: "${NEXUS_IP}:${NEXUS_PORT}", + nexusUrl: "${18.191.141.2}:${8081}", groupId: 'QA', version: "${env.BUILD_ID}-${env.BUILD_TIMESTAMP}", repository: "${RELEASE_REPO}", From 0e9b6f17b939d45284bd6e0e23f147398d92e4e0 Mon Sep 17 00:00:00 2001 From: Dasmanth Date: Sun, 3 Mar 2024 23:26:13 +0530 Subject: [PATCH 18/58] ip --- Jenkinsfile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Jenkinsfile b/Jenkinsfile index fa058ad4d..82190388a 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -81,7 +81,7 @@ pipeline { nexusArtifactUploader( nexusVersion: 'nexus3', protocol: 'http', - nexusUrl: "${18.191.141.2}:${8081}", + nexusUrl: "${'18.191.141.2'}:${'8081'}", groupId: 'QA', version: "${env.BUILD_ID}-${env.BUILD_TIMESTAMP}", repository: "${RELEASE_REPO}", From ce20cf9f47d6df4a8764a0ba9d497cd20ac05233 Mon Sep 17 00:00:00 2001 From: Dasmanth Date: Sun, 3 Mar 2024 23:33:32 +0530 Subject: [PATCH 19/58] MIN QG --- Jenkinsfile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Jenkinsfile b/Jenkinsfile index 82190388a..05a50b690 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -70,7 +70,7 @@ pipeline { stage ("Quality Gate") { steps { - timeout(time:1, unit: 'HOURS') { + timeout(time:1, unit: 'MINUTES') { waitForQualityGate abortPipeline: true } } From 4ad4c1d6d110e4cbcb656dd1c941c05aec2c5de3 Mon Sep 17 00:00:00 2001 From: Dasmanth Date: Sun, 3 Mar 2024 23:36:25 +0530 Subject: [PATCH 20/58] hours --- Jenkinsfile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Jenkinsfile b/Jenkinsfile index 05a50b690..82190388a 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -70,7 +70,7 @@ pipeline { stage ("Quality Gate") { steps { - timeout(time:1, unit: 'MINUTES') { + timeout(time:1, unit: 'HOURS') { waitForQualityGate abortPipeline: true } } From 417f9f7d875c8d96a266d6d73e211bff85cce867 Mon Sep 17 00:00:00 2001 From: Dasmanth Date: Sun, 3 Mar 2024 23:46:37 +0530 Subject: [PATCH 21/58] new --- Jenkinsfile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Jenkinsfile b/Jenkinsfile index 82190388a..05a50b690 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -70,7 +70,7 @@ pipeline { stage ("Quality Gate") { steps { - timeout(time:1, unit: 'HOURS') { + timeout(time:1, unit: 'MINUTES') { waitForQualityGate abortPipeline: true } } From ddf75e4116f974151dd1f62d3a5d71148aa3e81e Mon Sep 17 00:00:00 2001 From: Dasmanth Date: Sun, 3 Mar 2024 23:50:23 +0530 Subject: [PATCH 22/58] new --- Jenkinsfile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Jenkinsfile b/Jenkinsfile index 05a50b690..82190388a 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -70,7 +70,7 @@ pipeline { stage ("Quality Gate") { steps { - timeout(time:1, unit: 'MINUTES') { + timeout(time:1, unit: 'HOURS') { waitForQualityGate abortPipeline: true } } From cb3020b142691ae7d70c2067a18cb27868e49f1b Mon Sep 17 00:00:00 2001 From: Dasmanth Date: Mon, 4 Mar 2024 00:01:48 +0530 Subject: [PATCH 23/58] false --- Jenkinsfile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Jenkinsfile b/Jenkinsfile index 82190388a..d26141601 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -71,7 +71,7 @@ pipeline { stage ("Quality Gate") { steps { timeout(time:1, unit: 'HOURS') { - waitForQualityGate abortPipeline: true + waitForQualityGate abortPipeline: false } } } From e4e277f72f3fdaf9bdf60546de22ce5314dbd5ab Mon Sep 17 00:00:00 2001 From: Dasmanth Date: Mon, 4 Mar 2024 00:09:45 +0530 Subject: [PATCH 24/58] nex --- Jenkinsfile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Jenkinsfile b/Jenkinsfile index d26141601..0cd4509d6 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -81,7 +81,7 @@ pipeline { nexusArtifactUploader( nexusVersion: 'nexus3', protocol: 'http', - nexusUrl: "${'18.191.141.2'}:${'8081'}", + nexusUrl: "${18.191.141.2}:${8081}", groupId: 'QA', version: "${env.BUILD_ID}-${env.BUILD_TIMESTAMP}", repository: "${RELEASE_REPO}", From 7c10d9ed102d55543c6d11546e43687a8d6401f8 Mon Sep 17 00:00:00 2001 From: Dasmanth Date: Mon, 4 Mar 2024 00:10:49 +0530 Subject: [PATCH 25/58] ip --- Jenkinsfile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Jenkinsfile b/Jenkinsfile index 0cd4509d6..d26141601 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -81,7 +81,7 @@ pipeline { nexusArtifactUploader( nexusVersion: 'nexus3', protocol: 'http', - nexusUrl: "${18.191.141.2}:${8081}", + nexusUrl: "${'18.191.141.2'}:${'8081'}", groupId: 'QA', version: "${env.BUILD_ID}-${env.BUILD_TIMESTAMP}", repository: "${RELEASE_REPO}", From e46a4faa4747f7026d930ded6a827d8c63f77bf8 Mon Sep 17 00:00:00 2001 From: Dasmanth Date: Mon, 4 Mar 2024 00:14:38 +0530 Subject: [PATCH 26/58] private --- Jenkinsfile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Jenkinsfile b/Jenkinsfile index d26141601..8cb7fb403 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -81,7 +81,7 @@ pipeline { nexusArtifactUploader( nexusVersion: 'nexus3', protocol: 'http', - nexusUrl: "${'18.191.141.2'}:${'8081'}", + nexusUrl: "${'172.31.25.15'}:${'8081'}", groupId: 'QA', version: "${env.BUILD_ID}-${env.BUILD_TIMESTAMP}", repository: "${RELEASE_REPO}", From 35c4253085c7b58c7fcc6c95914c68260bf4257a Mon Sep 17 00:00:00 2001 From: Dasmanth Date: Mon, 4 Mar 2024 00:44:09 +0530 Subject: [PATCH 27/58] new --- Jenkinsfile | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/Jenkinsfile b/Jenkinsfile index 8cb7fb403..8012af891 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -71,7 +71,7 @@ pipeline { stage ("Quality Gate") { steps { timeout(time:1, unit: 'HOURS') { - waitForQualityGate abortPipeline: false + waitForQualityGate abortPipeline: true } } } @@ -81,7 +81,7 @@ pipeline { nexusArtifactUploader( nexusVersion: 'nexus3', protocol: 'http', - nexusUrl: "${'172.31.25.15'}:${'8081'}", + nexusUrl: "${'18.191.141.2'}:${'8081'}", groupId: 'QA', version: "${env.BUILD_ID}-${env.BUILD_TIMESTAMP}", repository: "${RELEASE_REPO}", @@ -101,7 +101,7 @@ pipeline { echo 'Slack Notifications' slackSend channel: '#cicd', color: COLOR_MAP[currentBuild.currentResult], - message: "*${currentBuild.currentResult}:* Job ${env.JOB_NAME} build ${env.BUILD_NUMBER} \n More info at: ${env.BUILD_URL}" + message: "*${currentBuild.currentResult}:* Job ${vprofile-ci-pipeline} build ${env.BUILD_NUMBER} \n More info at: ${env.BUILD_URL}" } } -} \ No newline at end of file +} \ No newline at end of file From 432f5a56dc54ab4676b9776f3ccee5481ea4157d Mon Sep 17 00:00:00 2001 From: Dasmanth Date: Mon, 4 Mar 2024 00:45:40 +0530 Subject: [PATCH 28/58] falkse --- Jenkinsfile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Jenkinsfile b/Jenkinsfile index 8012af891..859740093 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -71,7 +71,7 @@ pipeline { stage ("Quality Gate") { steps { timeout(time:1, unit: 'HOURS') { - waitForQualityGate abortPipeline: true + waitForQualityGate abortPipeline: false } } } From 06262c200175fcbcbf5699cda9d30624f0959d78 Mon Sep 17 00:00:00 2001 From: Dasmanth Date: Mon, 4 Mar 2024 01:04:11 +0530 Subject: [PATCH 29/58] new --- Jenkinsfile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Jenkinsfile b/Jenkinsfile index 859740093..4234db9e0 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -101,7 +101,7 @@ pipeline { echo 'Slack Notifications' slackSend channel: '#cicd', color: COLOR_MAP[currentBuild.currentResult], - message: "*${currentBuild.currentResult}:* Job ${vprofile-ci-pipeline} build ${env.BUILD_NUMBER} \n More info at: ${env.BUILD_URL}" + message: "*${currentBuild.currentResult}:* Job ${env.JOB_NAME} build ${env.BUILD_NUMBER} \n More info at: ${env.BUILD_URL}" } } } \ No newline at end of file From b87b37cf4780e7d078f2f280ecca034d28f0abc4 Mon Sep 17 00:00:00 2001 From: Dasmanth Date: Mon, 4 Mar 2024 09:46:26 +0530 Subject: [PATCH 30/58] new --- Jenkinsfile | 30 +----------------------------- 1 file changed, 1 insertion(+), 29 deletions(-) diff --git a/Jenkinsfile b/Jenkinsfile index 4234db9e0..08320068d 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -71,37 +71,9 @@ pipeline { stage ("Quality Gate") { steps { timeout(time:1, unit: 'HOURS') { - waitForQualityGate abortPipeline: false + waitForQualityGate abortPipeline: true } } } - - stage ("Upload Artifact") { - steps { - nexusArtifactUploader( - nexusVersion: 'nexus3', - protocol: 'http', - nexusUrl: "${'18.191.141.2'}:${'8081'}", - groupId: 'QA', - version: "${env.BUILD_ID}-${env.BUILD_TIMESTAMP}", - repository: "${RELEASE_REPO}", - credentialsId: "${NEXUS_LOGIN}", - artifacts: [ - [artifactId: 'vproapp', - classifier: '', - file: 'target/vprofile-v2.war', - type: 'war'] - ] - ) - } - } - } - post { - always{ - echo 'Slack Notifications' - slackSend channel: '#cicd', - color: COLOR_MAP[currentBuild.currentResult], - message: "*${currentBuild.currentResult}:* Job ${env.JOB_NAME} build ${env.BUILD_NUMBER} \n More info at: ${env.BUILD_URL}" - } } } \ No newline at end of file From 95f88769f25eb276df1e3be4bceb4b6643c9b8e3 Mon Sep 17 00:00:00 2001 From: Dasmanth Date: Mon, 4 Mar 2024 10:06:50 +0530 Subject: [PATCH 31/58] 0 --- Jenkinsfile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Jenkinsfile b/Jenkinsfile index 08320068d..fdb16f468 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -70,7 +70,7 @@ pipeline { stage ("Quality Gate") { steps { - timeout(time:1, unit: 'HOURS') { + timeout(time:0, unit: 'HOURS') { waitForQualityGate abortPipeline: true } } From 6cf90374f6f02d16df17a722dfd719b88072ddae Mon Sep 17 00:00:00 2001 From: Dasmanth Date: Mon, 4 Mar 2024 10:13:58 +0530 Subject: [PATCH 32/58] min --- Jenkinsfile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Jenkinsfile b/Jenkinsfile index fdb16f468..08320068d 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -70,7 +70,7 @@ pipeline { stage ("Quality Gate") { steps { - timeout(time:0, unit: 'HOURS') { + timeout(time:1, unit: 'HOURS') { waitForQualityGate abortPipeline: true } } From 85f9bcb1487f14fc6f608c209ad36718529b31d3 Mon Sep 17 00:00:00 2001 From: Dasmanth Date: Mon, 4 Mar 2024 10:36:31 +0530 Subject: [PATCH 33/58] m --- Jenkinsfile | 28 ++++++++++++++++++++++++++++ 1 file changed, 28 insertions(+) diff --git a/Jenkinsfile b/Jenkinsfile index 08320068d..620b91916 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -75,5 +75,33 @@ pipeline { } } } + + stage ("Upload Artifact") { + steps { + nexusArtifactUploader( + nexusVersion: 'nexus3', + protocol: 'http', + nexusUrl: "${NEXUS_IP}:${NEXUS_PORT}", + groupId: 'QA', + version: "${env.BUILD_ID}-${env.BUILD_TIMESTAMP}", + repository: "${RELEASE_REPO}", + credentialsId: "${NEXUS_LOGIN}", + artifacts: [ + [artifactId: 'vproapp', + classifier: '', + file: 'target/vprofile-v2.war', + type: 'war'] + ] + ) + } + } + } + post { + always{ + echo 'Slack Notifications' + slackSend channel: '#cicd', + color: COLOR_MAP[currentBuild.currentResult], + message: "*${currentBuild.currentResult}:* Job ${env.JOB_NAME} build ${env.BUILD_NUMBER} \n More info at: ${env.BUILD_URL}" + } } } \ No newline at end of file From 5a083c67fd4777e4d2e5cb6e5fe29cb6fe004284 Mon Sep 17 00:00:00 2001 From: Dasmanth Date: Mon, 4 Mar 2024 11:58:27 +0530 Subject: [PATCH 34/58] nexus --- Jenkinsfile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Jenkinsfile b/Jenkinsfile index 620b91916..c2bf8f292 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -81,7 +81,7 @@ pipeline { nexusArtifactUploader( nexusVersion: 'nexus3', protocol: 'http', - nexusUrl: "${NEXUS_IP}:${NEXUS_PORT}", + nexusUrl: "${3.144.223.54}:${8081}", groupId: 'QA', version: "${env.BUILD_ID}-${env.BUILD_TIMESTAMP}", repository: "${RELEASE_REPO}", From 78aea42a24ecd07692457f114402361df5a817d3 Mon Sep 17 00:00:00 2001 From: Dasmanth Date: Mon, 4 Mar 2024 12:01:25 +0530 Subject: [PATCH 35/58] nex --- Jenkinsfile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Jenkinsfile b/Jenkinsfile index c2bf8f292..4000a5f13 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -81,7 +81,7 @@ pipeline { nexusArtifactUploader( nexusVersion: 'nexus3', protocol: 'http', - nexusUrl: "${3.144.223.54}:${8081}", + nexusUrl: "${'3.144.223.54'}:${'8081'}", groupId: 'QA', version: "${env.BUILD_ID}-${env.BUILD_TIMESTAMP}", repository: "${RELEASE_REPO}", From e83f57ad9705695318da62839d922cf65d9bcfca Mon Sep 17 00:00:00 2001 From: Dasmanth Date: Sat, 16 Mar 2024 16:07:40 +0530 Subject: [PATCH 36/58] new From bfe3fcf864c8d8257767df7ba4368bce2b684b08 Mon Sep 17 00:00:00 2001 From: Dasmanth Date: Sat, 16 Mar 2024 16:09:44 +0530 Subject: [PATCH 37/58] new --- Jenkinsfile | 85 ++--------------------------------------------------- 1 file changed, 3 insertions(+), 82 deletions(-) diff --git a/Jenkinsfile b/Jenkinsfile index 4000a5f13..0a2d698fd 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -1,8 +1,3 @@ -def COLOR_MAP = [ - 'SUCCESS': 'good', - 'FAILURE': 'danger', -] - pipeline { agent any tools { @@ -13,15 +8,13 @@ pipeline { environment { SNAP_REPO = 'vprofile-snapshot' NEXUS_USER = 'admin' - NEXUS_PASS = 'Dasmanth1@' + NEXUS_PASS = 'admin123' RELEASE_REPO = 'vprofile-release' CENTRAL_REPO = 'vpro-maven-central' - NEXUS_IP = '172.31.25.15' + NEXUS_IP = 'server_priv_ip' #nexus server private ip NEXUS_PORT = '8081' NEXUS_GRP_REPO = 'vpro-maven-group' NEXUS_LOGIN = 'nexuslogin' - SONARSERVER = 'sonarserver' - SONARSCANNER = 'sonarscanner' } stages { @@ -29,79 +22,7 @@ pipeline { steps { sh 'mvn -s settings.xml -DskipTests install' } - post { - success { - echo 'Archiving' - archiveArtifacts artifacts: '**/*.war' - } - } } - - stage('Test') { - steps { - sh 'mvn -s settings.xml test' - } - } - - stage('Checkstyle Analysis') { - steps { - sh 'mvn -s settings.xml checkstyle:checkstyle' - } - } - - stage ('Sonar Analysis') { - environment { - scannerHome = tool "${SONARSCANNER}" - } - steps { - withSonarQubeEnv("${SONARSERVER}") { - sh '''${scannerHome}/bin/sonar-scanner -Dsonar.projectKey=vprofile \ - -Dsonar.projectName=vprofile \ - -Dsonar.projectVersion=1.0 \ - -Dsonar.sources=src/ \ - -Dsonar.java.binaries=target/test-classes/com/visualpathit/account/controllerTest/ \ - -Dsonar.junit.reportsPath=target/surefire-reports/ \ - -Dsonar.jacoco.reportsPath=target/jacoco.exec \ - -Dsonar.java.checkstyle.reportPaths=target/checkstyle-result.xml''' - } - } - } - - stage ("Quality Gate") { - steps { - timeout(time:1, unit: 'HOURS') { - waitForQualityGate abortPipeline: true - } - } - } - - stage ("Upload Artifact") { - steps { - nexusArtifactUploader( - nexusVersion: 'nexus3', - protocol: 'http', - nexusUrl: "${'3.144.223.54'}:${'8081'}", - groupId: 'QA', - version: "${env.BUILD_ID}-${env.BUILD_TIMESTAMP}", - repository: "${RELEASE_REPO}", - credentialsId: "${NEXUS_LOGIN}", - artifacts: [ - [artifactId: 'vproapp', - classifier: '', - file: 'target/vprofile-v2.war', - type: 'war'] - ] - ) - } - } - } - post { - always{ - echo 'Slack Notifications' - slackSend channel: '#cicd', - color: COLOR_MAP[currentBuild.currentResult], - message: "*${currentBuild.currentResult}:* Job ${env.JOB_NAME} build ${env.BUILD_NUMBER} \n More info at: ${env.BUILD_URL}" - } - } + } } \ No newline at end of file From dd7830abce0f008c5189d2bd88f0f29417092482 Mon Sep 17 00:00:00 2001 From: Dasmanth Date: Sun, 17 Mar 2024 16:15:33 +0530 Subject: [PATCH 38/58] nexus ip --- Jenkinsfile | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Jenkinsfile b/Jenkinsfile index 0a2d698fd..87c896499 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -8,10 +8,10 @@ pipeline { environment { SNAP_REPO = 'vprofile-snapshot' NEXUS_USER = 'admin' - NEXUS_PASS = 'admin123' + NEXUS_PASS = 'Dasmanth1@' RELEASE_REPO = 'vprofile-release' CENTRAL_REPO = 'vpro-maven-central' - NEXUS_IP = 'server_priv_ip' #nexus server private ip + NEXUS_IP = '172.31.6.129' NEXUS_PORT = '8081' NEXUS_GRP_REPO = 'vpro-maven-group' NEXUS_LOGIN = 'nexuslogin' From d4ee72a0eddf3c23e664866bcfaa5684021abafa Mon Sep 17 00:00:00 2001 From: Dasmanth Date: Sun, 17 Mar 2024 16:29:00 +0530 Subject: [PATCH 39/58] webhook --- Jenkinsfile | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/Jenkinsfile b/Jenkinsfile index 87c896499..6b8d86e3e 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -22,6 +22,12 @@ pipeline { steps { sh 'mvn -s settings.xml -DskipTests install' } + post { + success { + echo 'Archiving' + archiveArtifacts artifacts: '**/*.war' + } + } } } From d213da842fb6752a02d90b2e35a5689efe1ed654 Mon Sep 17 00:00:00 2001 From: Dasmanth Date: Sun, 17 Mar 2024 16:48:11 +0530 Subject: [PATCH 40/58] sonar --- Jenkinsfile | 33 +++++++++++++++++++++++++++++++++ 1 file changed, 33 insertions(+) diff --git a/Jenkinsfile b/Jenkinsfile index 6b8d86e3e..181311408 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -15,6 +15,8 @@ pipeline { NEXUS_PORT = '8081' NEXUS_GRP_REPO = 'vpro-maven-group' NEXUS_LOGIN = 'nexuslogin' + SONARSERVER = 'sonarserver' + SONARSCANNER = 'sonarscanner' } stages { @@ -30,5 +32,36 @@ pipeline { } } + + stage('Test') { + steps { + sh 'mvn -s settings.xml test' + } + } + + stage('Checkstyle Analysis') { + steps { + sh 'mvn -s settings.xml checkstyle:checkstyle' + } + } + + stage ('Sonar Analysis') { + environment { + scannerHome = tool "${SONARSCANNER}" + } + steps { + withSonarQubeEnv("${SONARSERVER}") { + sh '''${scannerHome}/bin/sonar-scanner -Dsonar.projectKey=vprofile \ + -Dsonar.projectName=vprofile \ + -Dsonar.projectVersion=1.0 \ + -Dsonar.sources=src/ \ + -Dsonar.java.binaries=target/test-classes/com/visualpathit/account/controllerTest/ \ + -Dsonar.junit.reportsPath=target/surefire-reports/ \ + -Dsonar.jacoco.reportsPath=target/jacoco.exec \ + -Dsonar.java.checkstyle.reportPaths=target/checkstyle-result.xml''' + } + } + } + } } \ No newline at end of file From 8e470ff7c40c6d8ff77b36937ad12bf3a4c596b4 Mon Sep 17 00:00:00 2001 From: Dasmanth Date: Sun, 17 Mar 2024 17:06:00 +0530 Subject: [PATCH 41/58] full code --- Jenkinsfile | 46 +++++++++++++++++++++++++++++++++++++++++++--- 1 file changed, 43 insertions(+), 3 deletions(-) diff --git a/Jenkinsfile b/Jenkinsfile index 181311408..4873bc890 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -1,3 +1,8 @@ +def COLOR_MAP = [ + 'SUCCESS': 'good', + 'FAILURE': 'danger', +] + pipeline { agent any tools { @@ -62,6 +67,41 @@ pipeline { } } } - - } -} \ No newline at end of file + + stage ("Quality Gate") { + steps { + timeout(time:1, unit: 'HOURS') { + waitForQualityGate abortPipeline: true + } + } + } + + stage ("Upload Artifact") { + steps { + nexusArtifactUploader( + nexusVersion: 'nexus3', + protocol: 'http', + nexusUrl: "${NEXUS_IP}:${NEXUS_PORT}", + groupId: 'QA', + version: "${env.BUILD_ID}-${env.BUILD_TIMESTAMP}", + repository: "${RELEASE_REPO}", + credentialsId: "${NEXUS_LOGIN}", + artifacts: [ + [artifactId: 'vproapp', + classifier: '', + file: 'target/vprofile-v2.war', + type: 'war'] + ] + ) + } + } + } + post { + always{ + echo 'Slack Notifications' + slackSend channel: '#cicd', + color: COLOR_MAP[currentBuild.currentResult], + message: "*${currentBuild.currentResult}:* Job ${env.JOB_NAME} build ${env.BUILD_NUMBER} \n More info at: ${env.BUILD_URL}" + } + } +} From 69cd25e2d0faac7972a2e5f728e72f6f36ea6d37 Mon Sep 17 00:00:00 2001 From: Dasmanth Date: Sun, 17 Mar 2024 17:17:33 +0530 Subject: [PATCH 42/58] sonar --- Jenkinsfile | 44 ++------------------------------------------ 1 file changed, 2 insertions(+), 42 deletions(-) diff --git a/Jenkinsfile b/Jenkinsfile index 4873bc890..e945fa674 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -1,8 +1,3 @@ -def COLOR_MAP = [ - 'SUCCESS': 'good', - 'FAILURE': 'danger', -] - pipeline { agent any tools { @@ -67,41 +62,6 @@ pipeline { } } } - - stage ("Quality Gate") { - steps { - timeout(time:1, unit: 'HOURS') { - waitForQualityGate abortPipeline: true - } - } - } - - stage ("Upload Artifact") { - steps { - nexusArtifactUploader( - nexusVersion: 'nexus3', - protocol: 'http', - nexusUrl: "${NEXUS_IP}:${NEXUS_PORT}", - groupId: 'QA', - version: "${env.BUILD_ID}-${env.BUILD_TIMESTAMP}", - repository: "${RELEASE_REPO}", - credentialsId: "${NEXUS_LOGIN}", - artifacts: [ - [artifactId: 'vproapp', - classifier: '', - file: 'target/vprofile-v2.war', - type: 'war'] - ] - ) - } - } - } - post { - always{ - echo 'Slack Notifications' - slackSend channel: '#cicd', - color: COLOR_MAP[currentBuild.currentResult], - message: "*${currentBuild.currentResult}:* Job ${env.JOB_NAME} build ${env.BUILD_NUMBER} \n More info at: ${env.BUILD_URL}" - } - } + + } } From bc25b07e2a8b6fde727927e720f9e6a67fd094a7 Mon Sep 17 00:00:00 2001 From: Dasmanth Date: Mon, 18 Mar 2024 21:11:01 +0530 Subject: [PATCH 43/58] Qualitygate --- Jenkinsfile | 18 ++++++++++++++---- 1 file changed, 14 insertions(+), 4 deletions(-) diff --git a/Jenkinsfile b/Jenkinsfile index e945fa674..7ba9490c2 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -1,3 +1,8 @@ +def COLOR_MAP = [ + 'SUCCESS': 'good', + 'FAILURE': 'danger', +] + pipeline { agent any tools { @@ -8,7 +13,7 @@ pipeline { environment { SNAP_REPO = 'vprofile-snapshot' NEXUS_USER = 'admin' - NEXUS_PASS = 'Dasmanth1@' + NEXUS_PASS = 'admin123' RELEASE_REPO = 'vprofile-release' CENTRAL_REPO = 'vpro-maven-central' NEXUS_IP = '172.31.6.129' @@ -62,6 +67,11 @@ pipeline { } } } - - } -} + + stage ("Quality Gate") { + steps { + timeout(time:1, unit: 'HOURS') { + waitForQualityGate abortPipeline: true + } + } + } From 8799c396f84ddad6aa17cfcf160b648a72fb0389 Mon Sep 17 00:00:00 2001 From: Dasmanth Date: Mon, 18 Mar 2024 21:12:15 +0530 Subject: [PATCH 44/58] Qualitygate1 --- Jenkinsfile | 2 ++ 1 file changed, 2 insertions(+) diff --git a/Jenkinsfile b/Jenkinsfile index 7ba9490c2..75ae5dcf4 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -75,3 +75,5 @@ pipeline { } } } + } +} \ No newline at end of file From 5e3170666ae5095b32043e746376f6452bf729ec Mon Sep 17 00:00:00 2001 From: Dasmanth Date: Mon, 18 Mar 2024 21:55:11 +0530 Subject: [PATCH 45/58] full code --- Jenkinsfile | 28 ++++++++++++++++++++++++++++ 1 file changed, 28 insertions(+) diff --git a/Jenkinsfile b/Jenkinsfile index 75ae5dcf4..2299907b4 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -75,5 +75,33 @@ pipeline { } } } + + stage ("Upload Artifact") { + steps { + nexusArtifactUploader( + nexusVersion: 'nexus3', + protocol: 'http', + nexusUrl: "${NEXUS_IP}:${NEXUS_PORT}", + groupId: 'QA', + version: "${env.BUILD_ID}-${env.BUILD_TIMESTAMP}", + repository: "${RELEASE_REPO}", + credentialsId: "${NEXUS_LOGIN}", + artifacts: [ + [artifactId: 'vproapp', + classifier: '', + file: 'target/vprofile-v2.war', + type: 'war'] + ] + ) + } + } + } + post { + always{ + echo 'Slack Notifications' + slackSend channel: '#cicd', + color: COLOR_MAP[currentBuild.currentResult], + message: "*${currentBuild.currentResult}:* Job ${env.JOB_NAME} build ${env.BUILD_NUMBER} \n More info at: ${env.BUILD_URL}" + } } } \ No newline at end of file From ad269c8cddb91f31b6f4a5454cc3dec0d6b15095 Mon Sep 17 00:00:00 2001 From: Dasmanth Date: Mon, 18 Mar 2024 22:15:10 +0530 Subject: [PATCH 46/58] artifact --- Jenkinsfile | 9 +-------- 1 file changed, 1 insertion(+), 8 deletions(-) diff --git a/Jenkinsfile b/Jenkinsfile index 2299907b4..b7c59d6e4 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -96,12 +96,5 @@ pipeline { } } } - post { - always{ - echo 'Slack Notifications' - slackSend channel: '#cicd', - color: COLOR_MAP[currentBuild.currentResult], - message: "*${currentBuild.currentResult}:* Job ${env.JOB_NAME} build ${env.BUILD_NUMBER} \n More info at: ${env.BUILD_URL}" - } - } + } \ No newline at end of file From 3101f39fb1e8b729002471df88116f55550d52de Mon Sep 17 00:00:00 2001 From: Dasmanth Date: Mon, 18 Mar 2024 23:24:10 +0530 Subject: [PATCH 47/58] new From 85225c2a4cc5b311b12bdf3aa501f1f56e69891a Mon Sep 17 00:00:00 2001 From: Dasmanth Date: Mon, 18 Mar 2024 23:40:15 +0530 Subject: [PATCH 48/58] ip --- Jenkinsfile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Jenkinsfile b/Jenkinsfile index b7c59d6e4..a795a09b2 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -16,7 +16,7 @@ pipeline { NEXUS_PASS = 'admin123' RELEASE_REPO = 'vprofile-release' CENTRAL_REPO = 'vpro-maven-central' - NEXUS_IP = '172.31.6.129' + NEXUS_IP = '3.128.181.140' NEXUS_PORT = '8081' NEXUS_GRP_REPO = 'vpro-maven-group' NEXUS_LOGIN = 'nexuslogin' From 6aa01bb877a1818a7a2b26232f190021e0896fc8 Mon Sep 17 00:00:00 2001 From: Dasmanth Date: Mon, 18 Mar 2024 23:44:10 +0530 Subject: [PATCH 49/58] m --- Jenkinsfile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Jenkinsfile b/Jenkinsfile index a795a09b2..33c1a79c6 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -16,7 +16,7 @@ pipeline { NEXUS_PASS = 'admin123' RELEASE_REPO = 'vprofile-release' CENTRAL_REPO = 'vpro-maven-central' - NEXUS_IP = '3.128.181.140' + NEXUS_IP = '172.31.16.20' NEXUS_PORT = '8081' NEXUS_GRP_REPO = 'vpro-maven-group' NEXUS_LOGIN = 'nexuslogin' From d6db336e58948cb0227d362bdb00b01701214345 Mon Sep 17 00:00:00 2001 From: Dasmanth Date: Tue, 19 Mar 2024 00:14:54 +0530 Subject: [PATCH 50/58] artifact --- Jenkinsfile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Jenkinsfile b/Jenkinsfile index 33c1a79c6..f31bd78ce 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -19,7 +19,7 @@ pipeline { NEXUS_IP = '172.31.16.20' NEXUS_PORT = '8081' NEXUS_GRP_REPO = 'vpro-maven-group' - NEXUS_LOGIN = 'nexuslogin' + NEXUS_LOGIN = 'Nexuslogin' SONARSERVER = 'sonarserver' SONARSCANNER = 'sonarscanner' } From 25ba6ef253f3e0222fffdabcbf6f2217f7eb4345 Mon Sep 17 00:00:00 2001 From: Dasmanth Date: Tue, 19 Mar 2024 00:20:50 +0530 Subject: [PATCH 51/58] slack --- Jenkinsfile | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/Jenkinsfile b/Jenkinsfile index f31bd78ce..0ebd8433a 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -96,5 +96,12 @@ pipeline { } } } - + post { + always{ + echo 'Slack Notifications' + slackSend channel: '#cicd', + color: COLOR_MAP[currentBuild.currentResult], + message: "*${currentBuild.currentResult}:* Job ${env.JOB_NAME} build ${env.BUILD_NUMBER} \n More info at: ${env.BUILD_URL}" + } + } } \ No newline at end of file From 263be1bde8f7149607c4d51427325ff918368ed2 Mon Sep 17 00:00:00 2001 From: Dasmanth Date: Tue, 19 Mar 2024 00:38:26 +0530 Subject: [PATCH 52/58] slack --- Jenkinsfile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Jenkinsfile b/Jenkinsfile index 0ebd8433a..730710c63 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -97,7 +97,7 @@ pipeline { } } post { - always{ + success{ echo 'Slack Notifications' slackSend channel: '#cicd', color: COLOR_MAP[currentBuild.currentResult], From 436d44004ec3ae1e1ac3cff3397e198e7b77419c Mon Sep 17 00:00:00 2001 From: Dasmanth Date: Tue, 19 Mar 2024 01:38:16 +0530 Subject: [PATCH 53/58] gg --- Jenkinsfile | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/Jenkinsfile b/Jenkinsfile index 730710c63..bdc863948 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -97,11 +97,13 @@ pipeline { } } post { - success{ + always{ echo 'Slack Notifications' - slackSend channel: '#cicd', + slackSend + (channel: '#cicd', color: COLOR_MAP[currentBuild.currentResult], message: "*${currentBuild.currentResult}:* Job ${env.JOB_NAME} build ${env.BUILD_NUMBER} \n More info at: ${env.BUILD_URL}" + ) } } } \ No newline at end of file From 4741918fc3822fe1958b30ddf26b8d044f4e7483 Mon Sep 17 00:00:00 2001 From: Dasmanth Date: Tue, 19 Mar 2024 01:39:20 +0530 Subject: [PATCH 54/58] jj --- Jenkinsfile | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/Jenkinsfile b/Jenkinsfile index bdc863948..0ebd8433a 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -99,11 +99,9 @@ pipeline { post { always{ echo 'Slack Notifications' - slackSend - (channel: '#cicd', + slackSend channel: '#cicd', color: COLOR_MAP[currentBuild.currentResult], message: "*${currentBuild.currentResult}:* Job ${env.JOB_NAME} build ${env.BUILD_NUMBER} \n More info at: ${env.BUILD_URL}" - ) } } } \ No newline at end of file From a113b655a5043465d0c1990c4d4d1f15892d2698 Mon Sep 17 00:00:00 2001 From: Dasmanth Date: Tue, 19 Mar 2024 01:55:58 +0530 Subject: [PATCH 55/58] ww --- Jenkinsfile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Jenkinsfile b/Jenkinsfile index 0ebd8433a..cef99fa88 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -99,7 +99,7 @@ pipeline { post { always{ echo 'Slack Notifications' - slackSend channel: '#cicd', + slackSend channel: '#jenkins', color: COLOR_MAP[currentBuild.currentResult], message: "*${currentBuild.currentResult}:* Job ${env.JOB_NAME} build ${env.BUILD_NUMBER} \n More info at: ${env.BUILD_URL}" } From 21b1be8b769a40fa6e2cb2b9287996d9609fd14c Mon Sep 17 00:00:00 2001 From: Dasmanth Date: Tue, 19 Mar 2024 02:01:40 +0530 Subject: [PATCH 56/58] d --- Jenkinsfile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Jenkinsfile b/Jenkinsfile index cef99fa88..ca3b63f61 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -97,7 +97,7 @@ pipeline { } } post { - always{ + success{ echo 'Slack Notifications' slackSend channel: '#jenkins', color: COLOR_MAP[currentBuild.currentResult], From bfbdd7f36b5f8f42dfcebf60c74e85fad85b8f88 Mon Sep 17 00:00:00 2001 From: Dasmanth Date: Tue, 19 Mar 2024 08:57:35 +0530 Subject: [PATCH 57/58] new --- Jenkinsfile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Jenkinsfile b/Jenkinsfile index ca3b63f61..7cbbe753e 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -99,7 +99,7 @@ pipeline { post { success{ echo 'Slack Notifications' - slackSend channel: '#jenkins', + slackSend channel: '#dasmanth', color: COLOR_MAP[currentBuild.currentResult], message: "*${currentBuild.currentResult}:* Job ${env.JOB_NAME} build ${env.BUILD_NUMBER} \n More info at: ${env.BUILD_URL}" } From e11860db9f46713e272641e1c7708dd9114d6f5c Mon Sep 17 00:00:00 2001 From: Dasmanth Date: Tue, 8 Oct 2024 11:40:28 +0530 Subject: [PATCH 58/58] new file --- Jenkinsfile | 572 +++++++++++++++++++++++++++++++++++++++++++++- gitcommands.txt | 73 ++++++ linuxcommands.txt | 79 +++++++ test.py | 4 + 4 files changed, 727 insertions(+), 1 deletion(-) create mode 100644 gitcommands.txt create mode 100644 linuxcommands.txt create mode 100644 test.py diff --git a/Jenkinsfile b/Jenkinsfile index 7cbbe753e..26708ec4c 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -104,4 +104,574 @@ pipeline { message: "*${currentBuild.currentResult}:* Job ${env.JOB_NAME} build ${env.BUILD_NUMBER} \n More info at: ${env.BUILD_URL}" } } -} \ No newline at end of file +} + + + + + + + + + + + + + + + + + + + + + + + + pipeline { + agentany { + environment { + + } + parameters { + + } + tools { + maven3 "mvn3" + jdk11 "jdk11" + } + } + stages { + stage ('git checkout') { + steps { + sh "gitpull " + } + } + stage ('code validate') { + steps { + sh "mvn validate" + } + } + } + } + + + + FROM nginx:latest + COPY /etc/app + RUN apt get update + RUN apt get install -y + EXPOSE 80:80 + + + + + + + apiVersion: v1 + kind: Deployment + metadata: + name: dev + labels: + dev: '01' + company: talent + spec: + conta + + + + apiVersion: apps/v1 +kind: Deployment +metadata: + name: nginx-deployment + labels: + app: nginx +spec: + replicas: 3 + selector: + matchLabels: + app: nginx + template: + metadata: + labels: + app: nginx + spec: + containers: + - name: nginx + image: nginx:1.14.2 + ports: + - containerPort: 80 + + + + + + + + + + + + + + +pipeline { + agent any + tools { + jdk "jdk11" + maven "mvn3" + } + environment { + SONARSERVER = 'admim' + NEXUS_ID = 'admin' + + + } + parameters { + + } + stages { + stage ('code pull') { + sh 'gitclone' + } + stage ('code validate') { + sh 'mvn validate' + } + stage ('code compile') { + sh 'mvn compile' + } + stage ('code test') { + sh 'mvn test' + } + stage ('build') { + sh 'mvn clean package' + } + } +} + + + + + + + + + + + + +FROM nginx:latest +LABEL dev:1 +RUN yum update -y +RUN yum install nginx -y +EXPOSE 80 +CMD ["nginx","-g", "daemon off:"] + +FROM openjdk:8-jdk-alpine as builder +RUN mkdir -p /app/source +COPY . /app/source +WORKDIR /app/source +RUN ./mvnw clean package + + +FROM builder +COPY --from=builder /app/source/target/*.jar /app/app.jar +EXPOSE 8080 +ENTRYPOINT ["java","-Djava.security.egd=file:/dev/./urandom", "-jar", "/app/app.jar"]\ + + + + +FROM ubuntu:latest +RUN apt-get update +RUN apt-get install nginx:latest +COPY /usr/share/nginx +CMD ["nginx","-g","daemon off:"] + + + + + +apiVersion: apps/v1 +kind: Deployment +metadata: + name: nginx-deployment + labels: + app: nginx +spec: + replicas: 5 + selector: + matchLabels: + app: nginx + template: + metadata: + labels: + app: nginx + spec: + containers: + - name: nginx + image: nginx:latest + ports: + - containerPort: 80 + + + + + + + + + + + + + +DevOps-Shack-Project --- k8s kubeadm join command + + + + join 172.31.40.50kubeadm:6443 --token 8jaarh.0vd93xk6bq5vxqec \ + --discovery-token-ca-cert-hash sha256:95bdae5d5fc65aedf6b6cd5b552aab0ea04b52cd8db7a4530eb9da665093182d + + + sonarqube token (squ_aa4ba1a09a4036d33963a4276a2eaf7fedd7dd5e) + jenkins managed files --- (54ba0e0d-017f-4e1b-991b-76a5fcb88cd8) + + pipeline { + agent any + tools { + jdk 'jdk17' + maven 'maven3' + } + environment { + SCANNER_HOME= tool 'sonar-scanner' + } + + stages { + stage('Git Checkout') { + steps { + git branch: 'main', url: 'https://github.com/Dasmanth/Boardgame.git' + } + } + stage('Compile') { + steps { + sh "mvn compile" + + } + } + stage('Test') { + steps { + sh "mvn test" + + } + } + stage('File System Scan') { + steps { + sh "trivy fs --format table -o trivy-fs-report.html ." + + } + } + stage('SonarQube Analsyis') { + steps { + withSonarQubeEnv('sonar') { + sh ''' $SCANNER_HOME/bin/sonar-scanner -Dsonar.projectName=BoardGame -Dsonar.projectKey=BoardGame \ + -Dsonar.java.binaries=. ''' + } + } + } + stage('Quality Gate') { + steps { + script { + waitForQualityGate abortPipeline: false, credentialsId: 'sonar-token' + } + } + } + stage ('Build') { + steps { + sh "mvn package" + } + } + stage('Publish To Nexus') { + steps { + withMaven(globalMavenSettingsConfig: 'global-settings', jdk: 'jdk17', maven: 'maven3', mavenSettingsConfig: '', traceability: true) { + sh "mvn deploy" + } + + } + } + stage('Build & Tag Docker Image') { + steps { + script { + withDockerRegistry(credentialsId: 'docker-cred', toolName: 'docker') { + sh "docker build -t dasmanth/jenkins:latest ." + } + } + } + } + stage('Docker Image Scan') { + steps { + sh "trivy image --format table -o trivy-image-report.html dasmanth/jenkins:latest " + } + } + stage('Push Docker Image') { + steps { + script { + withDockerRegistry(credentialsId: 'docker-cred', toolName: 'docker') { + sh "docker push dasmanth/jenkins:latest" + } + } + } + } + + + } + +} + + + + + + + + + + +##Nginx docker file +FROM ubuntu:18.04 +RUN apt get update +RUN apt get install nginx -y +COPY nginx.conf /etc/nginx +COPY server.conf /etc/nginx/conf.d +EXPOSE 80:80 +CMD ["nginx","-g","daemon off;"] + + + + + +##jenkins file + + +pipeline { + agent any + tools { + maven "maven3" + jdk "jdk17" + } + environment { + + } + stages { + stage ('Git check out') { + steps { + sh git pull + } + } + } +} + + +##k8s pod yaml file + +apiVersion: v1 apiVersion: +kind: Pod +metadata: + name:nginx +spec: + containers: + - name: nginx + image: nginx:latest + ports: + - containerPort: 80 + + + + pipeline { + agent any + tools { + jdk 'jdk11' + maven 'maven3' + } + environment { + SONAR_HOME= tool + } + stages { + stage ('Git Checkout') { + steps { + gitbranch: '' + } + } + stage ('Code compile') { + steps { + sh "mvn compile" + } + } + stage ('Code validate') { + steps { + sh "mvn validate" + } + } + stage ('Code test') { + steps { + sh "mvn test" + } + } + stage ('Sonar analysis') { + steps { + + } + } + stage ('Quality gate') { + steps { + + } + } + stage ('Build') { + steps { + sh "mvn clean package" + } + } + stage ('Pull artifact to nexus'){ + steps { + + } + } + stage ('Docker image build & Tag') { + steps { + + } + } + } + } + + + + + FROM ubuntu:latest + RUN apt get update -y + RUN apt get install nginx -y + COPY nginx.conf /etc/nginx + COPY server.conf /etc/nginx/nginx.conf + ADD + EXPOSE 80:80 + USER + CMD ["nginx","-g","daemon 0ff;"] + + + apiVersion: apps/v1 +kind: Deployment +metadata: + name: nginx-deployment + labels: + app: nginx +spec: + replicas: 3 + selector: + matchLabels: + app: nginx + template: + metadata: + labels: + app: nginx + spec: + containers: + - name: nginx + image: nginx:1.14.2 + ports: + - containerPort: 80 + apiVersion: apps/v1 + kind: Deployment + metadata: + name: nginx-deployment + labels: + app: nginx + spec: + replicas: 3 + selector: + matchLabels: + app: nginx + template: + metadata: + labels: + app: nginx + spec: + containers: + - name: nginx + image: nginx:latest + ports: + - containerPort: 80 + + +apviVesrion: apps/v1 +kind: Deployment +metadata: + name: nginx + labels: + app: nginx +spec: + replicas: 5 + selector: + matchLabels: + app: nginx + template: + meatadata: + labels: + app: Nginx + spec: + containers: + - name: nginx + image: nginx:latest + ports: + - containerPort: 80 + + + FROM ubuntu:alpine + RUN apt get update -y + RUN apt get install nginx -y + COPY nginx.conf /etc/ + COPY server.cong / + EXPOSE 80:80 + CMD ["nginx","-g","daemon off;"] + + + pipeline { + aget any + tools { + jdk "jdk11" + maven "maven3" + } + environment { + + } + stages { + stage ('Gir Check out') { + steps { + + } + } + } + } + + +--- +- name: update web servers + hosts: webservers + remote_user: root + + tasks: + - name: ensure apache is at the latest version + ansible.builtin.yum: + name: httpd + state: latest + + - name: update database + ansible.builtin.template: + src: /srv/ + dest: /etc/ + + + +terraform { + +} \ No newline at end of file diff --git a/gitcommands.txt b/gitcommands.txt new file mode 100644 index 000000000..f2e59f3de --- /dev/null +++ b/gitcommands.txt @@ -0,0 +1,73 @@ +git clone --- This command will clone your remote repo to your local machine. +git checkout -b --- This command is used to create and switch to a new branch. + ##scenario--- When a new feature, bug fix, or infrastructure change is required, creating a new branch to isolate changes. DevOps engineers often use branches for: + + Creating new features + Fixing production issues + Writing or updating Infrastructure-as-Code (IaC) +git pull origin --- This command is used to pull the changes from remote repo to the local machine. + ##scenario --- Before staring any work,pulling the latest changes from the remote repo ensure your local branch is upto date + with the team's latest commits. + +git status --- Checking the status of changes done in the project. + ##scenario--- Regularly checking the status while working to see which files are modified, added, or deleted before committing changes. + It helps in tracking what needs to be staged or excluded. + +git add (or) git add . --- Staging the changes from working to stage. + ##scenario --- After making changes to configuration files (e.g., Dockerfiles, Kubernetes manifests, Terraform scripts), + DevOps engineers stage those changes before committing them to the branch + . +git commit -m --- Commiting the changes + ##scenario ---Commit changes after successful code or configuration updates. It’s a good practice to have meaningful commit messages + that describe what was changed (e.g., "Updated Jenkinsfile to support new build process"). + +git push origin --- Pushing the changes from local to remote repo. + ##scenario ---After committing changes locally, pushing them to the remote repository makes those changes available to others, + including for CI/CD pipelines to pick them up. + +git merge --- Merging the branches + ##scenario-- After completing the development or changes in a feature branch, merging those changes into the main branch or a staging branch. + Example Use Case: Merging changes from the feature/new-ci-pipeline branch into the main branch. + +git merge -- Resolving merge conflicts + ##scenario-- When there are conflicts between branches, Git pauses the merge, and + DevOps engineers must manually resolve conflicts, edit conflicting files, stage, and commit the resolutions. + +git rebase -- Rebasing the branch + ##scenario--- To ensure that the feature branch is up to date with the latest changes from the main branch without creating a merge commit. + This helps maintain a cleaner history, especially in production or release branches. + +git log (or) git log --online --- Viewing commit history + ##scenario-- Reviewing commit history to understand changes made by other team members or to investigate changes when something breaks in production. + +git diff -- Checking differneces between two commits + ##scenario-- To view changes that have been made but not yet committed. This helps in code reviews and debugging configuration files or code before committing. + +git tag (or) git push origin -- Tagging releases + ##scenario-- When releasing a new version of software or infrastructure, tagging the commit with a version (e.g., v1.0.0). \ + Tags help mark points in the Git history for releases, making rollback easier in case of failure. + +git reset -- Unstage changes + ##scenario-- If an incorrect change was made or committed, + DevOps engineers may need to reset the staging area or revert a commit to undo changes. This helps to maintain stability in production environments. + +git revert -- Revert a commit + ##scenario-- If an incorrect change was made or committed, + DevOps engineers may need to reset the staging area or revert a commit to undo changes. This helps to maintain stability in production environments. + +git cherry-pick -- Cherry-picking specific commits + ##scenario-- When you want to pick specific commits from one branch and apply them to another without merging the whole branch. This is useful when deploying hotfixes from a development branch to production. + +git remote -v -- Checking remote URLs + ##scenario-- To verify the remote repository’s URL, especially when managing multiple remotes like production, staging, or dev repositories. + +git fetch -- Fetching changes from remote repository + ##scenario-- To retrieve the latest changes from the remote repository without merging them into your working branch. This is useful when you want to inspect changes before applying them. + +git stash apply -- Stashing changes + ##scenario-- When you need to save your uncommitted changes temporarily (e.g., switching to another branch for an urgent task), you can stash those changes and apply them later. + +git rm -- Removing files + ##scenario-- When you need to remove files from the repository and from your working directory. This can be used when cleaning up configuration files or obsolete scripts. + + \ No newline at end of file diff --git a/linuxcommands.txt b/linuxcommands.txt new file mode 100644 index 000000000..d311c7fb2 --- /dev/null +++ b/linuxcommands.txt @@ -0,0 +1,79 @@ +.pem --- Privacy Enhanced Mail +.ppk --- PuTTY Private Key +.txt --- text file +.c --- C language extension +.java --- Java extension +.sh --- shell +.go -- go +.php --- php +.html -- html +.xml -- xm file +.json-- java script object notaion +.zip--- zip file +.jar -- java archive file +cat /etc/os-release --- which os +cat /etc/passwd --- linux users data +cat /etc/groups --- linux user groups data +cat /etc/system-release --- OS info +sudo su --- If you want to became a root user +cd / ---root directory +cd -- change directory + cd +cat -- It will display the file content +ls --- Listing the file and directories + ls -a ---Lists all files in a directory, including hidden files and directories + ls -R --- Lists all files, sorted by file size\ + ls -l-l: Also known as "long listing", this command shows details about the Linux file that are important to the Linux system + ls -t: Sorts files by modification time + ls -r: Sorts files in reverse order + ls -s: Prints the allocated size of each file, in blocks + ls -lrt: It will display the data in the time stamp +pwd --- present working directory +cd - --> Undo you will go back to the previous stage +touch -- It will create new empty file + touch +mkdir -- It will create new empty directory + mkdir +man -- to know the commands list and usage + man -- +useradd -- To create the new user + sudo useradd -- To add new user + sudo userdel -- To delete user + sudo passwd -- To set the password to the user +groupadd -- To add the new group + sudo groupadd + sudo groupdel +sudo usermod-g -- adding a user to the primary group +mv -- To move or rename the file/directory + mv + mv +cp -- Copy + cp test.txt testing +diff -- It will display the difference between the two files +echo - +echo "devops" >> -- append the data from existing data +echo "devops" > -- redirect the data (or) replace the data from existing data +read (r) --- 4 +writr (w) -- 2 +execute (x) -1 +rw- (user) r--(group) r--(others) +420 (6) 400 (4) 400(4) + +rwx r-x r-x +421(6) 401(5) 401 (5) +chmod -- The chmod command (short for "change mode") in Linux is used to change file or directory permissions +chmod -R -- Recursive + chmod -R 777 - Your'e going to give all permissiosn to the all users (user,group & others) +chown --- The chown command in Linux is used to change the ownership of files and directories. + sudo chown : + sudo chown : folders --- Changing folders permissions + sudo chown -R : folders -- Changing folder and its sub-folders permissions +cat cd /etc/cpuinfo +cat cd /etc/meminfo +free -m It will show +free -g +df -kh -- To display server details +history --- It will give history of the commands +cat devops.txt --- To konw the content in the file +ech0 " " > --- It is going to flush (or) empty the file + diff --git a/test.py b/test.py new file mode 100644 index 000000000..8a6d5357a --- /dev/null +++ b/test.py @@ -0,0 +1,4 @@ +str1 = "Hello" +str2 = "World" +result = str1 + " " + str2 +print(result) \ No newline at end of file