美文网首页
Jenkins安装与部署

Jenkins安装与部署

作者: hongzhenw | 来源:发表于2020-08-27 15:17 被阅读0次

部署所需要的环境资源

centos6.5、jeknkins 2.235.4、tomcat7、jdk1.8、ant1.9.6、Android build-tools-23.0.2、gradle-2.4

  1. 在/etc/profile文件内,配置所需要的环境变量,如下:
# jdk
JAVA_HOME=/usr/local/software/jdk1.8.0_241
JRE_HOME=/usr/local/software/jdk1.8.0_241/jre
PATH=$PATH:$JAVA_HOME/bin:$JRE_HOME/bin
CLASSPATH=.:$JAVA_HOME/lib/dt.jar:$JAVA_HOME/lib/tools.jar:$JRE_HOME/lib
export JAVA_HOME JRE_HOME PATH CLASSPATH

# gradle
export PATH=${PATH}:/usr/local/soft/gradle-2.4/bin

# ant
export PATH=${PATH}:/usr/local/soft/apache-ant-1.9.6/bin

# android
export PATH=${PATH}:/usr/local/soft/sdk/tools
export PATH=${PATH}:/usr/local/soft/sdk/platform-tools
export PATH=${PATH}:/usr/local/soft/sdk/build-tools/23.0.2
  1. 把从jenkins官网下载的jenkins.war放置在tomcat/webapps下,并启动tomcat,访问地址:localhost:8080/jenkins(根据需要设置账号密码、以及所需的插件)

  2. 部署成功!


    image.png

对Android APK重新签名打包

  1. 新建item -> freestyle project,工程名称:android_apk_signature,并点击“配置”,如图:


    image.png
  2. 构建shell命令,如图:


    image.png
# 删除上次打包的APK(可选)
rm -rf for_debug_signature_align.apk

# 设置工程名称
PROJECT_NAME=android_apk_signature

# 对APK进行重新签名打包
mv signature.apk ${PROJECT_NAME}.zip
unzip ${PROJECT_NAME}.zip
rm -rf META-INF
rm -rf ${PROJECT_NAME}.zip
zip -r Android_debug.zip ./*
mv Android_debug.zip Android_debug.apk

jarsigner -digestalg SHA1 -verbose -keystore /usr/local/soft/exteneraljars/debug.keystore -signedjar Android_debug_signature.apk Android_debug.apk androiddebugkey -storepass password
zipalign -v 4 Android_debug_signature.apk for_debug_signature_align.apk

# 除签名后的APK,其它文件全部删除
ls | grep -v for_debug_signature_align.apk | xargs rm -rf

echo 'sinature apk finish'
  1. 完成!


    image.png

相关文章

网友评论

      本文标题:Jenkins安装与部署

      本文链接:https://www.haomeiwen.com/subject/akbcsktx.html