Back to home

部署配置jenkins

参考:
执行命令:
docker run -d --name jenkins -p 8080:8080 -p 50000:50000 -v /mnt/disk2/jenkins/data/:/var/jenkins_home jenkins

访问:
账号:
admin:`cat /var/jenkins_home/secrets/initialAdminPassword`
super:admin@xxx'syyyyyy

配置内网账号登陆后,上面的账号将失效
代码静态检查:
pylint --rcfile=pylintrc -f parseable PVD-NCSS-V3.0R00F01/controller/bin/nsfocus/controller/* > pylint.log || echo
pylint --rcfile=pylintrc -f parseable --ignore=package PVD-NCSS-V3.0R00F01/platform/* >> pylint.log || exit 0

代码量统计:
export TOOLS_HOME=$HOME/tools
export STATSVN_JAR=$TOOLS_HOME/statsvn-0.7.0/statsvn.jar
export SVNLOG=svnlog.xml
export SRC_HOME=PVD-NCSS-V3.0R00F01
export STATSVN_REPORT=statsvn_report

mkdir -p $STATSVN_REPORT
svn log $SVN_URL -v --xml > $SVNLOG
java -jar $STATSVN_JAR $SVNLOG $SRC_HOME -output-dir $STATSVN_REPORT -charset utf-8 -include **/*.py -exclude "platform/package/**"

epydoc生成API文档
#pip install epydoc -i http://10.6.48.4:8080/simple --trusted-host 10.6.48.4 #may be need another proper version of epydoc
#pip install requests
#pip install lxml
#pip install pytz
#apt-get install graphviz

#File "/usr/local/lib/python2.7/dist-packages/epydoc/cli.py", line 1417, in _report
# sys.stdout.write(message)
#UnicodeEncodeError: 'ascii' codec can't encode characters in position 538-543: ordinal not in range(128)

export SRC_HOME=PVD-NCSS-V3.0R00F01
export THIRDLIB_HOME=$SRC_HOME/controller/product/build/packages
export PYTHONPATH=$PYTHONPATH:$THIRDLIB_HOME/Django-1.11.1/:$THIRDLIB_HOME/djangorestframework-3.6.3:$SRC_HOME/platform:$SRC_HOME/controller/bin/nsfocus/controller:$SRC_HOME/controller/bin/nsfocus/lib
export DOC_HOME=epy_doc

mkdir -p $DOC_HOME
epydoc -v -o $DOC_HOME --name ncss --graph all $SRC_HOME/platform/* $SRC_HOME/controller/bin/nsfocus/controller/* --debug || exit 0

epydoc出现不能访问的状况时,在jenkins的系统命令中执行:
System.setProperty("hudson.model.DirectoryBrowserSupport.CSP", "")
sphinx生成API文档
#pip install Sphinx
#pip install sphinx_rtd_theme

export SRC_HOME=PVD-NCSS-V3.0R00F01
export SPHINX_HOME=sphinx
export DOC_HOME=$SPHINX_HOME

#cd $SPHINX_HOME
#sphinx-quickstart

mkdir -p $DOC_HOME
sphinx-apidoc -f -o "$SPHINX_HOME/source/" $SRC_HOME/platform/
sphinx-apidoc -f -o "$SPHINX_HOME/source/" $SRC_HOME/controller/bin/nsfocus/controller/
make -C $SPHINX_HOME html || exit 0

apidoc生成API文档