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

my-pull-java #39

Open
wants to merge 314 commits into
base: feature-1
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
314 commits
Select commit Hold shift + click to select a range
ff57e3e
Update CalculatorTest.java
Nov 1, 2018
c4a4ba2
Update CalculatorTest.java
Nov 1, 2018
3db8ad5
Update CalculatorTest.java
Nov 1, 2018
c3b4c42
Update CalculatorTest.java
Nov 1, 2018
11c03ce
Create scm_demo
Nov 1, 2018
97496c9
Update scm_demo
Nov 1, 2018
9f7ae76
Update scm_demo
Nov 1, 2018
84c2ce2
Update scm_demo
Nov 1, 2018
6eb6db9
Update scm_demo
Nov 1, 2018
1aefb6f
Update scm_demo
Nov 1, 2018
a024f9f
Update scm_demo
Nov 1, 2018
550e92a
Update scm_demo
Nov 1, 2018
132a654
Update scm_demo
Nov 1, 2018
463302b
Update scm_demo
Nov 1, 2018
34601b2
Update scm_demo
Nov 1, 2018
b66a467
Update scm_demo
Nov 1, 2018
e8ef00c
Update index.html
Nov 2, 2018
fb0f4b6
Update Calculator.java
Nov 2, 2018
0f481a4
Update Calculator.java
Nov 2, 2018
f6a49ac
Update web.xml
Nov 2, 2018
18546cf
Update web.xml
Nov 2, 2018
ddacad1
Update index.html
Nov 6, 2018
6b19cf6
Update index.html
Nov 12, 2018
c71863c
Create nov-2018-7am-devops
Nov 16, 2018
6ecb98e
Update Dockerfile
Nov 18, 2018
e0b3246
Update Jenkinsfile
Nov 18, 2018
ffc6108
Update Dockerfile
Nov 18, 2018
54b4fdc
Update Dockerfile
Nov 18, 2018
2f29e54
Update index.html
Dec 5, 2018
4f4e0e6
Update pom.xml
Dec 5, 2018
50d6579
Create docker-swarm-ci-cd
Dec 5, 2018
8856957
Update pom.xml
Dec 17, 2018
d248623
Update Jenkinsfile
Dec 20, 2018
da17df9
Update Jenkinsfile
Dec 20, 2018
8d77a88
Update Calculator.java
Dec 21, 2018
87558d7
Update function-demo
Jan 16, 2019
6bf0055
Update pom.xml
Jan 16, 2019
3e6bb77
Update deploy-to-tomcat
Jan 19, 2019
0bd79fe
Update index.html
Apr 27, 2019
e0df037
ssh demo
invalid-email-address May 1, 2019
d1b6f4d
Update Jenkinsfile
May 30, 2019
c4c18b9
Update Jenkinsfile
May 30, 2019
a769a8f
Integrating with sonar qube
javahomehari May 30, 2019
70b434b
Merge pull request #33 from javahometech/feature/sonar-integration
May 30, 2019
e5ad45c
Create Chart.yml
Jun 17, 2019
f3c9582
Update index.html
Jun 28, 2019
00bf3bf
Update web.xml
Jun 28, 2019
350d5aa
Update web.xml
Jun 28, 2019
91f2737
Update index.html
Jul 3, 2019
3691faf
Update index.html
Jul 3, 2019
bbb06aa
Update index.html
Jul 4, 2019
5d7665c
Update Calculator.java
Jul 4, 2019
d0e4ed6
Update Calculator.java
Jul 4, 2019
c3f7b02
Update pom.xml
Jul 31, 2019
c764427
Update pom.xml
Jul 31, 2019
b02523a
Update pom.xml
Jul 31, 2019
4038f68
Update pom.xml
Aug 10, 2019
5db9b02
Update Dockerfile
Aug 13, 2019
56819a6
Create 2019-Aug-9:30Am-jenkinsfile
Aug 13, 2019
bda8ae0
Update pom.xml
Aug 15, 2019
6f7824a
Update pom.xml
Aug 15, 2019
81e0c35
Set up CI with Azure Pipelines
Nov 12, 2019
115c462
Create maven.yml
Dec 12, 2019
27528fc
Update Jenkinsfile
Dec 12, 2019
b38ea43
Set up CI with Azure Pipelines
Feb 5, 2020
b980799
Update azure-pipelines.yml for Azure Pipelines
Feb 5, 2020
4dae686
Update azure-pipelines.yml for Azure Pipelines
Feb 5, 2020
608eb6f
Update azure-pipelines.yml for Azure Pipelines war file
Feb 5, 2020
cfedac6
Update azure-pipelines.yml for Azure Pipelines
Feb 6, 2020
de94395
Update azure-pipelines.yml for Azure Pipelines
Feb 6, 2020
3cab242
Update azure-pipelines.yml for Azure Pipelines
Feb 6, 2020
b49ad84
Create deployment.yml
Aug 17, 2020
35a743d
Create services.yml
Aug 17, 2020
9fca37a
Update index.html
Sep 23, 2020
06b5502
Update index.html
Sep 24, 2020
47bc648
Update index.html
Sep 24, 2020
3da55fd
Update 2019-Aug-9:30Am-jenkinsfile
Sep 25, 2020
d2c8421
Update index.html
Sep 25, 2020
c1b387b
Update pom.xml
Oct 23, 2020
c576be6
Update pom.xml
Oct 27, 2020
c29f2ad
Update pom.xml
Oct 27, 2020
c60caf2
Update index.html
Oct 28, 2020
1e1a40b
Update index.html
Oct 30, 2020
292d4ad
Update index.html
Nov 2, 2020
e7d6064
Update index.html
Nov 2, 2020
68b4f50
Update index.html
Nov 2, 2020
3aeec8e
Update index.html
Nov 9, 2020
4a7fec5
Update pom.xml
Nov 12, 2020
2d3845d
Update pom.xml
Nov 12, 2020
113a918
Update pom.xml
Nov 12, 2020
d6396f3
Update pom.xml
Nov 13, 2020
6431846
Update pom.xml
Nov 13, 2020
f4b781c
Update index.html
Nov 28, 2020
189b921
Update index.html
Nov 28, 2020
394a777
Update index.html
Nov 29, 2020
b856bdd
Update index.html
Nov 29, 2020
469db05
Update Dockerfile
Nov 29, 2020
23e4962
Update Dockerfile
Nov 29, 2020
7ba0e4b
Update Dockerfile
Nov 29, 2020
d22e845
Update Jenkinsfile
Dec 12, 2020
3714fed
Update Jenkinsfile
Dec 12, 2020
17cde44
Update Jenkinsfile
Dec 12, 2020
3cb3ff2
Update CalculatorTest.java
Dec 13, 2020
122daf9
Update CalculatorTest.java
Dec 13, 2020
74aa375
Update Jenkinsfile
Dec 13, 2020
644a80d
Update Jenkinsfile
Dec 13, 2020
cdacfe4
Update Jenkinsfile
Dec 13, 2020
58784c2
Update Jenkinsfile
Dec 13, 2020
1871793
Update Jenkinsfile
Dec 13, 2020
477a40c
Update Jenkinsfile
Dec 13, 2020
d94b27d
Update Jenkinsfile
Dec 13, 2020
4497e75
Update Jenkinsfile
Dec 19, 2020
6b630a6
Update Jenkinsfile
Dec 19, 2020
bed3657
Update Calculator.java
Dec 19, 2020
5d524b2
Update Jenkinsfile
Dec 19, 2020
64ddbb0
Update pom.xml
Dec 19, 2020
0e130e8
Update Jenkinsfile
Dec 19, 2020
19f2e05
Update pom.xml
Mar 10, 2021
bbec58a
Update Calculator.java
Mar 17, 2021
8c81505
Update README.md
Mar 18, 2021
59b78b4
Update azure-pipelines.yml
Mar 19, 2021
d163e2a
Update Calculator.java
Mar 23, 2021
02d5c9e
Update pom.xml
Mar 23, 2021
68b2ac1
Update index.html
Mar 25, 2021
c5c83a8
Update web.xml
Mar 26, 2021
7b239fb
Update web.xml
Mar 26, 2021
ea33d07
Update web.xml
Mar 26, 2021
fe7f341
Update web.xml
Mar 26, 2021
2b7af84
Rename Jenkinsfile to Jenkinsfile_old
Mar 29, 2021
957099c
Create Jenkinsfile
Mar 29, 2021
5eebe9d
Update web.xml
May 3, 2021
517de4b
Update pom.xml
May 3, 2021
8a25af4
Update index.html
May 4, 2021
4bd6bd9
Update Jenkinsfile_old
May 5, 2021
9f3a200
Update docker-ci-cd
May 5, 2021
c07e61f
Update index.html
May 12, 2021
1645eea
Update Jenkinsfile
May 12, 2021
c2524a9
Update Jenkinsfile
May 12, 2021
56337be
Update Jenkinsfile
May 12, 2021
8825178
Update Jenkinsfile
May 12, 2021
baba265
Update Jenkinsfile
May 13, 2021
5a1a8b8
Update index.html
May 13, 2021
1b7830e
nexus deploy
Jun 24, 2021
8b5e4af
Update pom.xml
Jun 24, 2021
72c2814
Update pom.xml
Jun 24, 2021
6c67f31
Update pom.xml
Jun 24, 2021
c8f8e62
Update index.html
Jun 24, 2021
1063928
Update Dockerfile
Jun 25, 2021
e2b3f11
Update Jenkinsfile_old
Jun 25, 2021
3825356
Update Jenkinsfile_old
Jun 25, 2021
ffaf5c2
Update Calculator.java
Jul 24, 2021
04a2be9
Update Calculator.java
Jul 24, 2021
a6d1234
Update index.html
Aug 1, 2021
74461a7
Update web.xml
Aug 1, 2021
9764a88
Update web.xml
Aug 1, 2021
7706401
Update index.html
Aug 5, 2021
5dbb5b4
Update index.html
Aug 5, 2021
75908da
Update Dockerfile
Aug 5, 2021
5bc60f2
Update index.html
Aug 5, 2021
7549fce
Update pom.xml
Aug 26, 2021
b454ffa
Update pom.xml
Aug 26, 2021
d620e7b
Update pom.xml
Aug 26, 2021
7d6539d
Update pom.xml
Aug 26, 2021
b19736c
Update pom.xml
Aug 26, 2021
82c979b
Update index.html
Aug 30, 2021
a3e60f6
Update web.xml
Aug 30, 2021
823e1f0
Update web.xml
Aug 30, 2021
f755073
Update index.html
Sep 17, 2021
13aaa53
Update index.html
Sep 21, 2021
eb841e9
Update 2019-Aug-9:30Am-jenkinsfile
Sep 29, 2021
decca5f
Update 2019-Aug-9:30Am-jenkinsfile
Sep 29, 2021
7d543a3
Update Jenkinsfile
Sep 29, 2021
b59b42c
Update Jenkinsfile
Sep 29, 2021
24328a0
Update Dockerfile
Sep 29, 2021
df31c67
Update 2019-Aug-9:30Am-jenkinsfile
Oct 4, 2021
592e385
Update Jenkinsfile
Oct 4, 2021
c39421c
Update Dockerfile
Oct 4, 2021
8b1cdea
Update Calculator.java
Oct 8, 2021
abc4f61
Update Calculator.java
Oct 8, 2021
18f274f
Update 2019-Aug-9:30Am-jenkinsfile
Oct 12, 2021
3c714ef
Update Calculator.java
Oct 22, 2021
05d2bd9
Update Dockerfile
Oct 22, 2021
2aa647c
Update Jenkinsfile
Oct 26, 2021
dc48c5a
Update pom.xml
Oct 30, 2021
d806f8b
Update pom.xml
Nov 4, 2021
7e62a5b
Update pom.xml
Nov 4, 2021
321de61
Update pom.xml
Nov 8, 2021
181a414
branch protection rule
javahometech Dec 10, 2021
cdcaea4
Update pom.xml
Dec 15, 2021
14cf9e6
Create deploy.xml
Dec 16, 2021
397cbd2
Create dev
Dec 16, 2021
e8dfd53
Create prod
Dec 16, 2021
ab762bc
Update index.html
Dec 24, 2021
f587a92
Update pom.xml
Dec 24, 2021
c08e1f5
Update sonarqube-analysis
Dec 27, 2021
ffb74c8
Update Dockerfile
Dec 28, 2021
15fa003
Update Dockerfile
Dec 28, 2021
a1f427a
Update index.html
Jan 5, 2022
dd9a520
Update pom.xml
Feb 14, 2022
42009b8
Update pom.xml
Feb 15, 2022
e077115
Update pom.xml
Feb 19, 2022
d652d37
Update Jenkinsfile
Feb 24, 2022
c5e559f
Update Jenkinsfile
Feb 24, 2022
c7b91cd
Update Jenkinsfile
Feb 25, 2022
20affa5
Update Calculator.java
Apr 15, 2022
9270a7c
Update Calculator.java
Apr 19, 2022
98cead3
Update index.html
Apr 20, 2022
ec7b07c
Update README.md
Apr 26, 2022
940c959
Update Dockerfile
Apr 26, 2022
999c06a
Create pymssql39
May 31, 2022
bddec15
Create upload-zip-to-s3
May 31, 2022
43b600e
Rename upload-zip-to-s3 to upload-zip-to-s3.sh
May 31, 2022
04d1a99
Create pymssql39.py
May 31, 2022
8f64b79
Update index.html
Jun 24, 2022
8de8ab2
Update index.html
Jun 24, 2022
7021cdf
Update index.html
Jun 24, 2022
f5da852
Update Dockerfile
Jun 27, 2022
6206203
Update Dockerfile
Jun 27, 2022
43ab762
Update index.html
Jun 27, 2022
3ce02ed
Update Jenkinsfile
Jul 4, 2022
a6e15c9
Update Jenkinsfile
Jul 4, 2022
7428ba1
Update Jenkinsfile
Jul 4, 2022
1975778
Update Jenkinsfile
Jul 4, 2022
c983541
Update Jenkinsfile
Jul 4, 2022
3c9ac01
Update Jenkinsfile
Jul 4, 2022
3826294
Update Jenkinsfile
Jul 4, 2022
2ca1093
Update Jenkinsfile
Jul 4, 2022
f567b42
Update index.html
Jul 4, 2022
8c4be83
Update Jenkinsfile
Jul 6, 2022
70de9c7
Update Jenkinsfile
Jul 6, 2022
cb1dd5c
Update Jenkinsfile
Jul 6, 2022
de0dfbd
Update pom.xml
Jul 11, 2022
a2dc816
Update pom.xml
Jul 11, 2022
79017e4
Update pom.xml
Jul 11, 2022
70e3487
Update Calculator.java
Jul 13, 2022
02141b6
Update Calculator.java
Jul 13, 2022
f92bb88
Create tomcat-deploy.yml
Jul 27, 2022
798348d
Update dev
Jul 27, 2022
a7f05f6
Update tomcat-deploy.yml
Jul 27, 2022
a102de0
Update tomcat-deploy.yml
Jul 27, 2022
3001761
Update tomcat-deploy.yml
Jul 27, 2022
c46b84c
Create Jenkinsfile
Jul 27, 2022
3204885
Update index.html
Sep 6, 2022
f6efc59
Update index.html
Sep 6, 2022
141c6b4
Create 2022-docker-ci-cd
Sep 6, 2022
65a0789
Update Calculator.java
Oct 12, 2022
80f99ab
Update Calculator.java
javahometech May 9, 2023
35a7345
Update pom.xml
javahometech Oct 10, 2023
eab325d
Update 2019-Aug-9:30Am-jenkinsfile
javahometech Mar 12, 2024
7141eb7
Update pom.xml
javahometech Jul 17, 2024
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
18 changes: 18 additions & 0 deletions .github/workflows/maven.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
name: Java CI

on: [push]

jobs:
build:

runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v1
- name: Set up JDK 1.8
uses: actions/setup-java@v1
with:
java-version: 1.8
- name: Build with Maven
run: mvn -B package --file pom.xml

44 changes: 44 additions & 0 deletions 2019-Aug-9:30Am-jenkinsfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
node('master'){
// Add maven to path
env.PATH = "/opt/maven3/bin/:$PATH"

stage('Git Clone/Pull'){
git branch: 'dev',
url: 'https://github.com/javahometech/my-app'
}

stage('Build Docker Image'){
sh "mvn clean package"
sh "mv target/*.war target/myweb.war"
sh "docker build -t kammana/my-app:1.0 ."
}

stage('Push Image'){
withCredentials([string(credentialsId: 'docker-hub', variable: 'dockerHubPwd')]) {
sh "docker login -u kammana -p ${dockerHubPwd}"
}
sh "docker push kammana/my-app:1.0"
}

stage('Delete Old Container'){
sshagent (credentials: ['dev-docker']) {
try{
def dockrRm = "docker rm -f my-app"
def dockrRmImage = "docker rmi kammana/my-app:1.0"
sh "ssh -o StrictHostKeyChecking=no [email protected] ${dockrRm} "
sh "ssh -o StrictHostKeyChecking=no [email protected] ${dockrRmImage} "
}catch(e){
echo "container my-app not found"
}
}

}

stage('Deploy On Dev'){
sshagent (credentials: ['dev-docker']) {
def dockerRun = "docker run -d -p 8080:8080 --name=my-app kammana/my-app:1.0"
sh "ssh -o StrictHostKeyChecking=no [email protected] ${dockerRun} "
}
}

}
38 changes: 38 additions & 0 deletions 2022-docker-ci-cd
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
pipeline{
agent any
stages{
stage("Git Checkout"){
steps{
git url:"https://github.com/javahometech/my-app"
}
}
stage("Maven Package"){
steps{
sh "mvn clean package"
}
}
stage("Docker Build"){
steps{
sh "docker build -t kammana/hariapp:${env.BUILD_NUMBER} ."
}
}
stage("DockerHub Push"){
steps{
withCredentials([usernamePassword(credentialsId: 'dockerhub', passwordVariable: 'pwd', usernameVariable: 'user')]) {
sh "docker login -u ${user} -p ${pwd}"
sh "docker push kammana/hariapp:${env.BUILD_NUMBER}"
}

}
}
stage("Docker Deploy Dev"){
steps{
sshagent(['docker-dev-ssh']) {
sh "ssh -o StrictHostKeyChecking=no [email protected] docker rm -f hariapp"
sh "ssh [email protected] docker run -d -p 8080:8080 --name hariapp kammana/hariapp:${env.BUILD_NUMBER}"
}

}
}
}
}
3 changes: 3 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
FROM tomcat:8
LABEL app=my-app
COPY target/*.war /usr/local/tomcat/webapps/myweb.war
40 changes: 18 additions & 22 deletions Jenkinsfile
Original file line number Diff line number Diff line change
@@ -1,23 +1,19 @@
node{
stage('SCM Checkout'){
git 'https://github.com/javahometech/my-app'
}
stage('Compile-Package'){
// Get maven home path
def mvnHome = tool name: 'maven-3', type: 'maven'
sh "${mvnHome}/bin/mvn package"
}
stage('Email Notification'){
mail bcc: '', body: '''Hi Welcome to jenkins email alerts
Thanks
Hari''', cc: '', from: '', replyTo: '', subject: 'Jenkins Job', to: '[email protected]'
}
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'
}
@Library("mylibs") _
pipeline {
agent any
tools {
maven 'maven2'
}
stages{
stage("Maven Build"){
steps{
sh "mvn clean package"
}
}
stage("Deploy To Dev"){
steps{
tomcatDeploy("tomcat-dev","ec2-user",["172.31.13.89","172.31.13.89"])
}
}
}
}
62 changes: 62 additions & 0 deletions Jenkinsfile_old
Original file line number Diff line number Diff line change
@@ -0,0 +1,62 @@
@Library('javahome-libs') _

pipeline{
agent any
options {
timeout(30)
}
stages{

stage('Maven and Sonar'){

parallel{
stage('Sonar Analysis'){
steps{
withSonarQubeEnv('sonar7') {
sh 'mvn sonar:sonar'
}

timeout(time: 1, unit: 'HOURS') {
script{
def qg = waitForQualityGate()
if (qg.status != 'OK') {
error "Pipeline aborted due to quality gate failure: ${qg.status}"
}
}
}
}
}

stage('Mvn Build'){
steps{
sh 'mvn clean package'
}
}


}

}
stage("Nexus Deploy"){
steps{
script{
def pomFile = readMavenPom file: 'pom.xml'
nexusArtifactUploader artifacts: [[artifactId: 'myweb', classifier: '', file: "target/myweb-${pomFile.version}.war", type: 'war']],
credentialsId: 'nexus3',
groupId: 'in.javahome',
nexusUrl: '172.31.71.247:8081',
nexusVersion: 'nexus3',
protocol: 'http', repository: 'javahome-my-app',
version: pomFile.version
}
}
}

stage('Tomcat Deploy'){
steps{
tomcatDeploy("172.31.35.55","ec2-user","myweb")
}
}

}
}
36 changes: 36 additions & 0 deletions ansible/Jenkinsfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
pipeline{
agent any
tools {
maven 'maven2'
}
stages{
stage("Git Checkout"){
steps{
git url: "https://github.com/javahometech/my-app"
}
}
stage("Maven Build"){
steps{
sh "mvn clean package"
}
}

stage("Ansible Deploy"){
steps{
script{
def pom = readMavenPom file: 'pom.xml'
def name = pom.artifactId
def ext = pom.packaging
def version = pom.version
def war_file = "${name}-${version}.${ext}"
withEnv(["WAR_FILE=${war_file}"]) {
ansiblePlaybook credentialsId: 'tomcat-dev',
inventory: './ansible/dev',
playbook: './ansible/tomcat-deploy.yml'
}

}
}
}
}
}
17 changes: 17 additions & 0 deletions ansible/deploy.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
- hosts: tomcats
tasks:
- name: donwload artifacats from nexus
maven_artifact:
group_id: com.company
artifact_id: library-name
repository_url: 'https://repo.company.com/maven'
username: user
password: pass
dest: /opt/tomcat8/webapps/myapp.war
notify:
- restart tomcat
handlers:
- name: restart tomcat
service:
name: tomcat8
state: restarted
2 changes: 2 additions & 0 deletions ansible/dev
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
[tomcat]
172.31.13.89 ansible_user=ec2-user
2 changes: 2 additions & 0 deletions ansible/prod
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
[tomcats]
100 tomcat ips
14 changes: 14 additions & 0 deletions ansible/tomcat-deploy.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
- hosts: tomcat
tasks:
- name: copy war file to tomcat
copy:
src: "../target/{{ lookup('env','WAR_FILE') }}"
dest: /opt/tomcat9/webapps/app.war
notify:
- stop tomcat
- start tomcat
handlers:
- name: stop tomcat
command: /opt/tomcat9/bin/shutdown.sh
- name: start tomcat
command: /opt/tomcat9/bin/startup.sh
37 changes: 37 additions & 0 deletions azure-pipelines.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
# Starter pipeline
# Start with a minimal pipeline that you can customize to build and deploy your code.
# Add steps that build, run tests, deploy, and more: this is dummy commit
# https://aka.ms/yaml

trigger:
- master

pool:
vmImage: 'ubuntu-latest'

steps:
- script: echo Hello, world!
displayName: 'Run a one-line script'

- script: |
echo Add other tasks to build, test, and deploy your project.
echo See https://aka.ms/yaml
displayName: 'Run a multi-line script'

- task: Maven@3
inputs:
mavenPomFile: 'pom.xml'

- task: PublishBuildArtifacts@1
displayName: 'Publish Artifact: myweb'
inputs:
targetPath: '$(Pipeline.Workspace)'
artifactName: "myweb.war"
condition: succeeded()

- task: DownloadPipelineArtifact@2
inputs:
buildType: current
artifact: 'myweb.war'


30 changes: 22 additions & 8 deletions deploy-to-tomcat
Original file line number Diff line number Diff line change
@@ -1,12 +1,26 @@
node{

def tomcatIp = '172.31.14.131'
def tomcatUser = 'ec2-user'
def stopTomcat = "ssh ${tomcatUser}@${tomcatIp} /opt/tomcat8/bin/shutdown.sh"
def startTomcat = "ssh ${tomcatUser}@${tomcatIp} /opt/tomcat8/bin/startup.sh"
def copyWar = "scp -o StrictHostKeyChecking=no target/myweb.war ${tomcatUser}@${tomcatIp}:/opt/tomcat8/webapps/"
stage('SCM Checkout'){
git 'https://github.com/javahometech/my-app'
git branch: 'master',
credentialsId: 'javahometech',
url: 'https://github.com/javahometech/myweb'
}
stage('Maven Build'){
def mvnHome = tool name: 'maven3', type: 'maven'
sh "${mvnHome}/bin/mvn clean package"
}

stage('Deploy Dev'){
sh 'mv target/myweb*.war target/myweb.war'

sshagent(['tomcat-dev']) {
sh "${stopTomcat}"
sh "${copyWar}"
sh "${startTomcat}"
}
}
stage('Compile-Package'){
// Get maven home path
def mvnHome = tool name: 'maven-3', type: 'maven'
sh "${mvnHome}/bin/mvn package"
}

}
Loading
Loading