I am new Jenkins , using War deployed on 上的 War
Is there any way to download Jenkins job's output file ( my job produced a jar file ) from jenkins UI Console itself ?
So, could anyone suggest me is there any way or plugin available to make the each Jenkins build output files ( like Jar/War) as downloadable from the Jenkins server machine
[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
Use Archive the artifacts
post-build step, it copies the selected artifacts in the artifacts folder.
Then you will be able to download the file from build page itself.
For Pipeline you need to add it in the pipeline script itself. Check for the corresponding groovy script for archive the artifacts or find the below example (this is a working code).
post {
always {
archive "project/embsw/debug/**/*"
stash includes: 'project/embsw/debug/project_R0.bin', name: 'debugBuiltArtifacts'
}
}
好吧,您可以右键单击“查看为无格式文本”并选择“将链接另存为”以将日志保存在您的 PC 上。
Just in case someone is searching how to enable this option in a Jenkinsfile, I will put an example down where I do a backup of a single table from a MariaDB database and then download it from the job build :)
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'
}
}
}
Just add the following line in your Jenkinsfile script
archiveArtifacts artifacts: 'db.dump.sql', excludes: 'output/*.md'
Reference: test and artifacts
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.