You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@teaclave.apache.org by sh...@apache.org on 2022/11/11 05:17:43 UTC

[incubator-teaclave-java-tee-sdk] 03/48: [tools] Add jenkins CI build tools for JavaEnclave

This is an automated email from the ASF dual-hosted git repository.

shaojunwang pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/incubator-teaclave-java-tee-sdk.git

commit 0f0ebd5b5a4fb8ffc2f8e93552841cd0aa8b90f4
Author: jeffery.wsj <je...@alibaba-inc.com>
AuthorDate: Tue Jan 18 00:07:19 2022 +0800

    [tools] Add jenkins CI build tools for JavaEnclave
    
    Summary: Add docker environment for JavaEnclave's jenkins CI building
    
    Reviewers: lei.yul, cengfeng.lzy, sanhong.lsh
    
    Issue: https://aone.alibaba-inc.com/task/39207612
    
    CR: https://code.aone.alibaba-inc.com/java-tee/JavaEnclave/codereview/7568185
---
 build.sh                                            | 11 +++++++++++
 sdk/enclave/pom.xml                                 |  4 ++--
 .../alibaba/confidentialcomputing/host/Enclave.java |  2 +-
 sdk/pom.xml                                         |  1 -
 tools/cicd/Dockerfile                               | 11 +++++++++++
 tools/cicd/jenkinsfile                              | 16 ++++++++++++++++
 tools/cicd/make.sh                                  | 21 +++++++++++++++++++++
 7 files changed, 62 insertions(+), 4 deletions(-)

diff --git a/build.sh b/build.sh
new file mode 100644
index 0000000..5368e42
--- /dev/null
+++ b/build.sh
@@ -0,0 +1,11 @@
+#!/bin/bash
+
+# parse shell file's path location.
+SHELL_FOLDER=$(cd "$(dirname "$0")";pwd)
+
+cd "${SHELL_FOLDER}"
+
+# workspace dir is the same as build.sh path location.
+WORKDIR="$PWD"
+
+cd "${WORKDIR}"/sdk && mvn clean package
diff --git a/sdk/enclave/pom.xml b/sdk/enclave/pom.xml
index ebc8afa..7a81e07 100644
--- a/sdk/enclave/pom.xml
+++ b/sdk/enclave/pom.xml
@@ -14,7 +14,7 @@
     <url></url>
     <build>
         <plugins>
-            <!--plugin>
+            <plugin>
                 <groupId>org.jacoco</groupId>
                 <artifactId>jacoco-maven-plugin</artifactId>
                 <version>0.8.3</version>
@@ -38,7 +38,7 @@
                         </goals>
                     </execution>
                 </executions>
-            </plugin-->
+            </plugin>
             <plugin>
                 <groupId>org.apache.maven.plugins</groupId>
                 <artifactId>maven-surefire-plugin</artifactId>
diff --git a/sdk/host/src/main/java/com/alibaba/confidentialcomputing/host/Enclave.java b/sdk/host/src/main/java/com/alibaba/confidentialcomputing/host/Enclave.java
index b1db930..e63541f 100644
--- a/sdk/host/src/main/java/com/alibaba/confidentialcomputing/host/Enclave.java
+++ b/sdk/host/src/main/java/com/alibaba/confidentialcomputing/host/Enclave.java
@@ -43,7 +43,7 @@ import com.alibaba.confidentialcomputing.host.exception.EnclaveDestroyingExcepti
  *    try {
  *        Enclave enclave = EnclaveFactory.create();
  *        ... ... ...
- *        Service provider = enclave.load(Service);
+ *        Service provider = enclave.load(Service.class);
  *        ... ... ...
  *        Object result = provider.invoke();
  *        ... ... ...
diff --git a/sdk/pom.xml b/sdk/pom.xml
index 82b4dc3..24f2a05 100644
--- a/sdk/pom.xml
+++ b/sdk/pom.xml
@@ -38,7 +38,6 @@
         </dependencies>
     </dependencyManagement>
     <modules>
-        <module>log</module>
         <module>enclave</module>
         <module>host</module>
     </modules>
diff --git a/tools/cicd/Dockerfile b/tools/cicd/Dockerfile
new file mode 100644
index 0000000..7ec87da
--- /dev/null
+++ b/tools/cicd/Dockerfile
@@ -0,0 +1,11 @@
+FROM ubuntu:18.04 AS base
+
+LABEL maintainer="Junshao Wang <je...@alibaba-inc.com>"
+
+ENV APT_KEY_DONT_WARN_ON_DANGEROUS_USAGE=1
+ENV DEBIAN_FRONTEND noninteractive
+
+# install openjdk11 and maven.
+RUN apt-get update && \
+    echo -e 'yes\n' | apt-get install -y openjdk-11-jdk && \
+    echo -e 'yes\n' | apt-get install -y maven
diff --git a/tools/cicd/jenkinsfile b/tools/cicd/jenkinsfile
new file mode 100644
index 0000000..ba3a2b0
--- /dev/null
+++ b/tools/cicd/jenkinsfile
@@ -0,0 +1,16 @@
+pipeline {
+         agent {
+             node {
+                 label 'javaenclave_ci_server'
+                 customWorkspace '/home/ci/jenkins/javaenclave'
+             }
+         }
+         stages {
+                 stage('Test and Build JavaEnclave SDK') {
+                 steps {
+                     echo 'Build JavaEnclave SDK:'
+                     sh "./tools/cicd/make.sh"
+                 }
+                 }
+         }
+}
\ No newline at end of file
diff --git a/tools/cicd/make.sh b/tools/cicd/make.sh
new file mode 100755
index 0000000..b488573
--- /dev/null
+++ b/tools/cicd/make.sh
@@ -0,0 +1,21 @@
+#!/bin/bash
+
+BUILD_IMAGE=javaenclave_build
+BUILD_TAG=v0.1.0
+
+SHELL_FOLDER=$(cd "$(dirname "$0")";pwd)
+
+cd "${SHELL_FOLDER}"
+
+WORKDIR=$(dirname $(dirname "$PWD"))
+
+# check target images exist or not, build it if not.
+if [[ "$(docker images -q ${BUILD_IMAGE}:${BUILD_TAG} 2> /dev/null)" == "" ]]; then
+  docker build -t ${BUILD_IMAGE}:${BUILD_TAG} .
+fi
+
+# test JavaEnclave's unit test cases and samples
+docker run -i --rm --privileged --network host                    \
+-w "${WORKDIR}"                                                   \
+-v "${HOME}"/.m2:/root/.m2 -v "${WORKDIR}":"${WORKDIR}"           \
+${BUILD_IMAGE}:${BUILD_TAG} /bin/bash build.sh
\ No newline at end of file


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@teaclave.apache.org
For additional commands, e-mail: commits-help@teaclave.apache.org