Skip to content

Commit df48598

Browse files
committed
Merge remote-tracking branch 'hyperledger/master' into feature/ios-wrapper-refactoring
2 parents 4843b72 + 799fda4 commit df48598

File tree

5 files changed

+156
-135
lines changed

5 files changed

+156
-135
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
}

cli/README.md

Lines changed: 17 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ foundation for self-sovereign identity. It provides the commands to:
1010
### Binaries
1111
Pre-Built binaries can be downloaded from https://repo.sovrin.org/:
1212
* sdk/lib/apt/xenial/{master,stable,rc} - Ubuntu deb packages. Note that it depends on [libindy](../README.md) package
13-
* windows/indy-cli/{master,stable,rc} - Windows zip-archive with executable file and all required DLLs
13+
* windows/indy-cli/{master,stable,rc} - Windows zip-archive with executable file and all required DLLs
1414

1515
On Ubuntu it is recommended to install packages with APT (change stable to `master` or `rc` if needed):
1616
```
@@ -22,29 +22,35 @@ sudo apt-get install -y indy-cli
2222

2323
### Execution modes
2424
CLI supports 2 execution modes:
25-
* Interactive. In this mode CLI reads commands from terminal interactively. To start this mode just run `indy-cli` without params.
26-
* Batch. In this mode all commands will be read from text file or pipe and executed in series. To start this mode run `indy-cli <path-to-text-file>`. Batch mode supports the same commands as interactive mode. Note that by default if some command finishes with the error batch execution will be interrupted. To prevent this start command with `-`. For example, `-wallet create test`. In this case the result of this command will be ignored.
25+
* Interactive. In this mode CLI reads commands from terminal interactively. To start this mode just run `indy-cli`
26+
without params.
27+
* Batch. In this mode all commands will be read from text file or pipe and executed in series. To start this mode run
28+
`indy-cli <path-to-text-file>`. Batch mode supports the same commands as interactive mode. Note that by default if some
29+
command finishes with an error batch execution will be interrupted. To prevent this start command with `-`.
30+
For example, `-wallet create test`. In this case the result of this command will be ignored. Comments can also be made
31+
by beginning the line with a `#`.
2732

2833
### Getting help
29-
The most simple way is just start cli by `indy-cli` command and put `help` command. Also you can look to [Indy CLI Design](../doc/cli-design.md) doc that contains the list of commands and architecture overview.
34+
The most simple way is just start cli by `indy-cli` command and put `help` command. Also you can look to
35+
[Indy CLI Design](../doc/cli-design.md) doc that contains the list of commands and architecture overview.
3036

3137
### Old python-based CLI migration
32-
It is possible to import did's stored in the wallet of deprecated python-based CLI tool.
38+
It is possible to import did's stored in the wallet of deprecated python-based CLI tool.
3339
To achieve this user needs to perform the following steps:
34-
1. Execute script on machine with installed old python-based CLI.
40+
1. Execute script on machine with installed old python-based CLI.
3541
```
3642
indy_old_cli_export_dids [-e <env name>] -w <wallet name> [-f <path to the result file>]
3743
```
38-
This script will export DIDs stored in specified wallet into the result file.
39-
By default, this file creates in current folder and has the following name:
44+
This script will export DIDs stored in specified wallet into the result file.
45+
By default, this file creates in current folder and has the following name:
4046
```
4147
<env name>_<wallet name>.exp_wallet
4248
```
4349
2. [Install Indy-Cli](#binaries)
4450
3. Import generated file into libindy wallet by using Indy CLI
45-
* Run Indy CLI
51+
* Run Indy CLI
4652
* Open new target wallet (create if needed) in CLI
47-
* Run
53+
* Run
4854
```
4955
did import <path to the file created on first step>
50-
```
56+
```

cli/src/main.rs

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -157,6 +157,12 @@ fn _iter_batch<T>(command_executor: CommandExecutor, reader: T) where T: std::io
157157
let line = if let Ok(line) = line { line } else {
158158
return println_err!("Can't parse line #{}", line_num);
159159
};
160+
161+
if line.starts_with("#") || line.is_empty() {
162+
// Skip blank lines and lines starting with #
163+
continue;
164+
}
165+
160166
println!("{}", line);
161167
let (line, force) = if line.starts_with("-") {
162168
(line[1..].as_ref(), true)

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)