-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathJenkinsfile
50 lines (46 loc) · 2.06 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
def userId = slackUserIdFromEmail("${BUILD_USER_EMAIL}")
pipeline {
agent any
tools {
maven 'maven-3.6.3'
}
stages {
stage('New Build') {
steps {
echo "The build number is ${env.BUILD_NUMBER}"
slackSend color: 'good', message: "Hi <@$userId> your build has started and url is ${env.BUILD_URL}"
sh 'mvn clean package'
}
}
stage('Test') {
steps {
echo 'Testing..'
}
}
stage('Moving jar to GCS BUCKET') {
steps {
withEnv(['GCLOUD_PATH=/usr/lib/google-cloud-sdk/bin']) {
slackSend color: 'good', message: "Moving fat jar to gcs"
sh '$GCLOUD_PATH/gsutil cp /bitnami/jenkins/home/workspace/gcp-batch-raw-ingestion-scala/target/gcp-batch-raw-ingestion-scala-jar-with-dependencies.jar gs://bronze-poc-group/gcp-batch-raw-ingestion-scala/'
}
}
}
stage('Running Dag with airflow') {
steps {
withEnv(['GCLOUD_PATH=/usr/lib/google-cloud-sdk/bin']) {
slackSend color: 'good', message: "Running gcloud spark command"
//sh '$GCLOUD_PATH/gcloud dataproc jobs submit spark --cluster=cluster-e7b7 --region=us-central1 --class=org.example.hello --jars=gs://dataproc_ravi_poc/spark_jar/spark-scala-etl-1.0-SNAPSHOT-jar-with-dependencies.jar'
sh '$GCLOUD_PATH/gcloud composer environments run data-generator-demo --location us-central1 dags trigger -- gcp-batch-raw-ingestion-scala'
}
}
}
}
post {
success {
slackSend color: 'good', message: "Hi <@$userId> Airflow dag is trigged please check the ui"
}
failure {
slackSend color: 'danger', message: "Hi <@$userId> your build has failed pleas check ${env.BUILD_URL}"
}
}
}