@@ -20,44 +20,62 @@ node('ubuntu') {
20
20
}
21
21
22
22
// update the versions in the toml file and package.json
23
- updateVersions(rust)
23
+ stage(' Updating Versions' ) {
24
+ updateVersions(rust)
25
+ }
24
26
25
27
// build and test the so file
26
- buildRust(rust)
28
+ stage (' Building Libvcx.so' ){
29
+ buildRust(rust)
30
+ }
27
31
28
32
// test rust
29
- testRust(rust)
33
+ stage (' Testing Rust' ){
34
+ testRust(rust)
35
+ }
30
36
31
37
// update the so file to have version
32
- updateSo(rust)
38
+ stage(' Updating .so file version' ) {
39
+ updateSo(rust)
40
+ }
33
41
34
42
// image used as an intermediary, where the libvcx.so is placed into /usr/lib.
35
43
// This image must be built after the rust build and tests have been run.
36
44
stage (' Build Libindy Image' ) {
37
45
libindy = build(' libindy' , ' vcx/ci/Dockerfile-libindy' , ' vcx' )
38
46
}
39
47
// test python wrapper, the image must be built after the libindy image build, and must be --no-cache
40
- stage (' Build Python and Node Images ' ) {
48
+ stage (' Build Python Image ' ) {
41
49
vcx_python = build(' vcx-python' , ' vcx/wrappers/python3/ci/Dockerfile-python-wrapper' , ' vcx' , ' --no-cache' )
42
50
}
43
- testPythonWrapper(vcx_python)
51
+
52
+ stage (" Testing Python Wrapper" ){
53
+ testPythonWrapper(vcx_python)
54
+ }
44
55
45
56
// test nodejs wrapper, the image must be built after the libindy image build, and must be --no-cache
46
- stage (' Build NodeJs Images' ) {
57
+ stage (' Build NodeJs Images' ) {
47
58
nodejs = build(' nodejs' , ' vcx/wrappers/node/ci/Dockerfile-nodejs' , ' vcx' )
48
59
vcx_nodejs = build(' vcx-nodejs' , ' vcx/wrappers/node/ci/Dockerfile-nodejs-wrapper' , ' vcx' , ' --no-cache' )
49
60
}
50
- testNodeWrapper(vcx_nodejs)
61
+
62
+ stage (' Test Node Wrapper' ){
63
+ testNodeWrapper(vcx_nodejs)
64
+ }
51
65
52
66
if (env. BRANCH_NAME == " master" ) {
53
67
// create the debian of the library (just the libvcx.so file)
54
- createDeb(rust)
68
+ stage(' Build libvcx Debian and compress .so file' ) {
69
+ createDeb(rust)
70
+ }
55
71
56
72
// create the npm deb
57
73
createNpmDeb(rust)
58
74
59
75
// create pip installable artifact
60
- createPtyhonArtifact(vcx_python, getVcxVersion(vcx_python))
76
+ stage (' Building Python Artifact' ) {
77
+ createPtyhonArtifact(vcx_python, getVcxVersion(vcx_python))
78
+ }
61
79
}
62
80
63
81
} catch (Exception ex) {
@@ -87,120 +105,104 @@ def getVcxVersion(envn){
87
105
}
88
106
89
107
def testPythonWrapper (envn ){
90
- stage (" Testing Python Wrapper" ){
91
- envn. inside {
92
- sh " python3 -m pytest"
93
- }
108
+ envn. inside {
109
+ sh " python3 -m pytest"
94
110
}
111
+
95
112
}
96
113
97
- def buildRust (envn ){
98
- stage (' Building Rust Library' ){
99
- envn. inside {
100
- sh " rustc --version"
101
- sh " gcc --version"
102
- sh " cd vcx/libvcx; cargo build --features ci --color=never"
103
- }
114
+ def buildRust (envn ){
115
+ envn. inside {
116
+ sh " rustc --version"
117
+ sh " gcc --version"
118
+ sh " cd vcx/libvcx; cargo build --features ci --color=never"
104
119
}
105
120
}
106
121
107
122
def testRust (envn ) {
108
- stage (' Testing Rust' ){
109
- sh " echo Testing"
110
- envn. inside {
111
- sh " cd vcx/libvcx; cargo test --color=never -- --test-threads=1"
112
- }
123
+ envn. inside {
124
+ sh " cd vcx/libvcx; cargo test --color=never -- --test-threads=1"
113
125
}
114
126
}
115
127
116
128
// Creates a tar.gz file that is installable from pip.
117
129
def createPtyhonArtifact (envn , version ) {
118
- stage (' Building Python Artifact' ) {
119
- dir(' vcx/wrappers/python3' ){
120
- sh ' echo Building Python Artifact'
121
- withEnv([" VCX_VERSION=${ version} " ]) {
122
- envn. inside {
123
- sh(
124
- script : " python3 setup.py sdist" ,
125
- returnStdout : true
126
- )
127
- archiveArtifacts allowEmptyArchive : true , artifacts : ' dist/**/*.tar.gz'
128
- }
130
+ dir(' vcx/wrappers/python3' ){
131
+ sh ' echo Building Python Artifact'
132
+ withEnv([" VCX_VERSION=${ version} " ]) {
133
+ envn. inside {
134
+ sh(
135
+ script : " python3 setup.py sdist" ,
136
+ returnStdout : true
137
+ )
138
+ archiveArtifacts allowEmptyArchive : true , artifacts : ' dist/**/*.tar.gz'
129
139
}
130
140
}
131
141
}
132
142
}
133
143
134
144
// Update the version and revision in the Cargo.toml file, also the so file .
135
145
def updateVersions (app ) {
136
- stage(' Updating Versions' ) {
137
- app. inside {
138
- sh ' ls -l'
139
- // TODO fix this ... these *SHOULD* be cargo commands.
140
- sh ' cd vcx/libvcx; ls -l; ls ../ci/scripts'
141
- sh ' cd vcx/libvcx; python ../ci/scripts/cargo-update-version'
146
+ app. inside {
147
+ sh ' ls -l'
148
+ // TODO fix this ... these *SHOULD* be cargo commands.
149
+ sh ' cd vcx/libvcx; ls -l; ls ../ci/scripts'
150
+ sh ' cd vcx/libvcx; python ../ci/scripts/cargo-update-version'
142
151
143
- }
144
- }
152
+ }
145
153
}
146
154
147
155
// Updates the libvcx.so file to libvcx<VER>.so
148
156
def updateSo (app ) {
149
- stage(' Updating .so file version' ) {
150
- app. inside {
151
- sh ' cd vcx/libvcx; python ../ci/scripts/cargo-update-so'
152
- }
157
+ app. inside {
158
+ sh ' cd vcx/libvcx; python ../ci/scripts/cargo-update-so'
153
159
}
154
160
}
155
161
156
162
// Creates the debian package for the library, as well as gzips the libvcx.so.<version> file
157
163
// Publishes both artifacts.
158
164
def createDeb (envn ) {
159
- stage(' Build libvcx Debian and compress .so file' ) {
160
- envn. inside {
161
- CERT_SCRIPT = ' vcx/ci/scripts/getCert.sh'
162
- SCRIPT = ' vcx/ci/scripts/gzip_so_file.py'
163
- FILES = ' vcx/libvcx/target/debug/libvcx.so.* vcx/libvcx/scripts/provision_agent_keys.py'
164
- DEST = ' libvcx.tar.gz'
165
-
166
- // get Evernym Certificate onto machine
167
- sh " ${ CERT_SCRIPT} "
168
-
169
- // build debian
170
- sh ' cd vcx/libvcx/; cargo deb --no-build'
171
-
165
+ envn. inside {
166
+ CERT_SCRIPT = ' vcx/ci/scripts/getCert.sh'
167
+ SCRIPT = ' vcx/ci/scripts/gzip_so_file.py'
168
+ FILES = ' vcx/libvcx/target/debug/libvcx.so.* vcx/libvcx/scripts/provision_agent_keys.py'
169
+ DEST = ' libvcx.tar.gz'
172
170
173
- if (env. BRANCH_NAME == " master" ) {
174
- // archive debian to Jenkins
175
- archiveArtifacts allowEmptyARchive : true , artifacts : " vcx/libvcx/target/debian/libvcx_*_amd64.deb"
171
+ // get Evernym Certificate onto machine
172
+ sh " ${ CERT_SCRIPT} "
173
+
174
+ // build debian
175
+ sh ' cd vcx/libvcx/; cargo deb --no-build'
176
176
177
- // archive .so file to Jenkins
178
- sh " python ${ SCRIPT} ${ FILES} ${ DEST} "
179
- archiveArtifacts allowEmptyARchive : true , artifacts : DEST
180
177
181
- // upload debian to Repo
182
- withCredentials([usernameColonPassword(credentialsId : ' jenkins-kraken-svc' , variable : ' KRAKEN_CREDENTIALS' )]) {
183
- sh " find vcx/libvcx/target/debian/ -type f -name 'libvcx_*_amd64.deb' -exec curl --cacert /tmp/cert/ca.crt -u \" ${ KRAKEN_CREDENTIALS} \" -X POST https://kraken.corp.evernym.com/repo/agency_dev/upload -F file=@{} \\ ;"
184
- sh " find vcx/libvcx/target/debian/ -type f -name 'libvcx_*_amd64.deb' -exec curl --cacert /tmp/cert/ca.crt -u \" ${ KRAKEN_CREDENTIALS} \" -X POST https://kraken.corp.evernym.com/repo/portal_dev/upload -F file=@{} \\ ;"
185
- }
178
+ if (env. BRANCH_NAME == " master" ) {
179
+ // archive debian to Jenkins
180
+ archiveArtifacts allowEmptyARchive : true , artifacts : " vcx/libvcx/target/debian/libvcx_*_amd64.deb"
181
+
182
+ // archive .so file to Jenkins
183
+ sh " python ${ SCRIPT} ${ FILES} ${ DEST} "
184
+ archiveArtifacts allowEmptyARchive : true , artifacts : DEST
185
+
186
+ // upload debian to Repo
187
+ withCredentials([usernameColonPassword(credentialsId : ' jenkins-kraken-svc' , variable : ' KRAKEN_CREDENTIALS' )]) {
188
+ sh " find vcx/libvcx/target/debian/ -type f -name 'libvcx_*_amd64.deb' -exec curl --cacert /tmp/cert/ca.crt -u \" ${ KRAKEN_CREDENTIALS} \" -X POST https://kraken.corp.evernym.com/repo/agency_dev/upload -F file=@{} \\ ;"
189
+ sh " find vcx/libvcx/target/debian/ -type f -name 'libvcx_*_amd64.deb' -exec curl --cacert /tmp/cert/ca.crt -u \" ${ KRAKEN_CREDENTIALS} \" -X POST https://kraken.corp.evernym.com/repo/portal_dev/upload -F file=@{} \\ ;"
186
190
}
187
191
}
188
192
}
189
193
}
190
194
191
195
// Creates the tgz file that can be 'npm install'-ed.
192
196
def testNodeWrapper (envn ) {
193
- stage (' Test Node Wrapper' ){
194
- dir(' vcx/wrappers/node' ){
195
- envn. inside() {
196
- sh ' npm install'
197
- sh ' npm -v'
198
- sh ' npm run lint'
199
- sh ' npm run compile'
200
- sh ' npm test'
201
- sh ' npm pack'
202
- archiveArtifacts allowEmptyArchive : true , artifacts : ' **/*.tgz'
203
- }
197
+ dir(' vcx/wrappers/node' ){
198
+ envn. inside() {
199
+ sh ' npm install'
200
+ sh ' npm -v'
201
+ sh ' npm run lint'
202
+ sh ' npm run compile'
203
+ sh ' npm test'
204
+ sh ' npm pack'
205
+ archiveArtifacts allowEmptyArchive : true , artifacts : ' **/*.tgz'
204
206
}
205
207
}
206
208
}
@@ -219,6 +221,7 @@ def createNpmDeb(app){
219
221
// upload npm module
220
222
sh " find wrappers/node/ -type f -name 'vcx-*.tgz' -exec curl --cacert /tmp/cert/ca.crt -u \" ${ KRAKEN_CREDENTIALS} \" -X POST https://kraken.corp.evernym.com/repo/agency_dev/upload -F file=@{} \\ ;"
221
223
sh " find wrappers/node/ -type f -name 'vcx-*.tgz' -exec curl --cacert /tmp/cert/ca.crt -u \" ${ KRAKEN_CREDENTIALS} \" -X POST https://kraken.corp.evernym.com/repo/portal_dev/upload -F file=@{} \\ ;"
224
+ sh " find wrappers/node/ -type f -name 'vcx-*.tgz' -exec curl --cacert /tmp/cert/ca.crt -u \" ${ KRAKEN_CREDENTIALS} \" -X POST https://kraken.corp.evernym.com/repo/npm/upload -F file = @{} \\ ;"
222
225
223
226
// upload debian
224
227
sh " find . -type f -name 'vcx_*_amd64.deb' -exec curl --cacert /tmp/cert/ca.crt -u \" ${ KRAKEN_CREDENTIALS} \" -X POST https://kraken.corp.evernym.com/repo/agency_dev/upload -F file=@{} \\ ;"
0 commit comments