Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Is there an Ant task which can fetch an artifact from Hudson/Jenkins?

I've hand-rolled my project's build-system (mostly in Python + Hudson). One of the things I need to do quite often is fetch artifacts from upstream Hudson / Jenkins.

These artifacts could be almost anything - for example a zip-file full of business data to process or even an egg containing a load of python code which must be tested. Almost every important job in our system has upstream dependancies on artifacts produced by other Hudson jobs.

My manager has suggested that the next iteration of the build-system should replace some of my hand-rolled components with Ant. The purpose of this next iteration will be to reduce the complexity of our systems and bring them into line with the work of other teams who mainly use Java and Ant (and very little Python).

Also I'm personally keen to have an excuse to learn Ant. It seems like a really useful tool.

So in order not to re-invent the wheel one component I'm definitely going to need is an Ant task which can fetch an artifact from a particular Hudson build. Does such a thing exist. If it does not exist, is there something close to my requirement that I could customize? I'd rather not re-invent the wheel.


UPDATE1: We have a strong preference for 100% free, open-source tools. Everybody in the team is very happy with Ant, however Maven is something the team is trying to get away from.

like image 651
Salim Fadhley Avatar asked Jun 15 '11 13:06

Salim Fadhley


People also ask

How do I download artifacts from Artifactory in Jenkins?

To configure it: install the plugin (https://wiki.jenkins-ci.org/display/JENKINS/Artifactory+Plugin) on the job configuration page, enable "Generic Artifactory Integration". go to "Resolved Artifacts" and enter the artifacts to resolve/download - the question-mark icon on that page will tell you more about the syntax.

How do I run an ant in Jenkins?

you can use ant wrapper in Jenkins`s pipeline groovy script. Remember to configure the ant tool in the Jenkins "Global Tool Configuration" with the same name "LocalAnt". for the sh "ant build" do I need to put the path to the build xml file or will simply typing `"ant build" work?

How does Artifactory work with Jenkins?

The popular Jenkins Artifactory Plugin brings Artifactory's Build Integration support to Jenkins. This integration allows your build jobs to deploy artifacts and resolve dependencies to and from Artifactory, and then have them linked to the build job that created them.

How does JFrog Artifactory integrate with Jenkins?

To install the Jenkins Artifactory Plugin, go to Manage Jenkins > Manage Plugins, click on the Available tab and search for Artifactory. Select the Artifactory plugin and click Download Now and Install After Restart.


2 Answers

The proper solution is to publish the artifacts from Hudson/Jenkins to an artifact manager, such as Nexus or Artifactory, and then pull the artifact versions with something like Ivy or Gradle.

like image 176
Stefan Kendall Avatar answered Oct 11 '22 04:10

Stefan Kendall


If you must get the dependencies yourself, you could use the get task. Example:

<get src="http://jenkins/job/project-name/lastSuccessfulBuild/artifact/foo.jar"
     dest="/path/to/local/file"/>

I do, however, agree with Stefan - dependency management is better accomplished by tools mentioned in his answer instead of manually pulling them down yourself using Ant.

like image 36
Rob Hruska Avatar answered Oct 11 '22 04:10

Rob Hruska