diff --git a/README.md b/README.md index 6820115..c1046d1 100644 --- a/README.md +++ b/README.md @@ -1 +1,15 @@ -# jenkins-pipeline-example \ No newline at end of file +#USING WEBHOOK1 +# jenkins-pipeline-example + +webhook trigger-11 + + + dholerahul707 + https://pkgs.dev.azure.com/dholerahul707/_packaging/dholerahul707/maven/v1 + + true + + + true + + diff --git a/azure-pipelines-1.yml b/azure-pipelines-1.yml new file mode 100644 index 0000000..b0030e1 --- /dev/null +++ b/azure-pipelines-1.yml @@ -0,0 +1,61 @@ +# Maven +# Build your Java project and run tests with Apache Maven. +# Add steps that analyze code, save build artifacts, deploy, and more: +# https://docs.microsoft.com/azure/devops/pipelines/languages/java + +trigger: +- main + +stages: +# Stage 1: Build +- stage: Build + displayName: 'Build Stage' + pool: 'azure-first project' # Specify your pool here + jobs: + - job: Build + displayName: 'Build Job' + steps: + - task: Maven@4 + inputs: + mavenPomFile: '/myagent/_work/4/s/my-app/pom.xml' + goals: 'clean install' + publishJUnitResults: true + testResultsFiles: '**/surefire-reports/TEST-*.xml' + displayName: 'Maven Build' + +# Stage 2: Test +- stage: Test + displayName: 'Test Stage' + dependsOn: Build # This stage depends on the Build stage + pool: 'Default' # Different agent pool + jobs: + - job: UnitTests + displayName: 'Run Unit Tests' + steps: + - task: Maven@4 + inputs: + mavenPomFile: '/myagent/_work/1/s/my-app/pom.xml' + goals: 'test' + publishJUnitResults: true + testResultsFiles: '**/surefire-reports/TEST-*.xml' + displayName: 'Maven Unit Tests' + +# Stage 3: Deploy +- stage: Deploy + displayName: 'Deploy Stage' + dependsOn: Build # Run deploy only if the build succeeds + pool: 'azure-first project' + jobs: + - job: Deploy + displayName: 'Deploy Job' + steps: + - script: | + echo "Searching for JAR files..." + find $(System.DefaultWorkingDirectory) -name "*.jar" + displayName: 'Find JAR Files' + + - task: Maven@4 + inputs: + mavenPomFile: '/myagent/_work/4/s/my-app/pom.xml' + goals: 'deploy' + displayName: 'Maven Deploy' diff --git a/azure-pipelines.yml b/azure-pipelines.yml new file mode 100644 index 0000000..5c4db3e --- /dev/null +++ b/azure-pipelines.yml @@ -0,0 +1,75 @@ +# Maven +# Build your Java project and run tests with Apache Maven. +# Add steps that analyze code, save build artifacts, deploy, and more: +# https://docs.microsoft.com/azure/devops/pipelines/languages/java + +trigger: +- main + +pool: + name: azure-first project + +stages: + +# Stage 1: Build.. +- stage: Build + displayName: 'Build Stage' + jobs: + - job: Build + displayName: 'Build Job' + steps: + - task: Maven@4 + inputs: + mavenPomFile: '/myagent/_work/4/s/my-app/pom.xml' + goals: 'clean install' + publishJUnitResults: true + testResultsFiles: '**/surefire-reports/TEST-*.xml' + javaHomeOption: 'JDKVersion' + mavenVersionOption: 'Default' + mavenAuthenticateFeed: false + effectivePomSkip: false + sonarQubeRunAnalysis: false + displayName: 'Maven Build' + +# Stage 2: Test +- stage: Test + displayName: 'Test Stage' + dependsOn: Build # Run tests only if the build succeeds + jobs: + - job: UnitTests + displayName: 'Run Unit Tests -get approval' + steps: + - task: Maven@4 + inputs: + mavenPomFile: '/myagent/_work/4/s/my-app/pom.xml' + goals: 'test' # Only run tests in this stage + publishJUnitResults: true + testResultsFiles: '**/surefire-reports/TEST-*.xml' + javaHomeOption: 'JDKVersion' + mavenVersionOption: 'Default' + mavenAuthenticateFeed: false + displayName: 'Maven Unit Tests' + +# Stage 3: Deploy + +- stage: Deploy + displayName: 'Deploy Stage' + dependsOn: Build # Run deploy only if the build succeeds + jobs: + - deployment: + environment: 'deploy' + strategy: + runOnce: + deploy: + steps: + - task: Maven@4 + inputs: + mavenPomFile: '/myagent/_work/4/s/my-app/pom.xml' + goals: 'deploy' + publishJUnitResults: true + testResultsFiles: '**/surefire-reports/TEST-*.xml' + javaHomeOption: 'JDKVersion' + mavenVersionOption: 'Default' + mavenAuthenticateFeed: false + effectivePomSkip: false + sonarQubeRunAnalysis: false diff --git a/jira_issue.txt b/jira_issue.txt new file mode 100644 index 0000000..93efcfb --- /dev/null +++ b/jira_issue.txt @@ -0,0 +1,2 @@ +jira_issue_id: 10016 . + diff --git a/my-app/Jenkinsfile b/my-app/Jenkinsfile index 6ebdccf..5b35653 100644 --- a/my-app/Jenkinsfile +++ b/my-app/Jenkinsfile @@ -4,6 +4,7 @@ pipeline { tools { maven "MAVEN" jdk "JDK" + //MVN } stages { diff --git a/my-app/pom.xml b/my-app/pom.xml index 8671f90..7cf8173 100644 --- a/my-app/pom.xml +++ b/my-app/pom.xml @@ -25,9 +25,15 @@ 4.11 test + + org.sonarsource.scanner.maven + sonar-maven-plugin + 3.10.0.2594 + + ${project.artifactId}-${project.version}-${env.BUILD_NUMBER} @@ -69,7 +75,28 @@ maven-project-info-reports-plugin 3.0.0 + + + + + + + + + central + ip-172-31-13-156.ap-south-1.compute.internal-releases + http://15.207.55.160:8081/artifactory/app-lib + + + snapshots + ip-172-31-13-156.ap-south-1.compute.internal-snapshots + http://15.207.55.160:8081/artifactory/app-lib + + + + +