rtDownload in Jenkins Pipeline - jenkins

I am using rtDownload DSL block of the Jenkins JFrog Artifactory plugin in my Jenkins pipeline to download some artifacts from Artifactory.
Is there anyway I can throw an error, if the files to download are not found in Artifactory?
Jenkins justs outputs:
Downloading artifacts using pattern: libs-release-local/*.ear
Beginning to resolve Build Info published dependencies.
Finished resolving Build Info published dependencies.
Finished: SUCCESS

Related

Jenkins Artifactory Plugin: upload custom files in the middle of the a build

How can I upload files to an Artifactory by Jenkins Artifactory Plugin in the middle of the build? After uploading, the job will trigger another job which will download the artifact from the Artifactory. Arching artifacts in the Jenkins jobs is not an option for me because we should keep artifacts in Artifactory.
I could use curl to upload to the Artifactory, but I need to have old builds discarding (by Jenkins Artifactory Plugin). I could use "Generic-Artifactory Integration" in the jobs configuration, but it uploads only at the end of the job build.
We have used the jfrog cli to do this on generic jobs. Be sure to include the —build-name and —build-number options to have your artifacts collected correctly when the Artifactory plugin publishes the build info.

Is it possible to upload Jenkins artifacts to Artifactory even if the build fails?

We are using the "Generic-Artifactory Integration" (with legacy pattern) in our Jenkins jobs to upload artifacts.
Is it somehow possible to upload the artifacts even if the build fails?
I don't seem to find an option on the configuration page (Freestyle build).
It isn't a good practice to upload an artifact if your build fail. I recomend you to create a new pipeline or to edit your actual pipeline.
If your artifact is building sucessfully but your pipeline if failing you can upload it using Jfrog Cli with this command in your pipeline code:
For packed (jar, zip...) artifact:
jfrog rt upload "JENKINS_PATH_TO_YOUR_ARTIFACT/*" YOUR_ARTIFACTORY_REPO/
For unzip or unpacked artifact:
jfrog rt upload --flat=false "JENKINS_PATH_TO_YOUR_ARTIFACT/*" YOUR_ARTIFACTORY_REPO/
Check Jfrog Cli manual:
Jfrog Cli
Check my post with similar task using Bamboo: Upload artifact to Jfrog Artifactory using Jfrog CLI

Not able to download war file from artifactory by the link created in jenkins console output log

I have added Artifactory plugin in Jenkins and was trying to move the build to Artifactory with the help of the Jenkins Artifactory plugin. I have created a sample Maven project.
The build creation is successful and I am getting a URL of Artifactory on console output of Jenkins which tells that my build has been sent to Artifactory. If I am clicking the URL it, I should get my war downloaded but this is not happening. I am getting 404.
I am using Jenkins 1.617 and JFrog Artifactory 3.8.0
If I am using jfrog artifactory 2.6.4 its working but with other release its not working.
below is the log
Waiting for Jenkins to finish collecting data
[JENKINS] Archiving /root/.jenkins/jobs/TestJob/workspace/pom.xml to org.ABC/testapp/0.0.1-SNAPSHOT/testapp-0.0.1-SNAPSHOT.pom
[JENKINS] Archiving /root/.jenkins/jobs/TestJob/workspace/target/testapp-0.0.1-SNAPSHOT.war to org.ABC/testapp/0.0.1-SNAPSHOT/testapp-0.0.1-SNAPSHOT.war
channel stopped
Deploying artifacts to http:192.168.X.X:8080
Deploying artifacts of module: org.ABC:testapp
Deploying artifact: http://192.168.X.X:8080/libs-snapshot-local/org/ABC/testapp/0.0.1-SNAPSHOT/testapp-0.0.1-SNAPSHOT.war
Deploying artifact: http://192.168.X.X:8080/libs-snapshot-local/org/ABC/testapp/0.0.1-SNAPSHOT/testapp-0.0.1-SNAPSHOT.pom
Deploying build info to: http192.168.X.X:8080/test/build
I looks like the log output is buggy. The url http192.168.X.X:8080/test/build should, of course, be http://192.168.X.X:8080/test/build.
Please report it in GitHub Jenkins plugin repo.
Thanks!

Copy task does not download artifact from artifactory

I have configured a Multi Job in Jenkins which contains 2 jobs Build and Deploy which executes build.gradle file.
Build job compiles a sample web application, creates a war file and publishes it to Artifactory.
Deploy job downloads the published job from the Artifactory and deploys it to the tomcat container.
The problem I am facing is, After the Build job has completed executing the Artifacts are published at the correct location in the Artifactory like libs-alpha-local\com\myorg\myfile\1.0.1\myfile-1.0.1.war.
But the Deploy job is failing to download the Artifact from the Artifactory. Below is the task I have for downloading the Artifact from the Artifactory.
configurations {
deploy
}
dependencies {
deploy group:"$project.group",
name:"$project.name",version:"$project.version",ext: "war"
}
task downloadMyArchive(type: Copy) {
from configurations.deploy
into "$buildDir/download"
}
When I run the task, I get the message
Skipping task ':downloadMyArchive' as it has no source files
I want to use only gradle script for downloading the Artifactory and not use any plugins.

Fail A Jenkins Build When Artifatory Plugin Cannot Find All Artifacts

I have a Gradle build that runs in Jenkins and Deploys to Artifactory using the Artifactory plugin for Jenkins. Right now if one of the artifacts is missing a message, "Skipping non-existent file ...", is placed in the console output.
Is it possible to fail the Jenkins job if some of the artifacts are missing?
Can I make sure it only deploys to Artifactory if all of the artifacts are present?

Resources