Skip to content

Commit

Permalink
Updating clang version and using ubuntu 20.04 instead of 16.04 (#144)
Browse files Browse the repository at this point in the history
* Updating clang version and using ubunutu 20.04 instead of 16.04

* Parallelly building docker images.

* Adding ubuntu 20.04 to the pipeline and addressing comments from last iteration.

* Removing Windows 2016 VM.

* Adding new images to the docker repository.

* Updated UID while creating the images.

* Adding volume parameter argument.

* Updating the location to find libgtest.a and libgtest_main.a for Ubuntu 20.

* Correcting indentation.

* Indentation correction.

* Indentation changes.

* Updating the command to check for libgtest.a and libgtest_main.a

* Removing blank lines.

* Updating the command to copy libgtest.a and libgtest_main.a

* Updating the command to copy libgtest.a and libgtest_main.a

* Resolving build errors.

* updating docker image name and repository name.

* Updating the command to copy libgtest.a and libgtest_main.a
  • Loading branch information
msft-gumunjal authored Jul 28, 2021
1 parent 586f8a2 commit b8f8901
Show file tree
Hide file tree
Showing 5 changed files with 124 additions and 163 deletions.
4 changes: 2 additions & 2 deletions .jenkins/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,11 @@

ARG ubuntu_version=18.04

FROM oejenkinscidockerregistry.azurecr.io/oetools-full-${ubuntu_version}
FROM oejenkinscidockerregistry.azurecr.io/oetools-${ubuntu_version}

ARG UNAME=jenkins

RUN apt-get purge az-dcap-client -y && \
apt-get update && \
apt-get install sudo libcurl4-openssl-dev wget -y && \
echo "${UNAME} ALL=(ALL) NOPASSWD: ALL" >> /etc/sudoers
echo "${UNAME} ALL=(ALL) NOPASSWD: ALL" >> /etc/sudoers
72 changes: 24 additions & 48 deletions .jenkins/Jenkinsfile
Original file line number Diff line number Diff line change
@@ -1,40 +1,32 @@

// The below timeout is set in minutes
GLOBAL_TIMEOUT = 240

DOCKER_REGISTRY = "dcapdockerciregistry.azurecr.io"

GROOVY_FILE = "/.jenkins/src/Dcap.groovy"


// Tests running on hardware with custom path to libdcap_quoteprov.so
def ACCTest(String label, String version, String compiler, String build_type) {
stage("${label} ${compiler} SGX1-FLC ${build_type}") {
node("${label}") {
timeout(GLOBAL_TIMEOUT) {

cleanWs()
checkout scm

def dcap = load pwd() + GROOVY_FILE

// Clone the Open Enclave repo
dir("${WORKSPACE}/openenclave") {
git url: 'https://github.com/Microsoft/openenclave.git'
}

// Run hardware tests using the libdcap_quoteprov.so build
def task = """
cd ${WORKSPACE}/src/Linux
./configure
make
mkdir -p ${WORKSPACE}/openenclave/build
cd ${WORKSPACE}/openenclave/build
git submodule update --recursive --init
cmake ${WORKSPACE}/openenclave -G Ninja -DCMAKE_BUILD_TYPE=${build_type}
ninja -v
LD_LIBRARY_PATH=${WORKSPACE}/src/Linux ctest --output-on-failure
"""
cd ${WORKSPACE}/src/Linux
./configure
make
mkdir -p ${WORKSPACE}/openenclave/build
cd ${WORKSPACE}/openenclave/build
git submodule update --recursive --init
cmake ${WORKSPACE}/openenclave -G Ninja -DCMAKE_BUILD_TYPE=${build_type}
ninja -v
LD_LIBRARY_PATH=${WORKSPACE}/src/Linux ctest --output-on-failure
"""
dcap.Run(compiler, task)
}
}
Expand All @@ -46,29 +38,23 @@ def ACCContainerTest(String label, String version) {
stage("Ubuntu ${version} Non-Simulation Container SGX1-FLC RelWithDebInfo") {
node("${label}") {
timeout(GLOBAL_TIMEOUT) {

cleanWs()
checkout scm

def dcap = load pwd() + GROOVY_FILE

// Clone the Open Enclave repo
dir("${WORKSPACE}/openenclave") {
git url: 'https://github.com/Microsoft/openenclave.git'
}

// Run the OE tests from the git repository with the currently
// generated az-dcap-client deb package installed
def task = """
sudo apt-get update -y
sudo apt-get install -y libgtest-dev
sudo apt-get install -y cmake
cd /usr/src/gtest
sudo cmake CMakeLists.txt
sudo make
sudo cp *.a /usr/lib
find . -name "*.a" -exec sudo cp -t /usr/lib {} +
sudo apt-get purge az-dcap-client -y
sudo apt-get update
sudo apt-get install sudo libcurl4-openssl-dev wget -y
Expand All @@ -82,7 +68,7 @@ def ACCContainerTest(String label, String version) {
ninja -v
ctest --output-on-failure
"""
dcap.ContainerRun("${DOCKER_REGISTRY}/oetools-full-${version}:latest", "clang-8", task, "--cap-add=SYS_PTRACE --device /dev/sgx:/dev/sgx")
dcap.ContainerRun("${DOCKER_REGISTRY}/dcapdockerciregistry-ubuntu${version}:latest", "clang-10", task, "--cap-add=SYS_PTRACE --device /dev/sgx:/dev/sgx --volume /var/run/aesmd/aesm.socket:/var/run/aesmd/aesm.socket")
}
}
}
Expand All @@ -92,24 +78,19 @@ def ACCTestOeRelease(String label, String version) {
stage("OpenEnclave release samples ${version}") {
node("${label}") {
timeout(GLOBAL_TIMEOUT) {

cleanWs()
checkout scm

def dcap = load pwd() + GROOVY_FILE

// Run the OE samples bundled with the published OE package, having
// the currently generated az-dcap-client deb package installed
def task = """
sudo apt-get update -y
sudo apt-get install -y libgtest-dev
sudo apt-get install -y cmake
cd /usr/src/gtest
sudo cmake CMakeLists.txt
sudo make
sudo cp *.a /usr/lib
find . -name "*.a" -exec sudo cp -t /usr/lib {} +
sudo apt-get purge az-dcap-client -y
sudo apt-get update
sudo apt-get install sudo libcurl4-openssl-dev wget -y
Expand All @@ -126,7 +107,7 @@ def ACCTestOeRelease(String label, String version) {
make run
done
"""
dcap.ContainerRun("${DOCKER_REGISTRY}/oetools-full-${version}:latest", "clang-8", task, "--cap-add=SYS_PTRACE --device /dev/sgx:/dev/sgx")
dcap.ContainerRun("${DOCKER_REGISTRY}/dcapdockerciregistry-ubuntu${version}:latest", "clang-10", task, "--cap-add=SYS_PTRACE --device /dev/sgx:/dev/sgx --volume /var/run/aesmd/aesm.socket:/var/run/aesmd/aesm.socket")
}
}
}
Expand All @@ -137,19 +118,18 @@ def DCAPBuildTest(String label, String build_type) {
stage("${label} ${build_type}") {
node("${label}") {
timeout(GLOBAL_TIMEOUT) {

cleanWs()
checkout scm
bat """
vcvars64.bat x64 && \
cd ${WORKSPACE}\\src\\Windows && \
nuget.exe restore dcap_provider.sln -PackagesDirectory packages && \
nuget.exe restore dcap_provider.sln -PackagesDirectory packages && \
powershell -ExecutionPolicy Unrestricted -NoLogo -NonInteractive -Command ${WORKSPACE}\\src\\Windows\\get-prereqs.ps1 && \
cd ${WORKSPACE}\\src\\Windows\\dll && \
nuget.exe restore dcap_provider.vcxproj -PackagesDirectory packages && \
nuget.exe restore dcap_provider.vcxproj -PackagesDirectory packages && \
MSBuild.exe dcap_provider.vcxproj /p:Configuration=${build_type};Platform=x64 && \
cd ${WORKSPACE}\\src\\Windows\\UnitTests && \
nuget.exe restore UnitTests.vcxproj -PackagesDirectory packages && \
nuget.exe restore UnitTests.vcxproj -PackagesDirectory packages && \
MSBuild.exe UnitTests.vcxproj /p:Configuration=${build_type};Platform=x64 && \
xcopy /y /c ${WORKSPACE}\\src\\Windows\\UnitTests\\x64\\${build_type}\\UnitTests.exe ${WORKSPACE}\\src\\Windows\\dll\\x64\\${build_type} && \
cd ${WORKSPACE}\\src\\Windows\\dll\\x64\\${build_type} && \
Expand All @@ -160,17 +140,13 @@ def DCAPBuildTest(String label, String build_type) {
}
}

parallel "ACC1604 SGX1-FLC Container RelWithDebInfo" : { ACCContainerTest('ACC-1604', '16.04') },
"ACC1804 SGX1-FLC Container RelWithDebInfo" : { ACCContainerTest('ACC-1804', '18.04') },
"ACC1604 SGX1-FLC clang-8 Debug" : { ACCTest('ACC-1604', '16.04', 'clang-8', 'Debug') },
"ACC1604 SGX1-FLC clang-8 Release" : { ACCTest('ACC-1604', '16.04', 'clang-8', 'Release') },
"ACC1604 SGX1-FLC clang-8 RelWithDebInfo" : { ACCTest('ACC-1604', '16.04', 'clang-8', 'RelWithDebInfo') },
"ACC1804 SGX1-FLC clang-8 Debug" : { ACCTest('ACC-1804', '18.04', 'clang-8', 'Debug') },
"ACC1804 SGX1-FLC clang-8 Release" : { ACCTest('ACC-1804', '18.04', 'clang-8', 'Release') },
"ACC1804 SGX1-FLC clang-8 RelWithDebInfo" : { ACCTest('ACC-1804', '18.04', 'clang-8', 'RelWithDebInfo') },
"ACC1604 OpenEnclave Release Test" : { ACCTestOeRelease('ACC-1604','16.04') },
parallel "ACC1804 SGX1-FLC Container RelWithDebInfo" : { ACCContainerTest('ACC-1804', '18.04') },
"ACC1804 SGX1-FLC clang-10 Debug" : { ACCTest('ACC-1804', '18.04', 'clang-10', 'Debug') },
"ACC1804 SGX1-FLC clang-10 RelWithDebInfo" : { ACCTest('ACC-1804', '18.04', 'clang-10', 'RelWithDebInfo') },
"ACC1804 OpenEnclave Release Test" : { ACCTestOeRelease('ACC-1804','18.04') },
"ACCWin 2016 DCAP Debug Test" : { DCAPBuildTest('SGXFLC-Windows-2016-DCAP', 'Debug') },
"ACCWin 2016 DCAP Release Test" : { DCAPBuildTest('SGXFLC-Windows-2016-DCAP', 'Release') },
"ACC2004 SGX1-FLC Container RelWithDebInfo" : { ACCContainerTest('ACC-2004', '20.04') },
"ACC2004 SGX1-FLC clang-10 Debug" : { ACCTest('ACC-2004', '20.04', 'clang-10', 'Debug') },
"ACC2004 SGX1-FLC clang-10 RelWithDebInfo" : { ACCTest('ACC-2004', '20.04', 'clang-10', 'RelWithDebInfo') },
"ACC2004 OpenEnclave Release Test" : { ACCTestOeRelease('ACC-2004','20.04') },
"ACCWin 2019 DCAP Debug Test" : { DCAPBuildTest('SGXFLC-Windows-2019-DCAP', 'Debug') },
"ACCWin 2019 DCAP Release Test" : { DCAPBuildTest('SGXFLC-Windows-2019-DCAP', 'Release') }
119 changes: 51 additions & 68 deletions .jenkins/JenkinsfileTestLinuxRelease
Original file line number Diff line number Diff line change
@@ -1,40 +1,32 @@

// The below timeout is set in minutes
GLOBAL_TIMEOUT = 240

DOCKER_REGISTRY = "dcapdockerciregistry.azurecr.io"

GROOVY_FILE = "/.jenkins/src/Dcap.groovy"


// Tests running on hardware with custom path to libdcap_quoteprov.so
def ACCTest(String label, String version, String compiler, String build_type) {
stage("${label} ${compiler} SGX1-FLC ${build_type}") {
node("${label}") {
timeout(GLOBAL_TIMEOUT) {

cleanWs()
checkout scm

def dcap = load pwd() + GROOVY_FILE

// Clone the Open Enclave repo
dir("${WORKSPACE}/openenclave") {
git url: 'https://github.com/Microsoft/openenclave.git'
}

// Run hardware tests using the libdcap_quoteprov.so build
def task = """
cd ${WORKSPACE}/src/Linux
./configure
make
mkdir -p ${WORKSPACE}/openenclave/build
cd ${WORKSPACE}/openenclave/build
git submodule update --recursive --init
cmake ${WORKSPACE}/openenclave -G Ninja -DCMAKE_BUILD_TYPE=${build_type}
ninja -v
LD_LIBRARY_PATH=${WORKSPACE}/src/Linux ctest --output-on-failure
"""
cd ${WORKSPACE}/src/Linux
./configure
make
mkdir -p ${WORKSPACE}/openenclave/build
cd ${WORKSPACE}/openenclave/build
git submodule update --recursive --init
cmake ${WORKSPACE}/openenclave -G Ninja -DCMAKE_BUILD_TYPE=${build_type}
ninja -v
LD_LIBRARY_PATH=${WORKSPACE}/src/Linux ctest --output-on-failure
"""
dcap.Run(compiler, task)
}
}
Expand All @@ -46,35 +38,31 @@ def ACCContainerTest(String label, String version) {
stage("Ubuntu ${version} Non-Simulation Container SGX1-FLC RelWithDebInfo") {
node("${label}") {
timeout(GLOBAL_TIMEOUT) {

cleanWs()
checkout scm

def dcap = load pwd() + GROOVY_FILE

// Clone the Open Enclave repo
dir("${WORKSPACE}/openenclave") {
git url: 'https://github.com/Microsoft/openenclave.git'
}

// Run the OE tests from the git repository with the currently
// generated az-dcap-client deb package installed
def task = """
sudo apt-get update
sudo apt-get install -y software-properties-common
sudo apt-get purge az-dcap-client -y
curl -sSL https://packages.microsoft.com/keys/microsoft.asc | sudo apt-key add -
sudo apt-add-repository https://packages.microsoft.com/ubuntu/${version}/prod
sudo apt-get update
sudo apt-get upgrade -y az-dcap-client
mkdir -p ${WORKSPACE}/openenclave/build
cd ${WORKSPACE}/openenclave/build
git submodule update --recursive --init
cmake ${WORKSPACE}/openenclave -G Ninja -DCMAKE_BUILD_TYPE=RelWithDebInfo
ninja -v
ctest --output-on-failure
"""
dcap.ContainerRun("${DOCKER_REGISTRY}/oetools-full-${version}:latest", "clang-8", task, "--cap-add=SYS_PTRACE --device /dev/sgx:/dev/sgx")
sudo apt-get update
sudo apt-get install -y software-properties-common
sudo apt-get purge az-dcap-client -y
curl -sSL https://packages.microsoft.com/keys/microsoft.asc | sudo apt-key add -
sudo apt-add-repository https://packages.microsoft.com/ubuntu/${version}/prod
sudo apt-get update
sudo apt-get upgrade -y az-dcap-client
mkdir -p ${WORKSPACE}/openenclave/build
cd ${WORKSPACE}/openenclave/build
git submodule update --recursive --init
cmake ${WORKSPACE}/openenclave -G Ninja -DCMAKE_BUILD_TYPE=RelWithDebInfo
ninja -v
ctest --output-on-failure
"""
dcap.ContainerRun("${DOCKER_REGISTRY}/dcapdockerciregistry-ubuntu${version}:latest", "clang-10", task, "--cap-add=SYS_PTRACE --device /dev/sgx:/dev/sgx --volume /var/run/aesmd/aesm.socket:/var/run/aesmd/aesm.socket")
}
}
}
Expand All @@ -84,45 +72,40 @@ def ACCTestOeRelease(String label, String version) {
stage("OpenEnclave release samples ${version}") {
node("${label}") {
timeout(GLOBAL_TIMEOUT) {

cleanWs()
checkout scm

def dcap = load pwd() + "/.jenkins/src/Dcap.groovy"

// Run the OE samples bundled with the published OE package, having
// the currently generated az-dcap-client deb package installed
def task = """
sudo apt-get update
sudo apt-get install -y software-properties-common
sudo apt-get purge az-dcap-client -y
curl -sSL https://packages.microsoft.com/keys/microsoft.asc | sudo apt-key add -
sudo apt-add-repository https://packages.microsoft.com/ubuntu/${version}/prod
sudo apt-get update
sudo apt-get upgrade -y az-dcap-client
sudo apt-get update
sudo apt-get install -y open-enclave
. /opt/openenclave/share/openenclave/openenclaverc
cp -r /opt/openenclave/share/openenclave/samples/ ~/samples
for DIR in \$(find ~/samples/* -maxdepth 0 -type d); do
cd \$DIR
make build
make run
done
"""
dcap.ContainerRun("${DOCKER_REGISTRY}/oetools-full-${version}:latest", "clang-8", task, "--cap-add=SYS_PTRACE --device /dev/sgx:/dev/sgx")
sudo apt-get update
sudo apt-get install -y software-properties-common
sudo apt-get purge az-dcap-client -y
curl -sSL https://packages.microsoft.com/keys/microsoft.asc | sudo apt-key add -
sudo apt-add-repository https://packages.microsoft.com/ubuntu/${version}/prod
sudo apt-get update
sudo apt-get upgrade -y az-dcap-client
sudo apt-get update
sudo apt-get install -y open-enclave
. /opt/openenclave/share/openenclave/openenclaverc
cp -r /opt/openenclave/share/openenclave/samples/ ~/samples
for DIR in \$(find ~/samples/* -maxdepth 0 -type d); do
cd \$DIR
make build
make run
done
"""
dcap.ContainerRun("${DOCKER_REGISTRY}/dcapdockerciregistry-ubuntu${version}:latest", "clang-10", task, "--cap-add=SYS_PTRACE --device /dev/sgx:/dev/sgx --volume /var/run/aesmd/aesm.socket:/var/run/aesmd/aesm.socket")
}
}
}
}

parallel "ACC1604 SGX1-FLC Container RelWithDebInfo" : { ACCContainerTest('ACC-1604', '16.04') },
"ACC1804 SGX1-FLC Container RelWithDebInfo" : { ACCContainerTest('ACC-1804', '18.04') },
"ACC1604 SGX1-FLC clang-8 Debug" : { ACCTest('ACC-1604', '16.04', 'clang-8', 'Debug') },
"ACC1604 SGX1-FLC clang-8 Release" : { ACCTest('ACC-1604', '16.04', 'clang-8', 'Release') },
"ACC1604 SGX1-FLC clang-8 RelWithDebInfo" : { ACCTest('ACC-1604', '16.04', 'clang-8', 'RelWithDebInfo') },
"ACC1804 SGX1-FLC clang-8 Debug" : { ACCTest('ACC-1804', '18.04', 'clang-8', 'Debug') },
"ACC1804 SGX1-FLC clang-8 Release" : { ACCTest('ACC-1804', '18.04', 'clang-8', 'Release') },
"ACC1804 SGX1-FLC clang-8 RelWithDebInfo" : { ACCTest('ACC-1804', '18.04', 'clang-8', 'RelWithDebInfo') },
"ACC1604 OpenEnclave Release Test" : { ACCTestOeRelease('ACC-1604','16.04') },
"ACC1804 OpenEnclave Release Test" : { ACCTestOeRelease('ACC-1804','18.04') }
parallel "ACC1804 SGX1-FLC Container RelWithDebInfo" : { ACCContainerTest('ACC-1804', '18.04') },
"ACC1804 SGX1-FLC clang-10 Debug" : { ACCTest('ACC-1804', '18.04', 'clang-10', 'Debug') },
"ACC1804 SGX1-FLC clang-10 RelWithDebInfo" : { ACCTest('ACC-1804', '18.04', 'clang-10', 'RelWithDebInfo') },
"ACC2004 SGX1-FLC Container RelWithDebInfo" : { ACCContainerTest('ACC-2004', '20.04') },
"ACC2004 SGX1-FLC clang-10 Debug" : { ACCTest('ACC-2004', '20.04', 'clang-10', 'Debug') },
"ACC2004 SGX1-FLC clang-10 RelWithDebInfo" : { ACCTest('ACC-2004', '20.04', 'clang-10', 'RelWithDebInfo') },
"ACC1804 OpenEnclave Release Test" : { ACCTestOeRelease('ACC-1804','18.04') },
"ACC2004 OpenEnclave Release Test" : { ACCTestOeRelease('ACC-2004','20.04') }
Loading

0 comments on commit b8f8901

Please sign in to comment.