Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

newcommit #142

Open
wants to merge 24 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
24 commits
Select commit Hold shift + click to select a range
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
40 changes: 23 additions & 17 deletions Jenkinsfile
Original file line number Diff line number Diff line change
@@ -1,25 +1,31 @@
node{
node{
stage('SCM Checkout'){
git 'https://github.com/javahometech/my-app'
git 'https://github.com/prabaharan0312126/my-app.git'
}
stage('Compile-Package'){

def mvnHome = tool name: 'maven-3', type: 'maven'
sh "${mvnHome}/bin/mvn package"
def mvnHome = tool name: 'maven3', type: 'maven'
sh "${mvnHome}/bin/mvn clean package"
sh 'mv target/myweb*.war target/newapp.war'
}
stage('Email Notification'){
mail bcc: '', body: '''Hi Welcome to jenkins email alerts
Thanks
Hari''', cc: '', from: '', replyTo: '', subject: 'Jenkins Job', to: '[email protected]'
stage('Build Docker Imager'){
sh 'docker build -t prabaharanitlearn/myweb:0.0.2 .'
}
stage('Slack Notification'){
slackSend baseUrl: 'https://hooks.slack.com/services/',
channel: '#jenkins-pipeline-demo',
color: 'good',
message: 'Welcome to Jenkins, Slack!',
teamDomain: 'javahomecloud',
tokenCredentialId: 'slack-demo'
stage('Docker Image Push'){
withCredentials([string(credentialsId: 'dockerPass', variable: 'dockerPassword')]) {
sh "docker login -u prabaharanitlearn -p ${dockerPassword}"
}
sh 'docker push prabaharanitlearn/myweb:0.0.2'
}
stage('Remove Previous Container'){
try{
sh 'docker rm -f tomcattest'
}catch(error){
// do nothing if there is an exception
}
stage('Docker deployment'){
sh 'docker run -d -p 8090:8080 --name tomcattest prabaharanitlearn/myweb:0.0.2'
}
}


}
}
68 changes: 68 additions & 0 deletions azure-pipelines.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,68 @@
# Maven package Java project Web App to Linux on Azure
# Build your Java project and deploy it to Azure as a Linux web app
# Add steps that analyze code, save build artifacts, deploy, and more:
# https://docs.microsoft.com/azure/devops/pipelines/languages/java

trigger:
- master

variables:

# Azure Resource Manager connection created during pipeline creation
azureSubscription: '9173b8cb-c772-406d-a356-d95d4cc6f96b'

# Web app name
webAppName: 'prabhaApp1'

# Environment name
environmentName: 'prabhaApp1'

# Agent VM image name
vmImageName: 'ubuntu-latest'

stages:
- stage: Build
displayName: Build stage
jobs:
- job: MavenPackageAndPublishArtifacts
displayName: Maven Package and Publish Artifacts
pool:
vmImage: $(vmImageName)

steps:
- task: Maven@3
displayName: 'Maven Package'
inputs:
mavenPomFile: 'webapp/pom.xml'

- task: CopyFiles@2
displayName: 'Copy Files to artifact staging directory'
inputs:
SourceFolder: '$(System.DefaultWorkingDirectory)'
Contents: '**/target/*.?(war|jar)'
TargetFolder: $(Build.ArtifactStagingDirectory)

- upload: $(Build.ArtifactStagingDirectory)
artifact: drop

- stage: Deploy
displayName: Deploy stage
dependsOn: Build
condition: succeeded()
jobs:
- deployment: DeployLinuxWebApp
displayName: Deploy Linux Web App
environment: $(environmentName)
pool:
vmImage: $(vmImageName)
strategy:
runOnce:
deploy:
steps:
- task: AzureWebApp@1
displayName: 'Azure Web App Deploy: prabhaApp1'
inputs:
azureSubscription: $(azureSubscription)
appType: webAppLinux
appName: $(webAppName)
package: '$(Pipeline.Workspace)/drop/**/target/*.?(war|jar)'
39 changes: 0 additions & 39 deletions docker-ci-cd

This file was deleted.

25 changes: 0 additions & 25 deletions docker-ci-cd-youtube

This file was deleted.

41 changes: 0 additions & 41 deletions docker-swarm-ci-cd

This file was deleted.

32 changes: 0 additions & 32 deletions jenkins-pipeline-9am-sep-2018

This file was deleted.

31 changes: 0 additions & 31 deletions nov-2018-7am-devops

This file was deleted.

41 changes: 0 additions & 41 deletions pipeline-docker-ci-cd

This file was deleted.

6 changes: 0 additions & 6 deletions scm_demo

This file was deleted.

17 changes: 17 additions & 0 deletions sonar
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@

node{
stage('SCM Checkout'){
git 'https://github.com/prabaharan0312126/my-app.git'
}
stage('Compile-Package'){

def mvnHome = tool name: 'maven3', type: 'maven'
sh "${mvnHome}/bin/mvn clean package"
sh 'mv target/myweb*.war target/newapp.war'
}
stage('SonarQube Analysis') {
def mvnHome = tool name: 'maven-3', type: 'maven'
withSonarQubeEnv('sonar') {
sh "${mvnHome}/bin/mvn sonar:sonar"
}
}
Loading