GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — JavaWebApplicationStepByStep/Jenkinsfile at master · byreswara/JavaWebApplicationStepByStep

Expand file tree

/

Jenkinsfile

Copy path
More file actions
More file actions

Latest commit

 

History

History
History
136 lines (132 loc) · 4.71 KB
/

Jenkinsfile

Copy path

File metadata and controls

136 lines (132 loc) · 4.71 KB
Raw
Copy raw file
Download raw file
Open symbols panel
Edit and raw actions
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
pipeline {
agent any
tools {
maven 'maven'
}
environment {
NEXUS_URL = "http://13.212.71.76:8081/content/repositories/releases/"
NEXUS_REPO_ID = "releases"
GROUP_ID="`echo -e 'setns x=http://maven.apache.org/POM/4.0.0\ncat /x:project/x:groupId/text()' | xmllint --shell pom.xml | grep -v /`"
ARTIFACT_ID="`echo -e 'setns x=http://maven.apache.org/POM/4.0.0\ncat /x:project/x:artifactId/text()' | xmllint --shell pom.xml | grep -v /`"
VERSION="`echo -e 'setns x=http://maven.apache.org/POM/4.0.0\ncat /x:project/x:version/text()' | xmllint --shell pom.xml | grep -v /`"
NEXUS_VERSION="`echo -e 'setns x=http://maven.apache.org/POM/4.0.0\ncat /x:project/x:version/text()' | xmllint --shell pom.xml | grep -v /`.${BUILD_NUMBER}"
FILE_NAME="target/${ARTIFACT_ID}-${VERSION}.war"
}
stages {
stage('Unit Test') {
steps {
tool name: 'maven', type: 'maven'
sh 'mvn clean test'
}
}
stage("SonarQube analysis") {
steps {
withSonarQubeEnv('sonar') {
sh 'mvn sonar:sonar'
}
}
}
stage('package') {
steps {
tool name: 'maven', type: 'maven'
sh 'mvn package'
}
}
stage('Publish Artifacts to Nexus') {
steps {
script{
sh "mvn -B deploy:deploy-file -Durl=$NEXUS_URL -DrepositoryId=$NEXUS_REPO_ID -DgroupId=$GROUP_ID -Dversion=$NEXUS_VERSION -DartifactId=$ARTIFACT_ID -Dpackaging=war -Dfile=$FILE_NAME"
}
}
}
/*stage("Deploy to DEV environment") {
steps {
sshPublisher(publishers: [sshPublisherDesc(configName: 'devTomcat',
transfers: [sshTransfer(cleanRemote: false,
excludes: '', execCommand: '',
execTimeout: 120000,
flatten: false,
makeEmptyDirs: false,
noDefaultExcludes: false,
patternSeparator: '[, ]+',
remoteDirectory: '',
remoteDirectorySDF: false,
removePrefix: 'target',
sourceFiles: 'target/*.war')],
usePromotionTimestamp: false,
useWorkspaceInPromotion: false,
verbose: false)])
}
}*/
stage('Waiting for Approval'){
steps {
script {
slackSend channel: '#anz',
message: "Need Approval to deploy: JobName: ${env.JOB_NAME} BuildNumber: ${env.BUILD_NUMBER} and (<${env.BUILD_URL}input|Click here to approve>)",
color: 'good'
try {
timeout(time:30, unit:'MINUTES') {
env.APPROVE_SIT = input message: 'Deploy to SIT', ok: 'Continue',
parameters: [choice(name: 'APPROVE_SIT', choices: 'YES\nNO', description: 'Deploy from DEV?')]
if (env.APPROVE_SIT == 'YES')
{
env.DSIT = true
}
else
{
env.DSIT = false
}
}
} catch (error) {
env.DSIT = true
echo 'Timeout has been reached! Deploy to SIT automatically activated'
}
}
}
}
stage("Deploy to SIT Environment") {
steps {
sshPublisher(publishers: [sshPublisherDesc(configName: 'sitTomcat',
transfers: [sshTransfer(cleanRemote: false,
excludes: '', execCommand: '',
execTimeout: 120000,
flatten: false,
makeEmptyDirs: false,
noDefaultExcludes: false,
patternSeparator: '[, ]+',
remoteDirectory: '',
remoteDirectorySDF: false,
removePrefix: 'target',
sourceFiles: 'target/*.war')],
usePromotionTimestamp: false,
useWorkspaceInPromotion: false,
verbose: false)])
}
}
/* stage('deploy') {
steps {
sh 'cp /var/lib/jenkins/workspace/Hello-world/target/java-tomcat-maven-example.war /opt/tomcat-8.5/webapps/'
}
}
*/
/*stage("Quality Gate status") {
steps {
script {
def qualitygate = waitForQualityGate()
if (qualitygate.status != "OK") {
error "Pipeline aborted due to quality gate coverage failure: ${qualitygate.status}"
}
}
}
}
*/
/*stage("Quality Gate status") {
steps {
timeout(time: 1, unit: 'HOURS') {
waitForQualityGate abortPipeline: true
}
}
}
*/
}
}
You are visitor 01402792 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.