Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
82 changes: 82 additions & 0 deletions Jenkinsfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,82 @@
pipeline {
agent any

tools {
jdk "java-8"
maven "maven-3"
}
stages {
stage ('clone'){
steps {
git "https://github.com/komalkhiratkar/VProfile.git"
}
}
stage ('test'){
steps {
echo " running test cases"
}
}
stage ('build') {
steps {
sh 'mvn package'
}
}
stage('CODE ANALYSIS with SONARQUBE') {

environment {
scannerHome = tool 'sonarqube-4'
}

steps {
withSonarQubeEnv('sonarqube') {
sh '''${scannerHome}/bin/sonar-scanner -Dsonar.projectKey=vprofile \
-Dsonar.projectName=vprofile-repo \
-Dsonar.projectVersion=1.0 \
-Dsonar.sources=src/ \
-Dsonar.login=admin \
-Dsonar.password=admin1234 \
-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: 1, unit: 'MINUTES') {
// waitForQualityGate abortPipeline: false
// }
}
}


stage('Nexus artifact'){
steps {

nexusArtifactUploader(
nexusVersion: 'nexus3',
protocol: 'http',
nexusUrl: '172.31.8.147:8081',
groupId: 'DEV',
version: '$BUILD_NUMBER',
repository: 'Vprofile-repo',
credentialsId: 'nexus-creds',
artifacts: [
[artifactId: 'vprofile',
classifier: '',
file: 'target/vprofile-v1.war',
type: 'war']
]
)

}
}

stage('deploy to tomcat'){
steps{

deploy adapters: [tomcat8(credentialsId: 'tomcat-creds', path: '', url: 'http://172.31.3.167:8080')], contextPath: 'january-9', war: 'target/vprofile-v1.war'

}
}
}
}

61 changes: 61 additions & 0 deletions Jenkinsfile-3
Original file line number Diff line number Diff line change
@@ -0,0 +1,61 @@
pipeline {
environment {
registry = "komal921/docker-test"
registryCredential = 'docc-credentials'
dockerImage = ''
}
agent any
tools {
jdk "java-8"
maven "maven-3"
}
stages {
stage('Cloning Git') {
steps {
git branch: 'komal', changelog: false, credentialsId: 'docc-credentials', poll: false, url: 'https://github.com/komalkhiratkar/VProfile.git'
}
}

stage ('Build maven') {
steps {
sh 'mvn package'
}
}

stage('Building image') {
steps{
script {
dockerImage = docker.build registry + ":$BUILD_NUMBER"
}
}
}

stage('Deploy Image') {
steps{
script {
docker.withRegistry( '', registryCredential ) {
dockerImage.push()
}
}
}
}
stage('Remove Unused docker image') {
steps{
sh "docker rmi $registry:$BUILD_NUMBER"
}
}
stage ('install docker and pull image') {
steps{
script {
withDockerRegistry(credentialsId: 'docc-credentials') {
sh "sudo -S apt install docker.io -y"
sh "docker pull komal921/docker-test ."
sh "docker run -itd komal921/docker-test"
}
}
}
}
}
}


8 changes: 8 additions & 0 deletions sample-playbook.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
---
- hosts: ubuntu
become: yes
tasks:
- name: install tree package
apt:
name: tree
state: present