-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathJenkinsfile
55 lines (50 loc) · 1.6 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
pipeline {
agent any
stages {
stage('Build') {
steps {
// Build your project
sh 'mvn clean package'
}
}
stage('Generate JAR') {
steps {
// Archive the jar file as an artifact
archiveArtifacts artifacts: 'target/*.jar', onlyIfSuccessful: true
}
}
stage('Deploy to Airflow') {
steps {
sh 'rm $AIRFLOW_HOME/jars/*'
sh 'mv target/elt.jar $AIRFLOW_HOME/jars'
sh 'rm -rf $AIRFLOW_HOME/dbt'
sh 'mv dbt $AIRFLOW_HOME'
sh 'mv airflow_dags/* $AIRFLOW_HOME/dags'
}
}
}
post {
success {
mail to: "[email protected]",
subject: "Jenkins Build Successful: ${env.JOB_NAME} [${env.BUILD_NUMBER}]",
body: """
Hello,
\tThe Jenkins build for ${env.JOB_NAME} [${env.BUILD_NUMBER}] was successful.
\tYou can view the build details and console output at ${env.BUILD_URL}
Thank you,
Jenkins
"""
}
failure {
mail to: "[email protected]",
subject: "Jenkins Build Failed: ${env.JOB_NAME} [${env.BUILD_NUMBER}]",
body: """
Hello,
\tThe Jenkins build for ${env.JOB_NAME} [${env.BUILD_NUMBER}] has failed.
\tYou can view the build details and console output at ${env.BUILD_URL}
Thank you,
Jenkins
"""
}
}
}