我是新的Jenkins,使用 jenkins 1.651.3 部署在 Tomcat6上的战争
有没有办法从jenkins UI控制台本身下载Jenkins作业的输出文件(我的作业生成了一个jar文件)?
那么,有没有人可以建议我有任何方法或插件可以使每个Jenkins构建输出文件(如Jar / War)从Jenkins服务器机器下载
[INFO]
[INFO] --- maven-jar-plugin:2.4:jar (default-jar) @ NumberGenerator ---
[INFO] Building jar: /opt/cloudhost/jenkinsHome/jobs/TestGiby/workspace/NumberGenerator/target/NumberGenerator-0.0.1-SNAPSHOT.jar
[INFO]
[INFO] --- maven-install-plugin:2.4:install (default-install) @ NumberGenerator ---
[INFO] Installing /opt/cloudhost/jenkinsHome/jobs/TestGiby/workspace/NumberGenerator/target/NumberGenerator-0.0.1-SNAPSHOT.jar to /opt/cloudhost/software/maven/mavenRepo/com/giby/maven/NumberGenerator/0.0.1-SNAPSHOT/NumberGenerator-0.0.1-SNAPSHOT.jar
[INFO] Installing /opt/cloudhost/jenkinsHome/jobs/TestGiby/workspace/NumberGenerator/pom.xml to /opt/cloudhost/software/maven/mavenRepo/com/giby/maven/NumberGenerator/0.0.1-SNAPSHOT/NumberGenerator-0.0.1-SNAPSHOT.pom
[INFO] ------------------------------------------------------------------------
[INFO] BUILD SUCCESS
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 2.575 s
[INFO] Finished at: 2017-02-01T05:00:44+00:00
[INFO] Final Memory: 19M/607M
[INFO] ------------------------------------------------------------------------
Finished: SUCCESS
答案 0 :(得分:18)
答案 1 :(得分:3)
好吧,您可以右键单击“查看为未格式化的文本”,然后选择“另存为”以将日志保存到PC上。
答案 2 :(得分:1)
以防万一有人正在搜索如何在Jenkinsfile中启用此选项,我将举一个示例,说明我从MariaDB数据库中备份单个表,然后从作业构建中下载它的方法:)
stage('Backup') {
steps {
script {
sh "rm -rf db.dump.sql*"
withCredentials([usernamePassword(credentialsId: 'my-database-credentials', passwordVariable: 'DB_PASSWORD', usernameVariable: 'DB_USERNAME')]) {
sh """docker run --rm -t \
-v $WORKSPACE:/data \
--entrypoint mysqldump \
mariadb -v \
-P 3306 \
-h ${DB_HOST} \
-u master \
--password="${DB_PASSWORD}" \
--default-character-set=latin1 \
--skip-lock-tables --skip-add-locks \
--single-transaction --add-drop-table --complete-insert \
--result-file="/data/db.dump.sql" ${DATABASE_NAME} ${TABLE_NAME}"""
}
sh "du -sh db.dump.sql"
archiveArtifacts artifacts: 'db.dump.sql', excludes: 'output/*.md'
}
}
}
只需在您的Jenkinsfile脚本中添加以下行
archiveArtifacts artifacts: 'db.dump.sql', excludes: 'output/*.md'
答案 3 :(得分:0)