-
Notifications
You must be signed in to change notification settings - Fork 142
Expand file tree
/
Copy pathJenkinsfile
More file actions
80 lines (72 loc) · 2.29 KB
/
Jenkinsfile
File metadata and controls
80 lines (72 loc) · 2.29 KB
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
// pipeline {
// agent any
// tools {
// maven "MAVEN"
// jdk "JDK"
// }
// environment {
// NEXUS_VERSION = "nexus3" // Nexus 3 or Nexus 2
// NEXUS_PROTOCOL = "http" // HTTP or HTTPS
// NEXUS_URL = "13.126.159.57:8081" // Nexus Server IP and Port
// NEXUS_REPOSITORY = "logicwebapp" // Nexus Repository Name
// NEXUS_CREDENTIAL_ID = "Nexus" // Jenkins Credential ID for Nexus
// ARTIFACT_VERSION = "${BUILD_NUMBER}" // Versioning
// GROUP_ID = "com/psrinivas"
// ARTIFACT_ID = "loginwebapp"
// }
// stages {
// stage("Checkout Code") {
// steps {
// script {
// git branch: 'feature/nexusUpload', url: 'https://github.com/PSRINVAS-729/LoginWebApp.git'
// }
// }
// }
// stage("Maven Build") {
// steps {
// sh "mvn clean install"
// }
// }
// stage("Upload Artifact to Nexus") {
// steps {
// withCredentials([usernamePassword(credentialsId: 'Nexus', usernameVariable: 'NEXUS_USER', passwordVariable: 'NEXUS_PASS')]) {
// sh """
// curl -v -u ${NEXUS_USER}:${NEXUS_PASS} --upload-file target/LoginWebApp.war ${NEXUS_URL}/repository/${NEXUS_REPOSITORY}/${GROUP_ID}/${ARTIFACT_ID}/${ARTIFACT_VERSION}/${ARTIFACT_ID}-${ARTIFACT_VERSION}.war
// """
// }
// }
// }
// }
// }
// s3 upload
pipeline {
agent any
tools {
maven "MAVEN"
jdk "JDK"
}
environment {
S3_BUCKET = "jenkinss322"
AWS_REGION = "ap-south-1" // Change based on your region
AWS_CREDENTIALS_ID = "s3"
}
stages {
stage("Checkout Code") {
steps {
git branch: 'feature/nexusUpload', url: 'https://github.com/PSRINVAS-729/LoginWebApp.git'
}
}
stage("Maven Build") {
steps {
sh "mvn clean install"
}
}
stage("Upload to S3") {
steps {
withAWS(credentials: 's3', region: "${AWS_REGION}") {
sh "whoami"
}
}
}
}
}