-
Notifications
You must be signed in to change notification settings - Fork 81
/
deploy.jenkinsfile
91 lines (89 loc) · 3.73 KB
/
deploy.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
83
84
85
86
87
88
89
90
91
pipeline {
agent {
node {
label 'hops-master-local'
}
}
stages {
stage ('build dal') {
steps {
dir("${WORKSPACE}/../hops_testing/dal"){
sh """
pwd
git clone [email protected]:hopshadoop/hops-metadata-dal.git
"""
}
dir("${WORKSPACE}/../hops_testing/dal/hops-metadata-dal"){
sh """
pwd
git fetch
git checkout ${params.BRANCH}
git pull
mvn clean install deploy -DskipTests
"""
}
}
}
stage('build and deploy dal impl'){
steps {
dir("${WORKSPACE}/../hops_testing/dal"){
sh """
pwd
git clone [email protected]:hopshadoop/hops-metadata-dal-impl-ndb.git
"""
}
dir("${WORKSPACE}/../hops_testing/dal/hops-metadata-dal-impl-ndb"){
sh """
pwd
git fetch
git checkout ${params.BRANCH}
git pull
# set to empty to run in non interactive mode
export DOCKER_INTERACTIVE_RUN=
./start-build-env.sh mvn clean install deploy assembly:assembly -DskipTests
"""
script {
RONDB_VERSION = sh (
script: 'mvn -Dmaven.repo.local=${WORKSPACE}/../hops_testing/.m2_${SUFFIX} dependency:tree | grep "com\\.mysql\\.ndb\\:clusterj-rondb" | cut -d":" -f 4 | uniq',
returnStdout: true
).trim()
echo "RONDB_VERSION: ${RONDB_VERSION}"
HOPS_VERSION = sh (
script: 'mvn -q -Dexec.executable="echo" -Dexec.args=\'${project.version}\' --non-recursive exec:exec',
returnStdout: true
).trim()
echo "HOPS_VERSION: ${HOPS_VERSION}"
echo "Deploying Hops - NDB connector...."
sh """
scp -i ~/.ssh/id_rsa3 target/hops-metadata-dal-impl-ndb-${HOPS_VERSION}-jar-with-dependencies.jar [email protected]:/opt/repository/master//ndb-dal-${HOPS_VERSION}-${RONDB_VERSION}.jar
"""
echo "Deploying Hops Schema...."
sh """
scp -i ~/.ssh/id_rsa3 schema/update-schema* [email protected]:/opt/repository/master//hops-schemas/
"""
}
}
}
}
stage('build and deploy hops'){
steps{
sh """
# set to empty to run in non interactive mode
export DOCKER_INTERACTIVE_RUN=
./start-build-env.sh mvn clean generate-sources install deploy -Pdist,native -Dtar -DskipTests -Dmaven.javadoc.skip=true -nsu
scp -i ~/.ssh/id_rsa3 ./hadoop-dist/target/hadoop-${HOPS_VERSION}.tar.gz [email protected]:/opt/repository/master/hops-${HOPS_VERSION}.tgz
"""
}
}
}
post {
always{
script{
sh """
git reset --hard origin/${params.BRANCH}
rm -rf "${WORKSPACE}/../hops_testing/dal"
"""
}
}
}
}