Skip to content
This repository has been archived by the owner on Feb 29, 2024. It is now read-only.

Commit

Permalink
Merge pull request #18 from hyperledger/master
Browse files Browse the repository at this point in the history
Merging master from hyperledger
  • Loading branch information
anastasia-tarasova authored Jul 27, 2017
2 parents 9ce47d5 + 921fa53 commit 46ad519
Show file tree
Hide file tree
Showing 200 changed files with 15,162 additions and 2,145 deletions.
6 changes: 4 additions & 2 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,7 +1,9 @@
cargo-registry
target
build
Cargo.lock
.idea
.venv
.cache
.DS_Store
Podfile.lock

Podfile.lock
5 changes: 3 additions & 2 deletions Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
[package]
name = "indy-sdk"
name = "indy"
version = "0.1.1"
authors = [
"Sergej Pupykin <sergej.pupykin@dsr-company.com>",
Expand Down Expand Up @@ -29,6 +29,7 @@ pair_milagro = ["milagro-crypto"]
pair_amcl = ["amcl"]
hash_openssl = ["openssl"]
local_nodes_pool = []
interoperability_tests = []

[dependencies]
amcl = { version = "0.1.0", optional = true }
Expand All @@ -47,7 +48,7 @@ serde_json = "1.0"
serde_derive = "1.0"
sodiumoxide = {version = "0.0.14", optional = true}
time = "0.1.36"
zmq-pw = "0.9.5"
zmq-pw = "0.9.7"
lazy_static = "0.2"
byteorder = "1.0.0"
[dependencies.uuid]
Expand Down
149 changes: 119 additions & 30 deletions Jenkinsfile
Original file line number Diff line number Diff line change
Expand Up @@ -12,13 +12,26 @@ try {

// 1. TEST
stage('Test') {
parallel 'ubuntu-test': {

def tests = [:]

tests['ubuntu-test'] = {
node('ubuntu') {
stage('Ubuntu Test') {
testUbuntu()
}
}
}

tests['redhat-test'] = {
node('ubuntu') {
stage('RedHat Test') {
testRedHat()
}
}
}

parallel(tests)
}

if (!publishBranch) {
Expand All @@ -33,6 +46,20 @@ try {
}
}

// 3. PUBLISH RPMS TO repo.evernym.com
stage('Publish RPM Files') {
node('ubuntu') {
publishRpmFiles()
}
}

// 4. PUBLISH DEB TO repo.evernym.com
stage('Publish DEB Files') {
node('ubuntu') {
publishDebFiles()
}
}

} catch (e) {
currentBuild.result = "FAILED"
node('ubuntu-master') {
Expand All @@ -51,66 +78,78 @@ try {
}
}

def testUbuntu() {
def testPipeline(file, env_name, run_interoperability_tests) {
def poolInst
def network_name = "pool_network"
try {
echo 'Ubuntu Test: Checkout csm'
echo "${env_name} Test: Checkout csm"
checkout scm

echo "Ubuntu Test: Create docker network (${network_name}) for nodes pool and test image"
echo "${env_name} Test: Create docker network (${network_name}) for nodes pool and test image"
sh "docker network create --subnet=10.0.0.0/8 ${network_name}"

echo 'Ubuntu Test: Build docker image for nodes pool'
echo "${env_name} Test: Build docker image for nodes pool"
def poolEnv = dockerHelpers.build('indy_pool', 'ci/indy-pool.dockerfile ci')
echo 'Ubuntu Test: Run nodes pool'
echo "${env_name} Test: Run nodes pool"
poolInst = poolEnv.run("--ip=\"10.0.0.2\" --network=${network_name}")

echo 'Ubuntu Test: Build docker image'
def testEnv = dockerHelpers.build(name)
echo "${env_name} Test: Build docker image"
def testEnv = dockerHelpers.build(name, file)

testEnv.inside("--ip=\"10.0.0.3\" --network=${network_name}") {
echo 'Ubuntu Test: Test'
echo "${env_name} Test: Test"
sh 'chmod -R 777 /home/indy/'
sh 'cargo update'

sh 'cargo update'

try {
sh 'RUST_BACKTRACE=1 RUST_TEST_THREADS=1 cargo test'
/* TODO FIXME restore after xunit will be fixed
sh 'RUST_TEST_THREADS=1 cargo test-xunit'
*/
}
finally {
/* TODO FIXME restore after xunit will be fixed
junit 'test-results.xml'
try {
if (run_interoperability_tests) {
sh 'RUST_BACKTRACE=1 RUST_TEST_THREADS=1 cargo test --features "interoperability_tests"'
}
else {
sh 'RUST_BACKTRACE=1 RUST_TEST_THREADS=1 cargo test'
}
/* TODO FIXME restore after xunit will be fixed
sh 'RUST_TEST_THREADS=1 cargo test-xunit'
*/
}
}
finally {
/* TODO FIXME restore after xunit will be fixed
junit 'test-results.xml'
*/
}
}
}
finally {
echo 'Ubuntu Test: Cleanup'
echo "${env_name} Test: Cleanup"
try {
sh "docker network inspect ${network_name}"
} catch (ignore) {
} catch (err) {
echo "${env_name} Tests: error while inspect network ${network_name} - ${err}"
}
try {
if (poolInst) {
echo 'Ubuntu Test: stop pool'
poolInst.stop()
}
echo "${env_name} Test: stop pool"
poolInst.stop()
} catch (err) {
echo "Ubuntu Tests: error while stop pool ${err}"
echo "${env_name} Tests: error while stop pool ${err}"
}
try {
echo "Ubuntu Test: remove pool network ${network_name}"
echo "${env_name} Test: remove pool network ${network_name}"
sh "docker network rm ${network_name}"
} catch (err) {
echo "Ubuntu Test: error while delete ${network_name} - ${err}"
echo "${env_name} Test: error while delete ${network_name} - ${err}"
}
step([$class: 'WsCleanup'])
}
}

def testUbuntu() {
testPipeline("ci/ubuntu.dockerfile ci", "Ubuntu", true)
}

def testRedHat() {
testPipeline("ci/amazon.dockerfile ci", "RedHat", false)
}

def publishToCargo() {
try {
echo 'Publish to Cargo: Checkout csm'
Expand Down Expand Up @@ -140,4 +179,54 @@ def publishToCargo() {
echo 'Publish to cargo: Cleanup'
step([$class: 'WsCleanup'])
}
}

def publishRpmFiles() {
try {
echo 'Publish Rpm files: Checkout csm'
checkout scm

echo 'Publish Rpm: Build docker image'
def testEnv = dockerHelpers.build(name, 'ci/amazon.dockerfile ci')

testEnv.inside('-u 0:0') {

commit = sh(returnStdout: true, script: 'git rev-parse HEAD').trim()

sh 'chmod -R 777 ci'

withCredentials([file(credentialsId: 'EvernymRepoSSHKey', variable: 'evernym_repo_key')]) {
sh "./ci/rpm-build-and-upload.sh $commit $evernym_repo_key"
}
}
}
finally {
echo 'Publish RPM: Cleanup'
step([$class: 'WsCleanup'])
}
}

def publishDebFiles() {
try {
echo 'Publish Deb files: Checkout csm'
checkout scm

echo 'Publish Deb: Build docker image'
def testEnv = dockerHelpers.build(name)

testEnv.inside('-u 0:0') {

commit = sh(returnStdout: true, script: 'git rev-parse HEAD').trim()

sh 'chmod -R 777 ci'

withCredentials([file(credentialsId: 'EvernymRepoSSHKey', variable: 'evernym_repo_key')]) {
sh "./ci/deb-build-and-upload.sh $commit $evernym_repo_key"
}
}
}
finally {
echo 'Publish Deb: Cleanup'
step([$class: 'WsCleanup'])
}
}
22 changes: 10 additions & 12 deletions ci/amazon.dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -6,15 +6,20 @@ RUN \
yum clean all \
&& yum upgrade -y \
&& yum groupinstall -y "Development Tools" \
&& yum install -y epel-release \
&& yum-config-manager --enable epel \
&& yum install -y \
wget \
cmake \
pkgconfig \
openssl-devel \
sqlite-devel
sqlite-devel \
libsodium-devel \
spectool


RUN cd /tmp && \
curl https://download.libsodium.org/libsodium/releases/libsodium-1.0.12.tar.gz | tar -xz && \
curl https://download.libsodium.org/libsodium/releases/libsodium-1.0.12.tar.gz | tar -xz && \
cd /tmp/libsodium-1.0.12 && \
./configure && \
make && \
Expand All @@ -24,15 +29,6 @@ RUN cd /tmp && \
ENV PKG_CONFIG_PATH=$PKG_CONFIG_PATH:/usr/local/lib/pkgconfig
ENV LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/usr/local/lib

RUN cd /tmp && \
wget https://github.com/zeromq/libzmq/releases/download/v4.2.2/zeromq-4.2.2.tar.gz && \
tar xfz zeromq-4.2.2.tar.gz && rm zeromq-4.2.2.tar.gz && \
cd /tmp/zeromq-4.2.2 && \
./configure && \
make && \
make install && \
rm -rf /tmp/zeromq-4.2.2

ENV RUST_ARCHIVE=rust-1.16.0-x86_64-unknown-linux-gnu.tar.gz
ENV RUST_DOWNLOAD_URL=https://static.rust-lang.org/dist/$RUST_ARCHIVE

Expand All @@ -50,4 +46,6 @@ ENV PATH="/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/root/.ca
RUN useradd -ms /bin/bash -u $uid indy
USER indy

WORKDIR /home/indy
RUN cargo install --git https://github.com/DSRCorporation/cargo-test-xunit

WORKDIR /home/sorvin
25 changes: 25 additions & 0 deletions ci/deb-build-and-upload.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
#!/bin/bash

if [ "$1" = "--help" ] ; then
echo "Usage: $0 <commit> $1 <key>"
fi

commit="$1"
key="$2"

version=$(wget -q https://raw.githubusercontent.com/hyperledger/indy-sdk/$commit/Cargo.toml -O - | grep -E '^version =' | head -n1 | cut -f2 -d= | tr -d '" ')

[ -z $version ] && exit 1
[ -z $commit ] && exit 2
[ -z $key ] && exit 3

dpkg-buildpackage

cat <<EOF | sftp -v -oStrictHostKeyChecking=no -i $key repo@192.168.11.111
mkdir /var/repository/repos/deb/indy-sdk
mkdir /var/repository/repos/deb/indy-sdk/$version
cd /var/repository/repos/deb/indy-sdk/$version
put -r /var/lib/jenkins/workspace/indy-sdk-dev_"$version"_amd64.deb
put -r /var/lib/jenkins/workspace/indy-sdk_"$version"_amd64.deb
ls -l /var/repository/repos/deb/indy-sdk/$version
EOF
9 changes: 3 additions & 6 deletions ci/indy-pool.dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -26,12 +26,9 @@ RUN echo "deb https://repo.sovrin.org/deb xenial master" >> /etc/apt/sources.lis
RUN useradd -ms /bin/bash -u $uid sovrin

RUN apt-get update -y && apt-get install -y \
python3-state-trie=0.2.3 \
python3-stp=0.2.40 \
python3-ledger=0.3.48 \
python3-plenum=0.4.19 \
python3-sovrin-common=0.3.17 \
sovrin-node=0.4.13
indy-plenum=0.4.44 \
indy-anoncreds=0.4.12 \
indy-node=0.4.29

RUN echo '[supervisord]\n\
logfile = /tmp/supervisord.log\n\
Expand Down
21 changes: 21 additions & 0 deletions ci/java.dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
FROM ubuntu:16.04

ARG uid=1000

RUN apt-get update && apt-get install openjdk-8-jdk -y

ENV JAVA_HOME /usr/lib/jvm/java-8-openjdk-amd64

RUN apt-get install -y \
maven \
gdebi \
apt-utils

ADD https://repo.evernym.com/deb/indy-sdk/0.1.1/indy-sdk_0.1.1_amd64.deb .

RUN gdebi -n indy-sdk_0.1.1_amd64.deb

RUN useradd -ms /bin/bash -u $uid indy
USER indy

WORKDIR /home/indy
28 changes: 28 additions & 0 deletions ci/python.dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
FROM ubuntu:16.04

ARG uid=1000

RUN apt-get update && \
apt-get install -y \
gdebi \
apt-utils \
software-properties-common

RUN add-apt-repository ppa:jonathonf/python-3.6

RUN apt-get update && \
apt-get install -y \
python3.6 \
python3-pip

ADD https://repo.evernym.com/deb/indy-sdk/0.1.1/indy-sdk_0.1.1_amd64.deb .

RUN gdebi -n indy-sdk_0.1.1_amd64.deb

RUN useradd -ms /bin/bash -u $uid indy
USER indy

WORKDIR /home/indy



Loading

0 comments on commit 46ad519

Please sign in to comment.