Unverified Commit c2cde3e9 authored by Stan Kladko's avatar Stan Kladko Committed by GitHub

Merge pull request #77 from skalenetwork/SKALE-2502-sgx-failes-on-githubactions

Skale 2502 sgx failes on githubactions
parents 1fc29c13 ff3e1080
......@@ -16,3 +16,4 @@ jobs:
- name: push
run: python3 scripts/docker_push.py ${GITHUB_REF##*/} Dockerfile sgxwallet ${GITHUB_SHA}
......@@ -4,6 +4,8 @@ jobs:
build:
runs-on: ubuntu-latest
steps:
- name: Check that /dev/urandom exists
run: ls /dev/urandom
- name: Login to docker
env:
GITHUB_TOKEN: ${{ secrets.DOCKER_SECRET }}
......@@ -20,3 +22,4 @@ jobs:
FROM skalenetwork/sgxwallet_base:latest
WORKDIR /usr/src/sdk
RUN ccache -sz
RUN touch /var/hwmode
COPY *.cpp ./
COPY *.h ./
......@@ -14,7 +16,7 @@ COPY docker ./docker
COPY build-aux ./build-aux
COPY cert ./cert
COPY jsonrpc ./jsonrpc
COPY autoconf.bash ./
COPY leveldb ./leveldb
COPY m4 ./m4
COPY scripts ./scripts
......@@ -22,16 +24,10 @@ COPY secure_enclave ./secure_enclave
COPY spdlog ./spdlog
COPY SGXWALLET_VERSION ./
RUN autoreconf -vif
RUN libtoolize --force
RUN aclocal
RUN autoheader || true
RUN automake --force-missing --add-missing
RUN autoconf
RUN ./autoconf.bash
RUN ./configure
### RUN cd libBLS; cmake -H. -Bbuild; cmake --build build -- -j$(nproc);
RUN make
RUN bash -c "make -j$(nproc)"
RUN ccache -sz
RUN mkdir /usr/src/sdk/sgx_data
COPY docker/start.sh ./
ENTRYPOINT ["/usr/src/sdk/start.sh"]
FROM ubuntu:bionic
WORKDIR /usr/src/sdk
COPY *.cpp ./
COPY *.h ./
COPY *.txt ./
COPY *.c ./
COPY *.am ./
COPY *.hpp ./
COPY *.sh ./
COPY *.m4 ./
COPY *.gmp ./
COPY *.ac ./
COPY *.json ./
COPY docker ./docker
COPY build-aux ./build-aux
COPY cert ./cert
COPY intel-sgx-ssl ./intel-sgx-ssl
COPY jsonrpc ./jsonrpc
COPY leveldb ./leveldb
COPY libBLS ./libBLS
COPY m4 ./m4
COPY scripts ./scripts
COPY secure_enclave ./secure_enclave
COPY sgx-gmp ./sgx-gmp
COPY sgx-software-enable ./sgx-software-enable
COPY trusted_libff ./trusted_libff
RUN rm -rf /usr/src/sdk/leveldb/build/
RUN apt-get update && apt-get install -yq --no-install-recommends python-yaml vim telnet git ca-certificates build-essential ocaml ocamlbuild automake autoconf libtool wget python libssl-dev libssl-dev libcurl4-openssl-dev protobuf-compiler git libprotobuf-dev alien cmake debhelper uuid-dev libxml2-dev
RUN apt install -y libprotobuf10 yasm cmake flex bison libprocps-dev ccache autoconf texinfo libssl-dev libboost-all-dev libjsonrpccpp-dev libjsonrpccpp-tools
COPY . /usr/src/sdk
RUN ls /usr/src/sdk/autoconf.bash
WORKDIR /usr/src/sdk
COPY docker/install-psw.patch ./
RUN git clone -b sgx_2.5 --depth 1 https://github.com/intel/linux-sgx && \
cd linux-sgx && \
patch -p1 -i ../install-psw.patch && \
./download_prebuilt.sh 2> /dev/null && \
make -s -j$(nproc) sdk_install_pkg psw_install_pkg && \
./linux/installer/bin/sgx_linux_x64_sdk_2.5.100.49891.bin --prefix=/opt/intel && \
./linux/installer/bin/sgx_linux_x64_psw_2.5.100.49891.bin && \
cd .. && rm -rf linux-sgx/
# For debug purposes
# COPY docker/jhi.conf /etc/jhi/jhi.conf
COPY configure.gmp ./
RUN cd scripts; ./build.py
RUN wget --progress=dot:mega -O - https://github.com/intel/dynamic-application-loader-host-interface/archive/072d233296c15d0dcd1fb4570694d0244729f87b.tar.gz | tar -xz && \
cd dynamic-application-loader-host-interface-072d233296c15d0dcd1fb4570694d0244729f87b && \
cmake . -DCMAKE_BUILD_TYPE=Release -DINIT_SYSTEM=SysVinit && \
make install && \
cd .. && rm -rf dynamic-application-loader-host-interface-072d233296c15d0dcd1fb4570694d0244729f87b
RUN apt update && \
apt install -yq apt-utils && \
apt install -yq --no-install-recommends python-yaml vim \
telnet git ca-certificates build-essential ocaml ocamlbuild \
automake autoconf libtool wget python libssl-dev libssl-dev \
libcurl4-openssl-dev protobuf-compiler git libprotobuf-dev \
alien cmake debhelper uuid-dev libxml2-dev ccache vim libprotobuf10 \
yasm cmake flex bison libprocps-dev ccache autoconf texinfo libssl-dev \
libboost-all-dev libjsonrpccpp-dev libjsonrpccpp-tools && \
ln -s /usr/bin/ccache /usr/local/bin/clang && \
ln -s /usr/bin/ccache /usr/local/bin/clang++ && \
ln -s /usr/bin/ccache /usr/local/bin/gcc && \
ln -s /usr/bin/ccache /usr/local/bin/g++ && \
ln -s /usr/bin/ccache /usr/local/bin/cc && \
ln -s /usr/bin/ccache /usr/local/bin/c++ && \
git clone -b sgx_2.5 --depth 1 https://github.com/intel/linux-sgx && \
cd linux-sgx && \
patch -p1 -i ../install-psw.patch && \
./download_prebuilt.sh 2> /dev/null && \
make -s -j$(nproc) sdk_install_pkg psw_install_pkg && \
./linux/installer/bin/sgx_linux_x64_sdk_2.5.100.49891.bin --prefix=/opt/intel && \
./linux/installer/bin/sgx_linux_x64_psw_2.5.100.49891.bin && \
cd .. && rm -rf linux-sgx/ && cd scripts && ./build.py && \
wget --progress=dot:mega -O - https://github.com/intel/dynamic-application-loader-host-interface/archive/072d233296c15d0dcd1fb4570694d0244729f87b.tar.gz | tar -xz && \
cd dynamic-application-loader-host-interface-072d233296c15d0dcd1fb4570694d0244729f87b && \
cmake . -DCMAKE_BUILD_TYPE=Release -DINIT_SYSTEM=SysVinit && \
make install && \
cd .. && rm -rf dynamic-application-loader-host-interface-072d233296c15d0dcd1fb4570694d0244729f87b && \
cd /usr/src/sdk && \
./autoconf.bash && \
./configure && \
bash -c "make -j$(nproc)"
FROM skalenetwork/sgxwallet_base:latest
WORKDIR /usr/src/sdk
COPY *.cpp ./
COPY *.h ./
COPY *.txt ./
COPY *.c ./
COPY *.am ./
COPY *.hpp ./
COPY *.gmp ./
COPY *.ac ./
COPY *.json ./
COPY docker ./docker
COPY build-aux ./build-aux
COPY cert ./cert
COPY jsonrpc ./jsonrpc
COPY leveldb ./leveldb
COPY m4 ./m4
COPY scripts ./scripts
COPY secure_enclave ./secure_enclave
COPY spdlog ./spdlog
COPY SGXWALLET_VERSION ./
RUN autoreconf -vif
RUN libtoolize --force
RUN aclocal
RUN autoheader || true
RUN automake --force-missing --add-missing
RUN autoconf
RUN ./configure --enable-sgx-simulation
### RUN cd libBLS; cmake -H. -Bbuild; cmake --build build -- -j$(nproc);
RUN make
RUN ccache -sz
RUN mkdir /usr/src/sdk/sgx_data
COPY . /usr/src/sdk
WORKDIR /usr/src/sdk
RUN ./autoconf.bash && \
./configure --enable-sgx-simulation && \
bash -c "make" && \
ccache -sz && \
mkdir /usr/src/sdk/sgx_data
COPY docker/start.sh ./
......
#!/bin/bash
libtoolize --force
aclocal
autoheader || true
automake --force-missing --add-missing
autoconf
\ No newline at end of file
#! /bin/sh
aclocal && \
automake --add-missing && \
autoconf
#!/bin/bash
set -e
set -v
set -x
source /opt/intel/sgxsdk/environment
if ! [ -f /root/.rnd ]; then dd if=/dev/random of=/root/.rnd bs=256 count=1 ; fi
if [[ ! -e "/dev/random" ]]
then
ls /dev/random;
echo "SGX wallet error. No /dev/random.";
echo "If you are running raw docker without docker compose please make sure";
echo "the command line includes -v /dev/urandom:/dev/random";
exit 1;
fi
ls /dev/random;
rm -f /root/.rnd;
dd if=/dev/random of=/root/.rnd bs=256 count=1;
ls /root/.rnd;
cd /usr/src/sdk;
if [ -f "/var/hwmode" ]
if [[ -f "/var/hwmode" ]]
then
echo "Running in SGX hardware mode"
export LD_LIBRARY_PATH=${LD_LIBRARY_PATH}:/opt/intel/sgxpsw/aesm/
......@@ -22,7 +36,7 @@ echo "Running in SGX simulation mode"
fi
if [ "$1" = -t ]; then
if [[ "$1" == "-t" ]]; then
echo "Test run requested"
#./testw [bls-key-encrypt]
./testw [bls-key-encrypt-decrypt]
......
......@@ -17,7 +17,7 @@ source sgx-sdk-build/sgxsdk/environment;
Depending on whether you built a docker container or pulled it from docker hub, use the appropriate docker image name (e.g. sgxwallet_base, sgxwalletsim, ...) and execute:
```bash
sudo docker run -di --network host --device /dev/isgx --device /dev/mei0 --name sgxwallet <sgx-docker-image>
sudo docker run -di --network host -v /dev/random:/dev/urandom --device /dev/isgx --device /dev/mei0 --name sgxwallet <sgx-docker-image>
```
This will run the server in a Docker container named sgxwallet
......
......@@ -31,7 +31,7 @@ import sys, os, subprocess, socket, time
os.chdir("..")
topDir = os.getcwd() + "/sgxwallet"
print("Starting build push")
print("Starting containerb test")
print("Top directory is:" + topDir)
SCRIPTS_DIR = topDir + "/scripts"
......@@ -49,14 +49,13 @@ FULL_IMAGE_NAME = "skalenetwork/" + IMAGE_NAME +":" + TAG_POSTFIX;
print("Running tests for branch " + BRANCH);
assert subprocess.call(["docker", "image", "inspect", FULL_IMAGE_NAME]) == 0;
dockerRun = subprocess.run(["docker", "run", "-v", topDir + "/sgx_data:/usr/src/sdk/sgx_data","-t",
"-v", "/dev/urandom:/dev/random", "--name", "sgxwallet", "--network=host", "skalenetwork/" + IMAGE_NAME +":" + TAG_POSTFIX, "-t"])
completedProcess = subprocess.run(["docker", "run", "-v", topDir + "/sgx_data:/usr/src/sdk/sgx_data","-t",
"--name", "sgxwallet", "--network=host", "skalenetwork/" + IMAGE_NAME +":" + TAG_POSTFIX, "-t"])
print(dockerRun.stdout)
print(dockerRun.stderr)
assert dockerRun.returncode == 0;
print(completedProcess.stdout)
print(completedProcess.stderr)
assert completedProcess.returncode == 0;
assert subprocess.call(["docker", "rm", "sgxwallet"]) == 0
......
#!/bin/bash
sudo dpkg -i *.deb
sudo apt install cmake flex bison yasm ccache autoconf texinfo libgcrypt20-dev libgnutls28-dev libtool pkg-config
sudo apt install ccache cmake flex bison yasm ccache autoconf texinfo libgcrypt20-dev libgnutls28-dev libtool pkg-config
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment