Skip to content

Commit

Permalink
Merge pull request #309 from sovrin-foundation/master
Browse files Browse the repository at this point in the history
adding CD fixes to stable
  • Loading branch information
mac-arrap authored Sep 18, 2018
2 parents 86bab8c + 6aee883 commit c6a41d9
Show file tree
Hide file tree
Showing 19 changed files with 192 additions and 117 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ libsovtoken/build_scripts/android/libsovtoken/linux-arm64/
libsovtoken/build_scripts/android/libsovtoken/linux-x86/
libsovtoken/build_scripts/android/libsovtoken/linux-x86_64/
devops/_build
libsovtoken/.macosbuild/

# Mac directory attributes
*.DS_Store
Expand Down
9 changes: 8 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,11 @@
# Changelog
## 0.9.3
* Changed CI/CD to new stable branch.
* CD added to the new stable branch with new stable release process
* Source code is now public Sovrin repository
* changed base-58 library dependency.
* changed rust-indy-sdk dependency to rust crate
* bugfixes

## 0.9.2
* Android and iOS builds in CD pipeline
Expand Down Expand Up @@ -35,4 +42,4 @@ Note: This release requires the user to have libindy installed locally from [the


## 0.7.0
Initial release
Initial release
2 changes: 1 addition & 1 deletion devops/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ FPM_P_VENDOR := Evernym
FPM_P_DESCRIPTION := libsovtoken writen in Rust
FPM_P_NAME = $(PACKAGE_NAME)
FPM_P_VERSION ?= $(SRC_VERSION)
FPM_P_DEPENDS = libindy
FPM_P_DEPENDS = libindy(=1.6.6)
FPM_P_OUTPUT_DIR = $(LIB_TARGET_DIR)
FPM_ARGS = $(LIB_DYNAMIC)=/usr/lib/

Expand Down
48 changes: 17 additions & 31 deletions devops/aws-codebuild/Jenkinsfile.cd
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#!groovy

def evLibrary = library(identifier: 'evernym-aws-codebuild@aws-codebuild', retriever: modernSCM(
def evLibrary = library(identifier: 'evernym-aws-codebuild@v0.3.0-aws-codebuild', retriever: modernSCM(
github(credentialsId: 'evernym-github-machine-user', repoOwner: 'evernym', repository: 'jenkins-shared')
)).com.evernym.pipeline

Expand All @@ -19,6 +19,10 @@ def nodeLabels = [
def codeBuildPipelines = {
def packageName = 'libsovtoken'

//put code build containers inside a vpc under our dev account
env.USE_VPC_CONFIG = true
env.SOVRIN_REPO_HOST = '192.168.11.115'

List _envBuildSrc = [
'devops',
'libsovtoken/Cargo.toml',
Expand Down Expand Up @@ -210,11 +214,14 @@ def codeBuildPipelines = {
}

if (env.BRANCH_NAME == 'stable') {
logger.info("Uploading debian package '$debName' to sovrin repo")
SovrinRepo.upload {
repoDistr = 'sdk'
packagePath = debName
}
logger.info("Uploading debian package '$debName' to sovrin repo")
sshagent(credentials: ['SovrinRepoSSHKey']) {
sovrinRepo.upload {
repoDistr = 'sdk'
packagePath = debName
component = 'rc'
}
}
}
}

Expand Down Expand Up @@ -301,33 +308,9 @@ def macOSPipeline = {
dir('libsovtoken/build_scripts/ios/mac/') {

stage('mac.01.libindy.setup') {
sh './mac.01.libindy.setup.sh'
}

stage('mac.02.libindy.env.sh') {
sh ". mac.02.libindy.env.sh"
sh './mac.01.env.setup.sh'
}

stage('mac.03.libindy.build.sh') {
try {
sh "./mac.03.libindy.build.sh"
} catch ( exc ) {
logger.info("Stage 'mac.03' failed with exception ${exc}. So we run additional steps.")

stage('mac.08.libssl.libcrypto.build.sh') {
sh "./mac.08.libssl.libcrypto.build.sh"
}

stage('mac.09.libzmq.libsodium.build.sh') {
sh "./mac.09.libzmq.libsodium.build.sh"
}

stage('mac.10.libminiz.libsqlite3.combine.sh') {
sh "./mac.10.libminiz.libsqlite3.combine.sh"
}
}
}

stage('mac.14.libsovtoken.build.sh') {
sh "./mac.14.libsovtoken.build.sh"
}
Expand All @@ -352,6 +335,9 @@ def macOSPipeline = {
}

pipelineWrapper({
//put code build containers inside a vpc under our dev account
env.USE_VPC_CONFIG = true

Map builds = [
codeBuild: [
build: codeBuildPipelines,
Expand Down
13 changes: 8 additions & 5 deletions devops/aws-codebuild/Jenkinsfile.ci
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#!groovy

def evLibrary = library(identifier: 'evernym-aws-codebuild@aws-codebuild', retriever: modernSCM(
def evLibrary = library(identifier: 'evernym-aws-codebuild@v0.3.0-aws-codebuild', retriever: modernSCM(
github(credentialsId: 'evernym-github-machine-user', repoOwner: 'evernym', repository: 'jenkins-shared')
)).com.evernym.pipeline

Expand All @@ -22,6 +22,9 @@ pipelineWrapper({
]
List goals = ['test_dry', 'test']

//put code build containers inside a vpc under our dev account
env.USE_VPC_CONFIG = true

stage('Checkout from SCM') {
checkout scm
}
Expand Down Expand Up @@ -51,13 +54,13 @@ pipelineWrapper({
// not accurate (it concatenates them):
// debian package version: <src_version>+<release_version>
// debian package name: <src_version><release_version>
def sovtoken_deb_version = "0.9.21.94"
def sovtokenfees_deb_version = "0.9.21.94"
def sovtoken_deb_version = "0.9.3+12.58"
def sovtokenfees_deb_version = "0.9.3+13.58"

sh """
cd ./devops/docker/ci/xenial/
wget --no-check-certificate https://repo.corp.evernym.com/deb/pool/main/s/sovtoken/sovtoken_${sovtoken_deb_version}_amd64.deb
wget --no-check-certificate https://repo.corp.evernym.com/deb/pool/main/s/sovtokenfees/sovtokenfees_${sovtoken_deb_version}_amd64.deb
wget --no-check-certificate https://repo.sovrin.org/deb/pool/xenial/rc/s/sovtoken/sovtoken_${sovtoken_deb_version}_amd64.deb
wget --no-check-certificate https://repo.sovrin.org/deb/pool/xenial/rc/s/sovtokenfees/sovtokenfees_${sovtokenfees_deb_version}_amd64.deb
"""
}
}
Expand Down
7 changes: 4 additions & 3 deletions devops/docker/base/xenial/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -21,11 +21,12 @@ RUN cd /tmp \
# need for libsodium to be reachable via pkg-config (sodiumoxide uses it)
ENV PKG_CONFIG_PATH /usr/local/lib/pkgconfig:$PKG_CONFIG_PATH # TODO ??? is it really needed

ENV LIBINDY_VERSION=1.6.6
RUN apt-key adv --keyserver keyserver.ubuntu.com --recv-keys 68DB5E88 \
&& echo "deb https://repo.sovrin.org/sdk/deb xenial master" >> /etc/apt/sources.list \
&& echo "deb https://repo.sovrin.org/sdk/deb xenial stable" >> /etc/apt/sources.list \
&& apt-get update && apt-get install -y --no-install-recommends \
libssl-dev \
libindy \
libindy=${LIBINDY_VERSION} \
&& rm -rf /var/lib/apt/lists/*


Expand All @@ -45,4 +46,4 @@ RUN cd /tmp/libsovtoken \

# TODO CMD ENTRYPOINT ...

ENV LIBSOVTOKEN_BASE_ENV_VERSION=0.8.0
ENV LIBSOVTOKEN_BASE_ENV_VERSION=0.9.0
12 changes: 6 additions & 6 deletions devops/docker/ci/xenial/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
FROM evernym/libsovtoken:base-xenial-0.8.0
FROM evernym/libsovtoken:base-xenial-0.9.0
# TODO LABEL maintainer="Name <email-address>"

ARG LIBINDY_CRYPTO_VERSION
Expand Down Expand Up @@ -34,11 +34,11 @@ RUN apt-get update && apt-get install -y --no-install-recommends \
# - have explicitly defined versions in packages depends list
# - are likely to be updated (e.g. packaged 3rd parties like python3-pyzmq
# or python3-rocksdb are not specified here)
ENV LIBINDY_CRYPTO_VERSION ${LIBINDY_CRYPTO_VERSION:-0.4.1}
ENV PYTHON3_INDY_CRYPTO_VERSION ${PYTHON3_INDY_CRYPTO_VERSION:-0.4.1}
ENV INDY_PLENUM_VERSION ${INDY_PLENUM_VERSION:-1.6.50}
ENV LIBINDY_CRYPTO_VERSION ${LIBINDY_CRYPTO_VERSION:-0.4.3}
ENV PYTHON3_INDY_CRYPTO_VERSION ${PYTHON3_INDY_CRYPTO_VERSION:-0.4.3}
ENV INDY_PLENUM_VERSION ${INDY_PLENUM_VERSION:-1.6.51}
ENV INDY_ANONCREDS_VERSION ${INDY_ANONCREDS_VERSION:-1.0.11}
ENV INDY_NODE_VERSION ${INDY_NODE_VERSION:-1.6.71}
ENV INDY_NODE_VERSION ${INDY_NODE_VERSION:-1.6.73}
RUN echo "deb https://repo.sovrin.org/sdk/deb xenial stable" >> /etc/apt/sources.list
RUN echo "deb https://repo.sovrin.org/deb xenial stable" >> /etc/apt/sources.list \
&& apt-get update && apt-get install -y --no-install-recommends \
Expand Down Expand Up @@ -90,4 +90,4 @@ COPY libsovtoken-ci-entrypoint.sh /usr/local/bin/
RUN chmod +x /usr/local/bin/libsovtoken-ci-entrypoint.sh
ENTRYPOINT ["libsovtoken-ci-entrypoint.sh"]

ENV LIBSOVTOKEN_CI_ENV_VERSION=0.40.0
ENV LIBSOVTOKEN_CI_ENV_VERSION=0.45.0
19 changes: 6 additions & 13 deletions devops/indy-pool/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -52,30 +52,23 @@ RUN useradd -m -d /home/indy -s /bin/bash -p $(openssl passwd -1 "token") -u $ui
ARG indy_stream=stable

ARG indy_anoncreds_ver=1.0.11
ARG python3_indy_crypto_ver=0.4.1
ARG indy_crypto_ver=0.4.0
ARG python3_indy_crypto_ver=0.4.3
ARG indy_crypto_ver=0.4.3
ARG indy_plenum_ver=1.6.51
ARG indy_node_ver=1.6.73

ARG sovtoken_pkg_name=sovtoken_0.8.0_amd64.deb
ARG sovtokenfees_pkg_name=sovtokenfees_0.8.0_amd64.deb

RUN apt-key adv --keyserver keyserver.ubuntu.com --recv-keys 68DB5E88
RUN echo "deb https://repo.sovrin.org/deb xenial $indy_stream" >> /etc/apt/sources.list

RUN apt-get update -y && apt-get install -y \
indy-plenum \
indy-node \
indy-plenum=${indy_plenum_ver}\
indy-node=${indy_node_ver} \
indy-anoncreds=${indy_anoncreds_ver} \
python3-indy-crypto=${python3_indy_crypto_ver} \
libindy-crypto=${indy_crypto_ver} \
vim sudo

RUN mkdir -p /usr/local/share/ca-certificates
RUN curl -k https://repo.corp.evernym.com/ca.crt | tee /usr/local/share/ca-certificates/Evernym_Root_CA.crt
RUN update-ca-certificates
RUN echo "10.2.3.179 repo.corp.evernym.com" >>/etc/hosts
RUN update-ca-certificates
RUN curl https://repo.corp.evernym.com/repo.corp.evenym.com-sig.key | apt-key add -
RUN echo 'deb https://repo.corp.evernym.com/deb evernym-agency-dev-ubuntu main' | tee /etc/apt/sources.list.d/agency-dev_repo.corp.evernym.com.list

RUN apt-get update && apt-get install -y --no-install-recommends \
sovtoken \
Expand Down
56 changes: 56 additions & 0 deletions doc/set_fees_process.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@
# Setting fees process

It will be explained on an example of Indy CLI.

### Prerequisites

* libindy
* Indy CLI
* libsovtoken
* Wallet with Trustee DID
* Created pool in Indy CLI

[Small guide](https://github.com/hyperledger/indy-sdk/tree/master/doc/design/001-cli#commands) to Indy CLI commands:

### Creating a SET_FEES transaction.

* Open `indy-cli`
* Open wallet: `wallet open <wallet_name> key=<wallet_encryption_key>`
* Load libsovtoken: `load-plugin library=libsovtoken.[so|dll] initializer=sovtoken_init`
* Make a transaction with a command `ledger set-fees-prepare payment_method=sov fees=NYM:1,ATTRIB:2` to set fees to 1 sovatom for NYM and 2 sovatoms for ATTRIB

Indy CLI will print the transaction after these steps. Example output:

```json
{"operation":{"type":"20000","fees":{"10001":2,"1":1}},"reqId":3782930813,"protocolVersion":2,"identifier":"V4SGRU86Z58d6TV7PBUe6f"}
```

### Putting your signature on a prepared request

This step should be made by multiple trustees.

* Open `indy-cli`
* Load libsovtoken: `load-plugin library=libsovtoken.[so|dll] initializer=sovtoken_init`
* Open your wallet: `wallet open <name_of_wallet> key=<wallet_encryption_key>`
* Use your did: `did use <your_did>`
* Sign the transaction you created or received: `ledger sign-multi txn=<transaction_json>`

Indy CLI will print the transaction with your signature after these steps. Example output:

```json
{"identifier":"V4SGRU86Z58d6TV7PBUe6f","operation":{"fees":{"1":1,"10001":2},"type":"20000"},"protocolVersion":2,"reqId":3782930813,"signatures":{"V4SGRU86Z58d6TV7PBUe6f":"DpiKv5n5es9yTkPv1py8mMb6PtL1tWrYdpVS9qp5bJ6GtNPRfNME8ThAbxW7hFbAPfsDzQsBMMEarJ4qDS4CgEF"}}
```

The output should be send to the next trustee to sign it.

### Sending the signed transaction to the ledger

* Open `indy-cli`
* Connect to the pool: `pool connect <pool_name>`
* Send transaction: `ledger custom <signed_transaction_json>`

Received ledger reply json will be printed in cli. Example output:

```json
{"op":"REPLY","result":{"txn":{"type":"20000","metadata":{"from":"V4SGRU86Z58d6TV7PBUe6f","reqId":3782930813,"digest":"94952d32bd83f1b63fed28cb502b704fd225cb02dca3cb02f4ebab94f2168370"},"data":{"fees":{"1":1,"10001":2}},"protocolVersion":2},"reqSignature":{"type":"ED25519","values":[{"value":"CFvstbmLLbWL2dtNxPiDkSR2v4aB7ADX41t3hVk4uvsnjVRXSFSwGs7KXcVdVQU9Qgzpp7moLdfKbjsD2QbwW8q","from":"4kyq92WXWVPKARnou6kWr7"},{"value":"YsNUcj1Hkpjfiykqs4C2nRqr8P8Xet2AZthQWgtjKEFxotYR99zHXQxRTBfzD4BRzUx7eL19HvrGdP495wmcrAb","from":"FT5Rx4RZZrVF1SjXtwcX7g"},{"value":"DpiKv5n5es9yTkPv1py8mMb6PtL1tWrYdpVS9qp5bJ6GtNPRfNME8ThAbxW7hFbAPfsDzQsBMMEarJ4qDS4CgEF","from":"V4SGRU86Z58d6TV7PBUe6f"}]},"auditPath":["FXoJDLDmTtc8x4FuNUZyazMTnHeEdqRMrkqiaUg9BivZ","hya3KgvwSti8uwbMv3h4yog6pu7ufSaM37EQFoikyp5","SmgEKUnFjZhC4FbaGwVfipvQMVyHyDW4BxzLSWYhkY2","Hf3CrReW4qNNGrShjpru6VLkfr5eCQn1YCYtuTePX3BD","3JxvbWb6zv7Vsj152frDKezsMGEwgjxCu6AcbPhZM5rq"],"ver":"1","rootHash":"Fg8uKJozQUAgKhjLvNTdPk3ZbduhjRju9pVjcyvXo8n2","txnMetadata":{"txnTime":1536940234,"seqNo":317}}}
```
4 changes: 2 additions & 2 deletions libsovtoken/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "libsovtoken"
version = "0.9.2"
version = "0.9.3"
authors = [
"Matt Raffel <[email protected]",
"Stephen Felt <[email protected]",
Expand All @@ -18,6 +18,7 @@ path = "src/lib.rs"
crate-type = ["staticlib", "rlib", "cdylib"]

[dependencies]
bs58 = {version="0.2.2", features = ["check"]}
base64 = "0.6.0"
env_logger = "0.5.10"
hex = "0.2.0"
Expand All @@ -27,7 +28,6 @@ log = "0.4.1"
log-panics = "2.0.0"
openssl = "0.9.24"
rand = "0.4.2"
bs58 = { git = "https://github.com/evernym/bs58-rs.git", branch = "master", features = ["check"] }
rust-libindy-wrapper = "0.2.13"
serde = "1.0"
serde_derive = "1.0"
Expand Down
Original file line number Diff line number Diff line change
@@ -1 +1 @@
libindy=1.6.2=stable
libindy=1.6.6=stable
2 changes: 1 addition & 1 deletion libsovtoken/build_scripts/ios/mac/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ sudo xcodebuild -license
---------------------------------------------------------------------------
1. Checkout the libsovtoken project using https://github.com/evernym/libsovtoken.git or [email protected]:evernym/libsovtoken.git
1. Startup a terminal and cd into libsovtoken/libsovtoken/build_scripts/ios/mac
1. Run the script `./mac.01.libindy.setup.sh` (make sure the brew install commands are successful)
1. Run the script `./mac.01.env.setup.sh` (make sure the brew install commands are successful)
* If it succeeded, run the command `rustc --print target-list|grep -i ios`. It should output:
```bash
aarch64-apple-ios
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ fi

if [[ $RUSTUP_VERSION =~ ^'rustup ' ]]; then
rustup component add rls-preview rust-analysis rust-src

rustup target remove aarch64-linux-android armv7-linux-androideabi arm-linux-androideabi i686-linux-android x86_64-linux-android
rustup target add aarch64-apple-ios armv7-apple-ios armv7s-apple-ios x86_64-apple-ios i386-apple-ios

Expand All @@ -58,18 +58,18 @@ if [[ $RUSTUP_VERSION =~ ^'rustup ' ]]; then

cargo install cargo-lipo
cargo install cargo-xcode

BREW_VERSION=`brew --version`
if ! [[ $BREW_VERSION =~ ^'Homebrew ' ]]; then
/usr/bin/ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"
brew doctor
brew update
fi

#2) Install required native libraries and utilities (libsodium is added with URL to homebrew since version<1.0.15 is required)
brew install pkg-config
brew install https://raw.githubusercontent.com/Homebrew/homebrew-core/65effd2b617bade68a8a2c5b39e1c3089cc0e945/Formula/libsodium.rb
brew install automake
brew install https://raw.githubusercontent.com/Homebrew/homebrew-core/65effd2b617bade68a8a2c5b39e1c3089cc0e945/Formula/libsodium.rb
brew install automake
brew install autoconf
brew install cmake
brew install openssl
Expand Down
Loading

0 comments on commit c6a41d9

Please sign in to comment.