1.拉取代码:
mkdir /do1cloud/testplugins cd /do1cloud/testplugins git clone https://github.com/KrisMarko/kr-changelog.git
2.重启jenkins服务
ls /root/.jenkins/plugins cp changelog-environment.hpi /root/.jenkins/plugins/ cd /testcloud/jenkins/apache-tomcat-8.5.60/bin/ ps aux|grep -i jenk kill -9 8654 sh startup.sh
参考:https://www.pianshen.com/article/76911088784/
3.Add Changelog Information to Environment
<li class='work'> <input class='radio' id='%2$s' name='works' type='radio' checked> <div class="relative"> <label for='%2$s'>%3$s</label> <span class='date'>%4$s</span> <span class='circle'></span> </div> <div class='content'> <p>提交人员:%1$s</p> <p>版本标识:%2$s</p> </div> </li>
4.Date Format
MM-dd HH:mm:ss
5.exec shell
# 输出发布记录 echo "${CHANGELOGS_TEMPLATE_PREFIX}" > ${WORKSPACE}/src/changelogs.html echo "<h2>后台管理-版本发布记录</h2> <p>源码分支:${Branch}</p> <p>构建时间:${BUILD_DATETIME}</p> <p>版本标识:${GIT_COMMIT}</p> <ul id='timeline'>" >> ${WORKSPACE}/src/changelogs.html echo "${SCM_CHANGELOG}" >> ${WORKSPACE}/src/changelogs.html echo "${CHANGELOGS_TEMPLATE_SUFFIX}" >> ${WORKSPACE}/src/changelogs.html # 移除旧的发布文件 rm -rf ${WORKSPACE}/manager.zip #echo {WORKSPACE}/wxapp.zip cnpm install cnpm install element-ui@2.3.9 -D #cnpm run build cnpm run hp-test # 打压缩包 cd ${WORKSPACE}/dist/ zip -r ${WORKSPACE}/wxapp.zip * cp ${WORKSPACE}/manager.zip /data/deploy_pack/hpdev/web/wxapp_$(date +%Y%m%d%H%M).zip cp ${WORKSPACE}/manager.zip /data/deploy/packages/hpdev/web/portal/wxapp_$(date +%Y%m%d%H%M).zip chown -R appuser:appuser /data/deploy/packages/hpdev/web/ /data/apps/hp_deploy_dev/bin/mics_dev deploy wxapp