可信节点打包环境部署及jenkins构建配置

  • 一. 可信节点打包环境部署
  • 1.1 安装jdk、apache-maven、go
  • 1.1.1 安装jdk1.8.0_131
  • 1.1.2 安装go
  • 1.1.3 安装java的打包工具maven
  • 1.2 构建本地管理端的打包目录
  • 1.3 从gitlab下载节点代码
  • 二. 将打包服务器的公钥上传到gitlab
  • 三. 将打包脚本manual_build.sh拷贝到/root/build/目录下,并赋给执行权限
  • 四. 配置打包服务器免密钥登录文件服务器,用于将安装包上传文件服务器
  • 五. jenkins构建打包
  • 5.1 在打包环境服务器上生成公钥私钥对
  • 5.2 在jenkins上为打包环境服务器创建credentials
  • 5.3 在jenkins上为打包环境服务器添加SSH remote hosts
  • 5.4 在jenkins上创建项目
  • 六 错误解决
  • 6.1 go build报错go: /andy1219111/goutils@v1.0.2: Get "https://goproxy.cn//andy1219111/goutils/@v/v1.0.2.mod": x509: certificate signed by unknown authority
  • 6.2 make[1]: go:命令未找到 make[1]: *** [cred_proxy] 错误 127


一. 可信节点打包环境部署

jenkins ssh远程执行命令 jenkins ssh remote hosts_jenkins

1.1 安装jdk、apache-maven、go

1.1.1 安装jdk1.8.0_131

  1. 将 jdk1.8.0_131.tar.gz 拷贝至 /usr/local/ 目录下,执行 tar -zxvf jdk1.8.0_131.tar.gz 对jdk进行解压。
  2. 设置jdk的环境变量,打开 /etc/profile 文件,在文件的最后天下如下内容:
export JAVA_HOME=/usr/local/jdk1.8.0_131
export CLASSPATH=.:$JAVA_HOME/jre/lib/rt.jar:$JAVA_HOME/lib/dt.jar:$JAVA_HOME/lib/tools.jar
export PATH=$PATH:$JAVA_HOME/bin
  1. 保存。执行 source /etc/profile 使环境变量生效。执行 java -version ,打印出如下信 息说明安装成功。

jenkins ssh远程执行命令 jenkins ssh remote hosts_maven_02

  1. 如果不是这个版本的java,说明系统有自带的java,用如下方法修改

jenkins ssh远程执行命令 jenkins ssh remote hosts_java_03


jenkins ssh远程执行命令 jenkins ssh remote hosts_java_04


将/usr/bin/java软链接到/usr/local/jdk1.8.0_131/bin/java

root@Linx:~# rm /usr/bin/java
root@Linx:~# ln -s /usr/local/jdk1.8.0_131/bin/java /usr/bin/java
root@Linx:~# ll /usr/bin/java
lrwxrwxrwx 1 root root 32 10月  9 23:33 /usr/bin/java -> /usr/local/jdk1.8.0_131/bin/java

1.1.2 安装go

  1. 将 go1.15.8.tar.gz 拷贝至 /usr/local/ 目录下,执行 tar -zxvf go1.15.8.tar.gz 对go 安装包进行解压。
  2. 设置go的环境变量,打开 /etc/profile 文件,按照如下内容修改文件:
export PATH=$PATH:$JAVA_HOME/bin:/usr/local/go/bin
  1. 保存。执行 source /etc/profile 使环境变量生效。执行命令 go version , 打印如下输出说明安装成功:
root@Linx:~# go version
go version go1.15.8 linux/amd64
  1. 执行命令 go env -w GO111MODULE=on ,再执行命令 go env -w GOPROXY=https://goproxy.cn,direct 来设置go proxy
root@Linx:~# go env -w GO111MODULE=on
root@Linx:~# go env -w GOPROXY=https://goproxy.cn,direct

1.1.3 安装java的打包工具maven

  1. 将 apache-maven-3.5.4-bin.tar.gz 拷贝至 /usr/local/ 目录下,执行 tar -zxvf apache-maven-3.5.4-bin.tar.gz 对maven安装包进行解压。
  2. 设置maven的环境变量,打开 /etc/profile 文件,按照如下内容修改文件:
export JAVA_HOME=/usr/local/jdk1.8.0_131
export CLASSPATH=.:$JAVA_HOME/jre/lib/rt.jar:$JAVA_HOME/lib/dt.jar:$JAVA_HOME/lib/tools.jar
export MAVEN_HOME=/usr/local/apache-maven-3.5.4 
export PATH=$PATH:$JAVA_HOME/bin:/usr/local/go/bin:$MAVEN_HOME/bin
  1. 保存。执行 source /etc/profile 使环境变量生效。执行命令 mvn --version , 打印如下输出说明安装成功:
root@Linx:~# mvn --version
Apache Maven 3.5.4 (1edded0938998edf8bf061f1ceb3cfdeccf443fe; 2018-06-18T02:33:14+08:00)
Maven home: /usr/local/apache-maven-3.5.4
Java version: 1.8.0_131, vendor: Oracle Corporation, runtime: /usr/local/jdk1.8.0_131/jre
Default locale: zh_CN, platform encoding: UTF-8
OS name: "linux", version: "4.9.0-0.bpo.1-linx-security-amd64", arch: "amd64", family: "unix"
root@Linx:~#

1.2 构建本地管理端的打包目录

  1. 将 java.zip 解压到 /root 下,这里面包含了给本地管理端打包所用到的环境。
root@Linx:~# unzip java.zip 
Archive:  java.zip
  inflating: java/application.properties  
  inflating: java/bcprov-jdk15on-1.55.jar  
  inflating: java/gtk2.18.9.tar.gz   
  inflating: java/jdk1.8.0_181.tar.gz  
   creating: java/mykey/
  inflating: java/mykey/client.jks   
  inflating: java/tstclogin  
  root@Linx:~# ll /root/java/
总用量 202832
-rw-r--r-- 1 root root       195 10月  8 16:08 application.properties
-rw-r--r-- 1 root root   3398948 3月  12  2021 bcprov-jdk15on-1.55.jar
-rw-r--r-- 1 root root  18183341 3月  23  2021 gtk2.18.9.tar.gz
-rw-r--r-- 1 root root 186097460 10月  8 16:08 jdk1.8.0_181.tar.gz
drwxr-xr-x 2 root root      4096 10月  8 16:07 mykey
-rwxr-xr-x 1 root root      1288 10月  8 16:09 tstclogin
  1. 解压完成之后,在 /root/java 下执行 git clone git@192.168.30.2:kexin/localmgr.git将客户端的代码克隆在这里
root@Linx:~/java# git clone ssh://git@192.168.30.2/kexin/localmgr.git
正克隆到 'localmgr'...
The authenticity of host '[192.168.30.2] ([192.168.30.2])' can't be established.
ECDSA key fingerprint is SHA256:QT1jjIYi5jOe2Z/ojvPXJ6lK5KeJ8yoKue9o9eZ0l+c.
Are you sure you want to continue connecting (yes/no)? yes
Warning: Permanently added '[192.168.30.2]' (ECDSA) to the list of known hosts.
remote: Enumerating objects: 287, done.
remote: Counting objects: 100% (287/287), done.
remote: Compressing objects: 100% (168/168), done.
remote: Total 3983 (delta 120), reused 135 (delta 63)
接收对象中: 100% (3983/3983), 2.09 MiB | 498.00 KiB/s, 完成.
处理 delta 中: 100% (2173/2173), 完成.
检查连接... 完成。
root@Linx:~/java# ll
总用量 202836
-rw-r--r-- 1 root root       195 10月  8 16:08 application.properties
-rw-r--r-- 1 root root   3398948 3月  12  2021 bcprov-jdk15on-1.55.jar
-rw-r--r-- 1 root root  18183341 3月  23  2021 gtk2.18.9.tar.gz
-rw-r--r-- 1 root root 186097460 10月  8 16:08 jdk1.8.0_181.tar.gz
drwxr-xr-x 4 root root      4096 10月 10 02:53 localmgr
drwxr-xr-x 2 root root      4096 10月  8 16:07 mykey
-rwxr-xr-x 1 root root      1288 10月  8 16:09 tstclogin
root@Linx:~/java# ll localmgr/
总用量 2700
-rw-r--r-- 1 root root    3413 10月 10 02:53 localmgr.iml
-rw-r--r-- 1 root root    5945 10月 10 02:53 pom.xml
drwxr-xr-x 4 root root    4096 10月 10 02:53 src
-rw-r--r-- 1 root root 2748416 10月 10 02:53 stc_node.db
root@Linx:~/java#

现在该目录的内容应该为:

jenkins ssh远程执行命令 jenkins ssh remote hosts_maven_05

  1. 执行命令 mvn install:install-file -DgroupId=org.bouncycastle -DartifactId=jss -Dversion=1.55 -Dpackaging=jar -Dfile=/root/java/bcprov-jdk15on-1.55.jar 安装需要的包,此时要注意”-Dfile”的路径 对不对。
root@Linx:~/java# cd
root@Linx:~# mvn install:install-file -DgroupId=org.bouncycastle -DartifactId=jss -Dversion=1.55 -Dpackaging=jar -Dfile=/root/java/bcprov-jdk15on-1.55.jar
[INFO] Scanning for projects...
Downloading from central: https://repo.maven.apache.org/maven2/org/apache/maven/plugins/maven-clean-plugin/2.5/maven-clean-plugin-2.5.pom
Downloaded from central: https://repo.maven.apache.org/maven2/org/apache/maven/plugins/maven-clean-plugin/2.5/maven-clean-plugin-2.5.pom (3.9 kB at 1.0 kB/s)
Downloading from central: https://repo.maven.apache.org/maven2/org/apache/maven/plugins/maven-plugins/22/maven-plugins-22.pom
Downloaded from central: https://repo.maven.apache.org/maven2/org/apache/maven/plugins/maven-plugins/22/maven-plugins-22.pom (13 kB at 6.4 kB/s)
Downloading from central: https://repo.maven.apache.org/maven2/org/apache/maven/maven-parent/21/maven-parent-21.pom
Downloaded from central: https://repo.maven.apache.org/maven2/org/apache/maven/maven-parent/21/maven-parent-21.pom (26 kB at 15 kB/s)
Downloading from central: https://repo.maven.apache.org/maven2/org/apache/apache/10/apache-10.pom
Downloaded from central: https://repo.maven.apache.org/maven2/org/apache/apache/10/apache-10.pom (15 kB at 9.2 kB/s)
Downloading from central: https://repo.maven.apache.org/maven2/org/apache/maven/plugins/maven-clean-plugin/2.5/maven-clean-plugin-2.5.jar
Downloaded from central: https://repo.maven.apache.org/maven2/org/apache/maven/plugins/maven-clean-plugin/2.5/maven-clean-plugin-2.5.jar (25 kB at 14 kB/s)
Downloading from central: https://repo.maven.apache.org/maven2/org/apache/maven/plugins/maven-install-plugin/2.4/maven-install-plugin-2.4.pom
Downloaded from central: https://repo.maven.apache.org/maven2/org/apache/maven/plugins/maven-install-plugin/2.4/maven-install-plugin-2.4.pom (6.4 kB at 10 kB/s)
Downloading from central: https://repo.maven.apache.org/maven2/org/apache/maven/plugins/maven-plugins/23/maven-plugins-23.pom
Downloaded from central: https://repo.maven.apache.org/maven2/org/apache/maven/plugins/maven-plugins/23/maven-plugins-23.pom (9.2 kB at 16 kB/s)
Downloading from central: https://repo.maven.apache.org/maven2/org/apache/maven/maven-parent/22/maven-parent-22.pom
Downloaded from central: https://repo.maven.apache.org/maven2/org/apache/maven/maven-parent/22/maven-parent-22.pom (30 kB at 13 kB/s)
Downloading from central: https://repo.maven.apache.org/maven2/org/apache/apache/11/apache-11.pom
Downloaded from central: https://repo.maven.apache.org/maven2/org/apache/apache/11/apache-11.pom (15 kB at 15 kB/s)
Downloading from central: https://repo.maven.apache.org/maven2/org/apache/maven/plugins/maven-install-plugin/2.4/maven-install-plugin-2.4.jar
Downloaded from central: https://repo.maven.apache.org/maven2/org/apache/maven/plugins/maven-install-plugin/2.4/maven-install-plugin-2.4.jar (27 kB at 19 kB/s)
[INFO] 
[INFO] ------------------< org.apache.maven:standalone-pom >-------------------
[INFO] Building Maven Stub Project (No POM) 1
[INFO] --------------------------------[ pom ]---------------------------------
[INFO] 
[INFO] --- maven-install-plugin:2.4:install-file (default-cli) @ standalone-pom ---
Downloading from central: https://repo.maven.apache.org/maven2/org/apache/maven/maven-plugin-api/2.0.6/maven-plugin-api-2.0.6.pom
Downloaded from central: https://repo.maven.apache.org/maven2/org/apache/maven/maven-plugin-api/2.0.6/maven-plugin-api-2.0.6.pom (1.5 kB at 4.3 kB/s)
Downloading from central: https://repo.maven.apache.org/maven2/org/apache/maven/maven/2.0.6/maven-2.0.6.pom
Downloaded from central: https://repo.maven.apache.org/maven2/org/apache/maven/maven/2.0.6/maven-2.0.6.pom (9.0 kB at 6.7 kB/s)
Downloading from central: https://repo.maven.apache.org/maven2/org/apache/maven/maven-parent/5/maven-parent-5.pom
Downloaded from central: https://repo.maven.apache.org/maven2/org/apache/maven/maven-parent/5/maven-parent-5.pom (15 kB at 9.5 kB/s)
Downloading from central: https://repo.maven.apache.org/maven2/org/apache/apache/3/apache-3.pom
Downloaded from central: https://repo.maven.apache.org/maven2/org/apache/apache/3/apache-3.pom (3.4 kB at 8.0 kB/s)
Downloading from central: https://repo.maven.apache.org/maven2/org/apache/maven/maven-project/2.0.6/maven-project-2.0.6.pom
Downloaded from central: https://repo.maven.apache.org/maven2/org/apache/maven/maven-project/2.0.6/maven-project-2.0.6.pom (2.6 kB at 4.2 kB/s)
Downloading from central: https://repo.maven.apache.org/maven2/org/apache/maven/maven-settings/2.0.6/maven-settings-2.0.6.pom
Downloaded from central: https://repo.maven.apache.org/maven2/org/apache/maven/maven-settings/2.0.6/maven-settings-2.0.6.pom (2.0 kB at 2.0 kB/s)
Downloading from central: https://repo.maven.apache.org/maven2/org/apache/maven/maven-model/2.0.6/maven-model-2.0.6.pom
Downloaded from central: https://repo.maven.apache.org/maven2/org/apache/maven/maven-model/2.0.6/maven-model-2.0.6.pom (3.0 kB at 6.1 kB/s)
Downloading from central: https://repo.maven.apache.org/maven2/org/codehaus/plexus/plexus-utils/1.4.1/plexus-utils-1.4.1.pom
Downloaded from central: https://repo.maven.apache.org/maven2/org/codehaus/plexus/plexus-utils/1.4.1/plexus-utils-1.4.1.pom (1.9 kB at 2.0 kB/s)
Downloading from central: https://repo.maven.apache.org/maven2/org/codehaus/plexus/plexus/1.0.11/plexus-1.0.11.pom
Downloaded from central: https://repo.maven.apache.org/maven2/org/codehaus/plexus/plexus/1.0.11/plexus-1.0.11.pom (9.0 kB at 12 kB/s)
Downloading from central: https://repo.maven.apache.org/maven2/org/codehaus/plexus/plexus-container-default/1.0-alpha-9-stable-1/plexus-container-default-1.0-alpha-9-stable-1.pom
Downloaded from central: https://repo.maven.apache.org/maven2/org/codehaus/plexus/plexus-container-default/1.0-alpha-9-stable-1/plexus-container-default-1.0-alpha-9-stable-1.pom (3.9 kB at 7.2 kB/s)
Downloading from central: https://repo.maven.apache.org/maven2/org/codehaus/plexus/plexus-containers/1.0.3/plexus-containers-1.0.3.pom
Downloaded from central: https://repo.maven.apache.org/maven2/org/codehaus/plexus/plexus-containers/1.0.3/plexus-containers-1.0.3.pom (492 B at 1.5 kB/s)
Downloading from central: https://repo.maven.apache.org/maven2/org/codehaus/plexus/plexus/1.0.4/plexus-1.0.4.pom
Downloaded from central: https://repo.maven.apache.org/maven2/org/codehaus/plexus/plexus/1.0.4/plexus-1.0.4.pom (5.7 kB at 5.9 kB/s)
Downloading from central: https://repo.maven.apache.org/maven2/junit/junit/3.8.1/junit-3.8.1.pom
Downloaded from central: https://repo.maven.apache.org/maven2/junit/junit/3.8.1/junit-3.8.1.pom (998 B at 2.8 kB/s)
Downloading from central: https://repo.maven.apache.org/maven2/org/codehaus/plexus/plexus-utils/1.0.4/plexus-utils-1.0.4.pom
Downloaded from central: https://repo.maven.apache.org/maven2/org/codehaus/plexus/plexus-utils/1.0.4/plexus-utils-1.0.4.pom (6.9 kB at 7.2 kB/s)
Downloading from central: https://repo.maven.apache.org/maven2/classworlds/classworlds/1.1-alpha-2/classworlds-1.1-alpha-2.pom
Downloaded from central: https://repo.maven.apache.org/maven2/classworlds/classworlds/1.1-alpha-2/classworlds-1.1-alpha-2.pom (3.1 kB at 6.0 kB/s)
Downloading from central: https://repo.maven.apache.org/maven2/org/apache/maven/maven-profile/2.0.6/maven-profile-2.0.6.pom
Downloaded from central: https://repo.maven.apache.org/maven2/org/apache/maven/maven-profile/2.0.6/maven-profile-2.0.6.pom (2.0 kB at 2.4 kB/s)
Downloading from central: https://repo.maven.apache.org/maven2/org/apache/maven/maven-artifact-manager/2.0.6/maven-artifact-manager-2.0.6.pom
Downloaded from central: https://repo.maven.apache.org/maven2/org/apache/maven/maven-artifact-manager/2.0.6/maven-artifact-manager-2.0.6.pom (2.6 kB at 6.0 kB/s)
Downloading from central: https://repo.maven.apache.org/maven2/org/apache/maven/maven-repository-metadata/2.0.6/maven-repository-metadata-2.0.6.pom
Downloaded from central: https://repo.maven.apache.org/maven2/org/apache/maven/maven-repository-metadata/2.0.6/maven-repository-metadata-2.0.6.pom (1.9 kB at 4.8 kB/s)
Downloading from central: https://repo.maven.apache.org/maven2/org/apache/maven/maven-artifact/2.0.6/maven-artifact-2.0.6.pom
Downloaded from central: https://repo.maven.apache.org/maven2/org/apache/maven/maven-artifact/2.0.6/maven-artifact-2.0.6.pom (1.6 kB at 1.6 kB/s)
Downloading from central: https://repo.maven.apache.org/maven2/org/apache/maven/maven-plugin-registry/2.0.6/maven-plugin-registry-2.0.6.pom
Downloaded from central: https://repo.maven.apache.org/maven2/org/apache/maven/maven-plugin-registry/2.0.6/maven-plugin-registry-2.0.6.pom (1.9 kB at 2.3 kB/s)
Downloading from central: https://repo.maven.apache.org/maven2/org/codehaus/plexus/plexus-utils/3.0.5/plexus-utils-3.0.5.pom
Downloaded from central: https://repo.maven.apache.org/maven2/org/codehaus/plexus/plexus-utils/3.0.5/plexus-utils-3.0.5.pom (2.5 kB at 4.6 kB/s)
Downloading from central: https://repo.maven.apache.org/maven2/org/codehaus/plexus/plexus/3.1/plexus-3.1.pom
Downloaded from central: https://repo.maven.apache.org/maven2/org/codehaus/plexus/plexus/3.1/plexus-3.1.pom (19 kB at 18 kB/s)
Downloading from central: https://repo.maven.apache.org/maven2/org/sonatype/spice/spice-parent/17/spice-parent-17.pom
Downloaded from central: https://repo.maven.apache.org/maven2/org/sonatype/spice/spice-parent/17/spice-parent-17.pom (6.8 kB at 14 kB/s)
Downloading from central: https://repo.maven.apache.org/maven2/org/sonatype/forge/forge-parent/10/forge-parent-10.pom
Downloaded from central: https://repo.maven.apache.org/maven2/org/sonatype/forge/forge-parent/10/forge-parent-10.pom (14 kB at 17 kB/s)
Downloading from central: https://repo.maven.apache.org/maven2/org/codehaus/plexus/plexus-digest/1.0/plexus-digest-1.0.pom
Downloaded from central: https://repo.maven.apache.org/maven2/org/codehaus/plexus/plexus-digest/1.0/plexus-digest-1.0.pom (1.1 kB at 2.8 kB/s)
Downloading from central: https://repo.maven.apache.org/maven2/org/codehaus/plexus/plexus-components/1.1.7/plexus-components-1.1.7.pom
Downloaded from central: https://repo.maven.apache.org/maven2/org/codehaus/plexus/plexus-components/1.1.7/plexus-components-1.1.7.pom (5.0 kB at 9.1 kB/s)
Downloading from central: https://repo.maven.apache.org/maven2/org/codehaus/plexus/plexus/1.0.8/plexus-1.0.8.pom
Downloaded from central: https://repo.maven.apache.org/maven2/org/codehaus/plexus/plexus/1.0.8/plexus-1.0.8.pom (7.2 kB at 14 kB/s)
Downloading from central: https://repo.maven.apache.org/maven2/org/codehaus/plexus/plexus-container-default/1.0-alpha-8/plexus-container-default-1.0-alpha-8.pom
Downloaded from central: https://repo.maven.apache.org/maven2/org/codehaus/plexus/plexus-container-default/1.0-alpha-8/plexus-container-default-1.0-alpha-8.pom (7.3 kB at 14 kB/s)
Downloading from central: https://repo.maven.apache.org/maven2/org/apache/maven/maven-plugin-api/2.0.6/maven-plugin-api-2.0.6.jar
Downloading from central: https://repo.maven.apache.org/maven2/org/apache/maven/maven-settings/2.0.6/maven-settings-2.0.6.jar
Downloading from central: https://repo.maven.apache.org/maven2/org/apache/maven/maven-project/2.0.6/maven-project-2.0.6.jar
Downloading from central: https://repo.maven.apache.org/maven2/org/apache/maven/maven-profile/2.0.6/maven-profile-2.0.6.jar
Downloading from central: https://repo.maven.apache.org/maven2/org/apache/maven/maven-plugin-registry/2.0.6/maven-plugin-registry-2.0.6.jar
Downloaded from central: https://repo.maven.apache.org/maven2/org/apache/maven/maven-plugin-api/2.0.6/maven-plugin-api-2.0.6.jar (13 kB at 19 kB/s)
Downloading from central: https://repo.maven.apache.org/maven2/org/codehaus/plexus/plexus-container-default/1.0-alpha-9-stable-1/plexus-container-default-1.0-alpha-9-stable-1.jar
Downloaded from central: https://repo.maven.apache.org/maven2/org/apache/maven/maven-plugin-registry/2.0.6/maven-plugin-registry-2.0.6.jar (29 kB at 29 kB/s)
Downloading from central: https://repo.maven.apache.org/maven2/junit/junit/3.8.1/junit-3.8.1.jar
Downloaded from central: https://repo.maven.apache.org/maven2/org/apache/maven/maven-profile/2.0.6/maven-profile-2.0.6.jar (35 kB at 35 kB/s)
Downloading from central: https://repo.maven.apache.org/maven2/classworlds/classworlds/1.1-alpha-2/classworlds-1.1-alpha-2.jar
Downloaded from central: https://repo.maven.apache.org/maven2/org/apache/maven/maven-settings/2.0.6/maven-settings-2.0.6.jar (49 kB at 33 kB/s)
Downloading from central: https://repo.maven.apache.org/maven2/org/apache/maven/maven-model/2.0.6/maven-model-2.0.6.jar
Downloaded from central: https://repo.maven.apache.org/maven2/classworlds/classworlds/1.1-alpha-2/classworlds-1.1-alpha-2.jar (38 kB at 23 kB/s)
Downloading from central: https://repo.maven.apache.org/maven2/org/apache/maven/maven-artifact-manager/2.0.6/maven-artifact-manager-2.0.6.jar
Downloaded from central: https://repo.maven.apache.org/maven2/org/apache/maven/maven-project/2.0.6/maven-project-2.0.6.jar (116 kB at 64 kB/s)
Downloading from central: https://repo.maven.apache.org/maven2/org/apache/maven/maven-repository-metadata/2.0.6/maven-repository-metadata-2.0.6.jar
Downloaded from central: https://repo.maven.apache.org/maven2/org/apache/maven/maven-repository-metadata/2.0.6/maven-repository-metadata-2.0.6.jar (24 kB at 10 kB/s)
Downloading from central: https://repo.maven.apache.org/maven2/org/apache/maven/maven-artifact/2.0.6/maven-artifact-2.0.6.jar
Downloaded from central: https://repo.maven.apache.org/maven2/org/apache/maven/maven-model/2.0.6/maven-model-2.0.6.jar (86 kB at 28 kB/s)
Downloading from central: https://repo.maven.apache.org/maven2/org/codehaus/plexus/plexus-utils/3.0.5/plexus-utils-3.0.5.jar
Downloaded from central: https://repo.maven.apache.org/maven2/org/apache/maven/maven-artifact-manager/2.0.6/maven-artifact-manager-2.0.6.jar (57 kB at 17 kB/s)
Downloading from central: https://repo.maven.apache.org/maven2/org/codehaus/plexus/plexus-digest/1.0/plexus-digest-1.0.jar
Downloaded from central: https://repo.maven.apache.org/maven2/junit/junit/3.8.1/junit-3.8.1.jar (121 kB at 37 kB/s)
Downloaded from central: https://repo.maven.apache.org/maven2/org/codehaus/plexus/plexus-digest/1.0/plexus-digest-1.0.jar (12 kB at 3.0 kB/s)
Downloaded from central: https://repo.maven.apache.org/maven2/org/apache/maven/maven-artifact/2.0.6/maven-artifact-2.0.6.jar (87 kB at 19 kB/s)
Downloaded from central: https://repo.maven.apache.org/maven2/org/codehaus/plexus/plexus-utils/3.0.5/plexus-utils-3.0.5.jar (230 kB at 47 kB/s)
Downloaded from central: https://repo.maven.apache.org/maven2/org/codehaus/plexus/plexus-container-default/1.0-alpha-9-stable-1/plexus-container-default-1.0-alpha-9-stable-1.jar (194 kB at 26 kB/s)
[INFO] Installing /root/java/bcprov-jdk15on-1.55.jar to /root/.m2/repository/org/bouncycastle/jss/1.55/jss-1.55.jar
[INFO] Installing /tmp/mvninstall6648652102578073062.pom to /root/.m2/repository/org/bouncycastle/jss/1.55/jss-1.55.pom
[INFO] ------------------------------------------------------------------------
[INFO] BUILD SUCCESS
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 45.481 s
[INFO] Finished at: 2021-10-10T02:58:57+08:00
[INFO] ------------------------------------------------------------------------
root@Linx:~#
  1. 将 sgcc 拷贝到 /root/.m2/repository/com/ 下并覆盖掉原来的。

注意:要先在/root/.m2/repository/目录中手动建立目录com,然后将sgcc.zip复制到com目录下解压

root@Linx:~# cd /root/.m2/repository/
root@Linx:~/.m2/repository# mkdir com
root@Linx:~/.m2/repository# cd com/
root@Linx:~/.m2/repository/com# rz -E
rz waiting to receive.
root@Linx:~/.m2/repository/com# ll
总用量 1636
-rw-r--r-- 1 root root 1671536 9月  27 22:06 sgcc.zip
root@Linx:~/.m2/repository/com# unzip sgcc.zip 
Archive:  sgcc.zip
   creating: sgcc/
   creating: sgcc/asc/
   creating: sgcc/asc/base/
   creating: sgcc/asc/base/base-http/
   creating: sgcc/asc/base/base-http/0.0.1-SNAPSHOT/
  inflating: sgcc/asc/base/base-http/0.0.1-SNAPSHOT/base-http-0.0.1-SNAPSHOT.pom.lastUpdated  
  inflating: sgcc/asc/base/base-http/0.0.1-SNAPSHOT/resolver-status.properties  
   creating: sgcc/asc/base/base-security/
   creating: sgcc/asc/base/base-security/0.0.1-SNAPSHOT/
  inflating: sgcc/asc/base/base-security/0.0.1-SNAPSHOT/base-security-0.0.1-SNAPSHOT.pom.lastUpdated  
  inflating: sgcc/asc/base/base-security/0.0.1-SNAPSHOT/resolver-status.properties  
   creating: sgcc/sip/
   creating: sgcc/sip/sip-access/
   creating: sgcc/sip/sip-access/0.0.2-SNAPSHOT/
  inflating: sgcc/sip/sip-access/0.0.2-SNAPSHOT/resolver-status.properties  
  inflating: sgcc/sip/sip-access/0.0.2-SNAPSHOT/sip-access-0.0.2-SNAPSHOT.pom.lastUpdated  
   creating: sgcc/uap/
   creating: sgcc/uap/SGSM/
   creating: sgcc/uap/SGSM/0.0.1/
  inflating: sgcc/uap/SGSM/0.0.1/m2e-lastUpdated.properties  
  inflating: sgcc/uap/SGSM/0.0.1/SGSM-0.0.1-javadoc.jar.lastUpdated  
  inflating: sgcc/uap/SGSM/0.0.1/SGSM-0.0.1-sources.jar.lastUpdated  
  inflating: sgcc/uap/SGSM/0.0.1/SGSM-0.0.1.jar  
  inflating: sgcc/uap/SGSM/0.0.1/SGSM-0.0.1.jar.lastUpdated  
  inflating: sgcc/uap/SGSM/0.0.1/SGSM-0.0.1.pom  
  inflating: sgcc/uap/SGSM/0.0.1/SGSM-0.0.1.pom.lastUpdated  
  inflating: sgcc/uap/SGSM/0.0.1/_maven.repositories  
  inflating: sgcc/uap/SGSM/0.0.1/_remote.repositories  
  inflating: sgcc/uap/SGSM/maven-metadata-local.xml  
root@Linx:~/.m2/repository/com# ll /root/.m2/repository/com/sgcc
总用量 12
drwxr-xr-x 3 root root 4096 8月  30 17:39 asc
drwxr-xr-x 3 root root 4096 8月  30 17:39 sip
drwxr-xr-x 3 root root 4096 8月  30 17:39 uap
root@Linx:~/.m2/repository/com#
  1. 此时,可以执行 mvn clean package 试着打一次包,第一次会比较慢。
    注意要先进入/root/java/localmgr/这个目录,然后再打包
root@Linx:~# cd /root/java/localmgr/
root@Linx:~/java/localmgr# mvn clean package
[INFO] Scanning for projects...
Downloading from central: https://repo.maven.apache.org/maven2/org/springframework/boot/spring-boot-starter-parent/2.3.2.RELEASE/spring-boot-starter-parent-2.3.2.RELEASE.pom
Downloaded from central: https://repo.maven.apache.org/maven2/org/springframework/boot/spring-boot-starter-parent/2.3.2.RELEASE/spring-boot-starter-parent-2.3.2.RELEASE.pom (8.6 kB at 3.6 kB/s)
Downloading from central: https://repo.maven.apache.org/maven2/org/springframework/boot/spring-boot-dependencies/2.3.2.RELEASE/spring-boot-dependencies-2.3.2.RELEASE.pom
Downloaded from central: https://repo.maven.apache.org/maven2/org/springframework/boot/spring-boot-dependencies/2.3.2.RELEASE/spring-boot-dependencies-2.3.2.RELEASE.pom (122 kB at 17 kB/s)
Downloading from central: https://repo.maven.apache.org/maven2/com/datastax/oss/java-driver-bom/4.6.1/java-driver-bom-4.6.1.pom
Downloaded from central: https://repo.maven.apache.org/maven2/com/datastax/oss/java-driver-bom/4.6.1/java-driver-bom-4.6.1.pom (3.8 kB at 3.8 kB/s)
Downloading from central: https://repo.maven.apache.org/maven2/io/dropwizard/metrics/metrics-bom/4.1.11/metrics-bom-4.1.11.pom
Downloaded from central: https://repo.maven.apache.org/maven2/io/dropwizard/metrics/metrics-bom/4.1.11/metrics-bom-4.1.11.pom (5.3 kB at 3.0 kB/s)
.
.
.
[INFO] Replacing main artifact with repackaged archive
[INFO] ------------------------------------------------------------------------
[INFO] BUILD SUCCESS
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 15:50 min
[INFO] Finished at: 2021-10-10T03:27:09+08:00
[INFO] ------------------------------------------------------------------------

1.3 从gitlab下载节点代码

  1. 创建目录 /root/go/src
  2. 进入该目录下, 依次执行 git clone git@192.168.30.2:kexin/kernel-headers.git , git clone git@192.168.30.2:kexin/trust-boot.git , git clone git@192.168.30.2:kexin/trust-node.git , git clone git@192.168.30.2:kexin/tss-engine.git
root@Linx:~/java/localmgr# mkdir /root//go/src -p
root@Linx:~/java/localmgr# cd /root/go/src/
root@Linx:~/go/src# git clone ssh://git@192.168.9.30:3022/kexin/kernel-headers.git
root@Linx:~/go/src# git clone ssh://git@192.168.9.30:3022/kexin/trust-boot.git
root@Linx:~/go/src# git clone ssh://git@192.168.9.30:3022/kexin/trust-node.git
root@Linx:~/go/src# git clone ssh://git@192.168.9.30:3022/kexin/tss-engine.git

二. 将打包服务器的公钥上传到gitlab

jenkins ssh远程执行命令 jenkins ssh remote hosts_apache_06

jenkins ssh远程执行命令 jenkins ssh remote hosts_jenkins ssh远程执行命令_07

jenkins ssh远程执行命令 jenkins ssh remote hosts_java_08

三. 将打包脚本manual_build.sh拷贝到/root/build/目录下,并赋给执行权限

root@Linx:~# mkdir /root/build
root@Linx:~# cd /root/build/
root@Linx:~/build# rz -E
rz waiting to receive.
root@Linx:~/build# ll
总用量 8
-rw-r--r-- 1 root root 5834 10月  9 09:45 manual_build.sh
root@Linx:~/build# chmod +x manual_build.sh

四. 配置打包服务器免密钥登录文件服务器,用于将安装包上传文件服务器

root@Linx:~# ssh-copy-id -i /root/.ssh/id_rsa.pub root@192.168.9.129
/usr/bin/ssh-copy-id: INFO: Source of key(s) to be installed: "/root/.ssh/id_rsa.pub"
The authenticity of host '192.168.9.129 (192.168.9.129)' can't be established.
ECDSA key fingerprint is SHA256:yytjL4fH8jFtS908bsPl7Ye58yxt8XXH8KmyEcVue58.
Are you sure you want to continue connecting (yes/no)? yes
/usr/bin/ssh-copy-id: INFO: attempting to log in with the new key(s), to filter out any that are already installed
/usr/bin/ssh-copy-id: INFO: 1 key(s) remain to be installed -- if you are prompted now it is to install the new keys
root@192.168.9.129's password: 

Number of key(s) added: 1

Now try logging into the machine, with:   "ssh 'root@192.168.9.129'"
and check to make sure that only the key(s) you wanted were added.

五. jenkins构建打包

5.1 在打包环境服务器上生成公钥私钥对

root@Linx:~# ssh-keygen 
Generating public/private rsa key pair.
Enter file in which to save the key (/root/.ssh/id_rsa): 
Enter passphrase (empty for no passphrase): 
Enter same passphrase again: 
Your identification has been saved in /root/.ssh/id_rsa.
Your public key has been saved in /root/.ssh/id_rsa.pub.
The key fingerprint is:
SHA256:/WuceT787DkVy/Hv460q+qk96ILAEENDXo8AkBPEveM root@Linx
The key's randomart image is:
+---[RSA 2048]----+
|@O..             |
|*.+.o            |
| = ...           |
|.  o     .     o |
| o. .   S .   . =|
|  oE       .   oo|
|   . .   . ..+  o|
|    . . ..o.=.+++|
|       o++++o++OO|
+----[SHA256]-----+
root@Linx:~#

5.2 在jenkins上为打包环境服务器创建credentials

jenkins ssh远程执行命令 jenkins ssh remote hosts_jenkins ssh远程执行命令_09


jenkins ssh远程执行命令 jenkins ssh remote hosts_maven_10


jenkins ssh远程执行命令 jenkins ssh remote hosts_jenkins_11


jenkins ssh远程执行命令 jenkins ssh remote hosts_jenkins ssh远程执行命令_12

jenkins ssh远程执行命令 jenkins ssh remote hosts_java_13

5.3 在jenkins上为打包环境服务器添加SSH remote hosts

jenkins ssh远程执行命令 jenkins ssh remote hosts_java_14


jenkins ssh远程执行命令 jenkins ssh remote hosts_jenkins ssh远程执行命令_15

5.4 在jenkins上创建项目

jenkins ssh远程执行命令 jenkins ssh remote hosts_jenkins ssh远程执行命令_16


jenkins ssh远程执行命令 jenkins ssh remote hosts_java_17

六 错误解决

6.1 go build报错go: /andy1219111/goutils@v1.0.2: Get “https://goproxy.cn//andy1219111/goutils/@v/v1.0.2.mod”: x509: certificate signed by unknown authority

解决方法:这一台不报这个错误的打包环境,将其/etc/ssl/certs目录下所有文件复制到这个的相同目录下

6.2 make[1]: go:命令未找到 make[1]: *** [cred_proxy] 错误 127

解决方法:ln -s /usr/local/go/bin/go /usr/bin/go