Skip to content

Commit cf5391f

Browse files
authored
Merge pull request hyperledger-indy#676 from jovfer/hotfix/windows_pipeline_custom_ws
Use custom Jenkins workspace for windows testing.
2 parents 2429e0c + 44e5348 commit cf5391f

File tree

3 files changed

+133
-124
lines changed

3 files changed

+133
-124
lines changed

Jenkinsfile.cd

Lines changed: 69 additions & 64 deletions
Original file line numberDiff line numberDiff line change
@@ -243,88 +243,93 @@ def linuxTesting(file, env_name, run_interoperability_tests, network_name, stash
243243
def windowsTesting() {
244244
node('win2016') {
245245
stage('Windows Test') {
246-
echo "Windows Test: Checkout scm"
247-
checkout scm
246+
def ws_path = "workspace/${env.JOB_NAME}".replace(' ', '_')
247+
ws(ws_path) {
248+
try {
249+
echo "Windows Test: Checkout scm"
250+
checkout scm
248251

249-
try {
250-
echo "Windows Test: Run Indy pool"
251-
bat "docker -H $INDY_SDK_SERVER_IP build --build-arg pool_ip=$INDY_SDK_SERVER_IP -f ci/indy-pool.dockerfile -t indy_pool ci"
252-
bat "docker -H $INDY_SDK_SERVER_IP run -d --network host --name indy_pool -p 9701-9708:9701-9708 indy_pool"
253252

254-
setupRust()
253+
echo "Windows Test: Run Indy pool"
254+
bat "docker -H $INDY_SDK_SERVER_IP build --build-arg pool_ip=$INDY_SDK_SERVER_IP -f ci/indy-pool.dockerfile -t indy_pool ci"
255+
bat "docker -H $INDY_SDK_SERVER_IP run -d --network host --name indy_pool -p 9701-9708:9701-9708 indy_pool"
255256

256-
dir('libindy') {
257-
echo "Windows Test: Download prebuilt dependencies"
258-
bat 'wget -O prebuilt.zip "https://repo.sovrin.org/windows/libindy/deps/indy-sdk-deps.zip"'
259-
bat 'unzip prebuilt.zip -d prebuilt'
260-
261-
echo "Windows Libindy Test: Build"
262-
withEnv([
263-
"INDY_PREBUILT_DEPS_DIR=$WORKSPACE\\libindy\\prebuilt",
264-
"INDY_CRYPTO_PREBUILT_DEPS_DIR=$WORKSPACE\\libindy\\prebuilt",
265-
"MILAGRO_DIR=$WORKSPACE\\libindy\\prebuilt",
266-
"LIBZMQ_PREFIX=$WORKSPACE\\libindy\\prebuilt",
267-
"SODIUM_LIB_DIR=$WORKSPACE\\libindy\\prebuilt",
268-
"OPENSSL_DIR=$WORKSPACE\\libindy\\prebuilt",
269-
"PATH=$WORKSPACE\\libindy\\prebuilt\\lib;$PATH",
270-
"RUST_BACKTRACE=1"
271-
]) {
272-
bat "cargo test --release --no-run"
273-
274-
echo "Windows Libindy Test: Run tests"
257+
setupRust()
258+
259+
dir('libindy') {
260+
echo "Windows Test: Download prebuilt dependencies"
261+
bat 'wget -O prebuilt.zip "https://repo.sovrin.org/windows/libindy/deps/indy-sdk-deps.zip"'
262+
bat 'unzip prebuilt.zip -d prebuilt'
263+
264+
echo "Windows Libindy Test: Build"
275265
withEnv([
276-
"RUST_TEST_THREADS=1",
277-
"RUST_LOG=trace",
278-
"TEST_POOL_IP=$INDY_SDK_SERVER_IP"
266+
"INDY_PREBUILT_DEPS_DIR=$WORKSPACE\\libindy\\prebuilt",
267+
"INDY_CRYPTO_PREBUILT_DEPS_DIR=$WORKSPACE\\libindy\\prebuilt",
268+
"MILAGRO_DIR=$WORKSPACE\\libindy\\prebuilt",
269+
"LIBZMQ_PREFIX=$WORKSPACE\\libindy\\prebuilt",
270+
"SODIUM_LIB_DIR=$WORKSPACE\\libindy\\prebuilt",
271+
"OPENSSL_DIR=$WORKSPACE\\libindy\\prebuilt",
272+
"PATH=$WORKSPACE\\libindy\\prebuilt\\lib;$PATH",
273+
"RUST_BACKTRACE=1"
279274
]) {
280-
bat "cargo test --release"
275+
bat "cargo test --release --no-run"
276+
277+
echo "Windows Libindy Test: Run tests"
278+
withEnv([
279+
"RUST_TEST_THREADS=1",
280+
"RUST_LOG=trace",
281+
"TEST_POOL_IP=$INDY_SDK_SERVER_IP"
282+
]) {
283+
bat "cargo test --release"
284+
}
281285
}
286+
stash includes: 'target/release/*.dll', name: 'LibindyWindowsBuildResult'
282287
}
283-
stash includes: 'target/release/*.dll', name: 'LibindyWindowsBuildResult'
284-
}
285-
286-
dir('cli') {
287-
bat "sed -i -e \"s/10\\.0\\.0\\.2/${INDY_SDK_SERVER_IP}/g\" docker_pool_transactions_genesis"
288288

289-
bat "copy $WORKSPACE\\libindy\\target\\release\\indy.dll $WORKSPACE\\libindy\\prebuilt\\lib"
290-
bat "copy $WORKSPACE\\libindy\\target\\release\\indy.lib $WORKSPACE\\libindy\\prebuilt\\lib"
289+
dir('cli') {
290+
bat "sed -i -e \"s/10\\.0\\.0\\.2/${INDY_SDK_SERVER_IP}/g\" docker_pool_transactions_genesis"
291291

292-
echo "Windows Indy Cli Test: Build"
293-
withEnv([
294-
"INDY_DIR=$WORKSPACE\\libindy\\prebuilt",
295-
"RUST_BACKTRACE=1"
296-
]) {
297-
bat "cargo build --release"
292+
bat "copy $WORKSPACE\\libindy\\target\\release\\indy.dll $WORKSPACE\\libindy\\prebuilt\\lib"
293+
bat "copy $WORKSPACE\\libindy\\target\\release\\indy.lib $WORKSPACE\\libindy\\prebuilt\\lib"
298294

299-
echo "Windows Indy Cli Test: Build tests"
300-
bat "cargo test --release --no-run"
301-
302-
echo "Windows Indy Cli Test: Run tests"
295+
echo "Windows Indy Cli Test: Build"
303296
withEnv([
304-
"RUST_TEST_THREADS=1",
305-
"RUST_LOG=trace",
306-
"TEST_POOL_IP=$INDY_SDK_SERVER_IP"
297+
"INDY_DIR=$WORKSPACE\\libindy\\prebuilt",
298+
"RUST_BACKTRACE=1"
307299
]) {
308-
bat "cargo test --release"
300+
bat "cargo build --release"
301+
302+
echo "Windows Indy Cli Test: Build tests"
303+
bat "cargo test --release --no-run"
304+
305+
echo "Windows Indy Cli Test: Run tests"
306+
withEnv([
307+
"RUST_TEST_THREADS=1",
308+
"RUST_LOG=trace",
309+
"TEST_POOL_IP=$INDY_SDK_SERVER_IP"
310+
]) {
311+
bat "cargo test --release"
312+
}
309313
}
310-
}
311314

312-
stash includes: 'target/release/indy-cli.exe,target/release/*.dll', name: 'IndyCliWindowsBuildResult'
313-
}
315+
stash includes: 'target/release/indy-cli.exe,target/release/*.dll', name: 'IndyCliWindowsBuildResult'
316+
}
314317

315-
//TODO wrappers testing
318+
//TODO wrappers testing
316319

317-
} finally {
318-
try {
319-
bat "docker -H $INDY_SDK_SERVER_IP stop indy_pool"
320-
} catch (ignore) {
321-
}
322-
try {
323-
bat "docker -H $INDY_SDK_SERVER_IP rm indy_pool"
324-
} catch (ignore) {
320+
} finally {
321+
try {
322+
bat "docker -H $INDY_SDK_SERVER_IP stop indy_pool"
323+
} catch (ignore) {
324+
}
325+
try {
326+
bat "docker -H $INDY_SDK_SERVER_IP rm indy_pool"
327+
} catch (ignore) {
328+
}
329+
cleanWs()
325330
}
326-
step([$class: 'WsCleanup'])
327331
}
332+
cleanWs()
328333
}
329334
}
330335
}

Jenkinsfile.ci

Lines changed: 62 additions & 58 deletions
Original file line numberDiff line numberDiff line change
@@ -17,82 +17,86 @@ def testing() {
1717
def windowsTesting() {
1818
node('win2016') {
1919
stage('Windows Test') {
20-
echo "Windows Test: Checkout scm"
21-
checkout scm
20+
def ws_path = "workspace/${env.JOB_NAME}".replace(' ', '_')
21+
ws(ws_path) {
22+
try {
23+
echo "Windows Test: Checkout scm"
24+
checkout scm
2225

23-
try {
24-
echo "Windows Test: Run Indy pool"
25-
bat "docker -H $INDY_SDK_SERVER_IP build --build-arg pool_ip=$INDY_SDK_SERVER_IP -f ci/indy-pool.dockerfile -t indy_pool ci"
26-
bat "docker -H $INDY_SDK_SERVER_IP run -d --network host --name indy_pool -p 9701-9708:9701-9708 indy_pool"
26+
echo "Windows Test: Run Indy pool"
27+
bat "docker -H $INDY_SDK_SERVER_IP build --build-arg pool_ip=$INDY_SDK_SERVER_IP -f ci/indy-pool.dockerfile -t indy_pool ci"
28+
bat "docker -H $INDY_SDK_SERVER_IP run -d --network host --name indy_pool -p 9701-9708:9701-9708 indy_pool"
2729

28-
setupRust()
30+
setupRust()
2931

30-
dir('libindy') {
31-
echo "Windows Test: Download prebuilt dependencies"
32-
bat 'wget -O prebuilt.zip "https://repo.sovrin.org/windows/libindy/deps/indy-sdk-deps.zip"'
33-
bat 'unzip prebuilt.zip -d prebuilt'
34-
35-
echo "Windows Libindy Test: Build"
36-
withEnv([
37-
"INDY_PREBUILT_DEPS_DIR=$WORKSPACE\\libindy\\prebuilt",
38-
"INDY_CRYPTO_PREBUILT_DEPS_DIR=$WORKSPACE\\libindy\\prebuilt",
39-
"MILAGRO_DIR=$WORKSPACE\\libindy\\prebuilt",
40-
"LIBZMQ_PREFIX=$WORKSPACE\\libindy\\prebuilt",
41-
"SODIUM_LIB_DIR=$WORKSPACE\\libindy\\prebuilt",
42-
"OPENSSL_DIR=$WORKSPACE\\libindy\\prebuilt",
43-
"PATH=$WORKSPACE\\libindy\\prebuilt\\lib;$PATH",
44-
"RUST_BACKTRACE=1"
45-
]) {
46-
bat "cargo test --no-run"
47-
48-
echo "Windows Libindy Test: Run tests"
32+
dir('libindy') {
33+
echo "Windows Test: Download prebuilt dependencies"
34+
bat 'wget -O prebuilt.zip "https://repo.sovrin.org/windows/libindy/deps/indy-sdk-deps.zip"'
35+
bat 'unzip prebuilt.zip -d prebuilt'
36+
37+
echo "Windows Libindy Test: Build"
4938
withEnv([
50-
"RUST_TEST_THREADS=1",
51-
"RUST_LOG=trace",
52-
"TEST_POOL_IP=$INDY_SDK_SERVER_IP"
39+
"INDY_PREBUILT_DEPS_DIR=$WORKSPACE\\libindy\\prebuilt",
40+
"INDY_CRYPTO_PREBUILT_DEPS_DIR=$WORKSPACE\\libindy\\prebuilt",
41+
"MILAGRO_DIR=$WORKSPACE\\libindy\\prebuilt",
42+
"LIBZMQ_PREFIX=$WORKSPACE\\libindy\\prebuilt",
43+
"SODIUM_LIB_DIR=$WORKSPACE\\libindy\\prebuilt",
44+
"OPENSSL_DIR=$WORKSPACE\\libindy\\prebuilt",
45+
"PATH=$WORKSPACE\\libindy\\prebuilt\\lib;$PATH",
46+
"RUST_BACKTRACE=1"
5347
]) {
54-
bat "cargo test"
48+
bat "cargo test --no-run"
49+
50+
echo "Windows Libindy Test: Run tests"
51+
withEnv([
52+
"RUST_TEST_THREADS=1",
53+
"RUST_LOG=trace",
54+
"TEST_POOL_IP=$INDY_SDK_SERVER_IP"
55+
]) {
56+
bat "cargo test"
57+
}
5558
}
5659
}
57-
}
58-
59-
dir('cli') {
60-
bat "sed -i -e \"s/10\\.0\\.0\\.2/${INDY_SDK_SERVER_IP}/g\" docker_pool_transactions_genesis"
6160

62-
bat "copy $WORKSPACE\\libindy\\target\\debug\\indy.dll $WORKSPACE\\libindy\\prebuilt\\lib"
63-
bat "copy $WORKSPACE\\libindy\\target\\debug\\indy.lib $WORKSPACE\\libindy\\prebuilt\\lib"
61+
dir('cli') {
62+
bat "sed -i -e \"s/10\\.0\\.0\\.2/${INDY_SDK_SERVER_IP}/g\" docker_pool_transactions_genesis"
6463

65-
echo "Windows Indy Cli Test: Build"
66-
withEnv([
67-
"INDY_DIR=$WORKSPACE\\libindy\\prebuilt",
68-
"RUST_BACKTRACE=1"
69-
]) {
70-
bat "cargo test --no-run"
64+
bat "copy $WORKSPACE\\libindy\\target\\debug\\indy.dll $WORKSPACE\\libindy\\prebuilt\\lib"
65+
bat "copy $WORKSPACE\\libindy\\target\\debug\\indy.lib $WORKSPACE\\libindy\\prebuilt\\lib"
7166

72-
echo "Windows Indy Cli Test: Run tests"
67+
echo "Windows Indy Cli Test: Build"
7368
withEnv([
74-
"RUST_TEST_THREADS=1",
75-
"RUST_LOG=trace",
76-
"TEST_POOL_IP=$INDY_SDK_SERVER_IP"
69+
"INDY_DIR=$WORKSPACE\\libindy\\prebuilt",
70+
"RUST_BACKTRACE=1"
7771
]) {
78-
bat "cargo test"
72+
bat "cargo test --no-run"
73+
74+
echo "Windows Indy Cli Test: Run tests"
75+
withEnv([
76+
"RUST_TEST_THREADS=1",
77+
"RUST_LOG=trace",
78+
"TEST_POOL_IP=$INDY_SDK_SERVER_IP"
79+
]) {
80+
bat "cargo test"
81+
}
7982
}
8083
}
81-
}
8284

83-
//TODO wrappers testing
85+
//TODO wrappers testing
8486

85-
} finally {
86-
try {
87-
bat "docker -H $INDY_SDK_SERVER_IP stop indy_pool"
88-
} catch (ignore) {
89-
}
90-
try {
91-
bat "docker -H $INDY_SDK_SERVER_IP rm indy_pool"
92-
} catch (ignore) {
87+
} finally {
88+
try {
89+
bat "docker -H $INDY_SDK_SERVER_IP stop indy_pool"
90+
} catch (ignore) {
91+
}
92+
try {
93+
bat "docker -H $INDY_SDK_SERVER_IP rm indy_pool"
94+
} catch (ignore) {
95+
}
96+
cleanWs()
9397
}
94-
step([$class: 'WsCleanup'])
9598
}
99+
cleanWs()
96100
}
97101
}
98102
}

libindy/build.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,8 +15,8 @@ fn main() {
1515
let prebuilt_lib = Path::new(&prebuilt_dir[..]).join("lib");
1616

1717
println!("cargo:rustc-link-search=native={}", prebuilt_dir);
18-
println!("cargo:rustc-flags=-L {}/lib", prebuilt_dir);
19-
println!("cargo:include={}/include", prebuilt_dir);
18+
println!("cargo:rustc-flags=-L {}\\lib", prebuilt_dir);
19+
println!("cargo:include={}\\include", prebuilt_dir);
2020

2121
let files = vec!["libeay32md.dll", "libsodium.dll", "libzmq.dll", "ssleay32md.dll"];
2222
for f in files.iter() {

0 commit comments

Comments
 (0)