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.
Related
I've created two Jobs in Jenkins, JobB is dependent on JobA.
While configuring JobA, I am doing post build action to deploy artifact in Jfrog and it is successfully deployed.
But while configuring JobB, I am configuring prebuild setup with to find artifacts and providing the detail, when I am running Job I've checked that JobA jar is downloading but then also I am facing compile time issue, I've written repository tag in dependent pom.xml.
But then also I am facing compile time issue.
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.
I'm currently in the process of converting a freestyle job to a pipeline and have a build step that uses the ArtifactDeployer to deploy files from one directory to a remote location.
The ArtifactDeployer plugin on my freestyle job only has couple of fields set, 'Artifacts to deploy' and 'Remote File Location'.
What's the equivalent plugin I should be using that has pipeline support?
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?
My environment uses Gradle for builds, Jenkins for CI, and Artifactory for a repository. I use the Artifactory plugin for Jenkins.
Jenkins successfully builds my main jar file and uploads it to Artifactory. The build script has a second target for creating a distribution zip file under build/distributions. Jenkins creates the zip file successfully, but I don't know how to tell it to upload that artifact to Artifactory, too.
Is this something I should be able to specify in the Jenkins Artifactory plugin config, or something I should define in the Gradle build script? Thanks for any pointers.
You should configure the archives configuration to include all the archives you intend to publish as described in Gradle's user manual. Not only Artifactory will pick up all the files to deploy automatically (without messing with Published Artifacts configuration), you won't even need to run the second task. All the archives will be creating by running the build task.
I assume you have configured artifactory server correctly in Manage Jenkins section; also your job is setup as a Freestyle Project.
Select your job and click Configure. Check Generic Artifactory Integration in Build Environment. Select your Artifactory Server and Target Repository from drop downs, check Override default deployer credentials if required. In Published Artifacts you enter the pattern for your zip file to be published, e.g. ${WORKSPACE}/distr/*.zip (where by WORKSPACE is jenkins current project's workspace and distr/*.zip your distribution zip file). Check if required Capture and publish build info, Include environment variables etc. Save your job. When you build it the next time, the zip file will be uploaded and will be available in the Builds section on artifactory.