-
Notifications
You must be signed in to change notification settings - Fork 0
/
Jenkinsfile
82 lines (80 loc) · 2.37 KB
/
Jenkinsfile
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
pipeline {
agent any
environment {
MAJOR_VERSION = 1
BUCKET = credentials('jenkins-aws-s3-spinnaker-demo-bucket')
}
stages {
stage('build') {
steps {
emailext(
subject: " NEW RELEASE of Test",
body: """<p>'${env.BUCKET}' NEW RELEASE":</p>
<p>Check console output at <a href='${env.BUCKET}</a></p>""",
to: "scampuza@gmail.com"
)
echo "El cubo es ${env.BUCKET}"
sh 'javac -d . src/*.java'
sh 'echo Main-Class: Rectangulator > MANIFEST.MF'
sh 'jar -cvmf MANIFEST.MF rectangle.jar *.class'
}
post {
success {
archiveArtifacts artifacts: 'rectangle.jar', fingerprint: true
}
}
}
stage('run') {
steps {
sh 'java -jar rectangle.jar 7 9'
}
}
stage('Promote Development to Master') {
when {
branch 'development'
}
steps {
echo "Stashing Local Changes"
sh "git stash"
echo "Checking Out Development"
sh 'git checkout development'
sh 'git pull origin'
echo 'Checking Out Master'
sh 'git checkout master'
echo "Merging Development into Master"
sh 'git merge development'
echo "Git Push to Origin"
sh 'git push origin master'
}
post {
success {
emailext(
subject: "${env.JOB_NAME} [${env.BUILD_NUMBER}] Development Promoted to Master",
body: """<p>'${env.JOB_NAME} [${env.BUILD_NUMBER}]' Development Promoted to Master":</p>
<p>Check console output at <a href='${env.BUILD_URL}'>${env.JOB_NAME} [${env.BUILD_NUMBER}]</a></p>""",
to: "scampuza@gmail.com"
)
}
}
}
stage('Tagging the Release') {
when {
branch 'master'
}
steps {
sh "git tag rectangle-${env.MAJOR_VERSION}.${BUILD_NUMBER}"
sh "git push origin rectangle-${env.MAJOR_VERSION}.${BUILD_NUMBER}"
}
post {
success {
emailext(
subject: "${env.JOB_NAME} [${env.BUILD_NUMBER}] NEW RELEASE",
body: """<p>'${env.JOB_NAME} [${env.BUILD_NUMBER}]' NEW RELEASE":</p>
<p>Check console output at <a href='${env.BUILD_URL}'>${env.JOB_NAME} [${env.BUILD_NUMBER}]</a></p>""",
to: "scampuza@gmail.com"
)
}
}
}
}
}