Guide to Repository Layout and Build Promotion with Artifactory

Usual story, new to artificatory and looking for a jump start.

Can anyone point me at a decent how-to post for using Artifactory OSS with Jenkins in a deployment pipeline?

I figure I’m likely to want to:

  • setup several repos for dev thru production (any standards for this?) * have jenkins publish artifacts to the first repo using the artifactory plugin - limiting the amount of builds kept in artifactory. * promote builds from one repo to next as release to next environment - again deleting older builds

I just need a good guide/example to get started…

Hi Andrew

I don’t have a good step-by-step guide, but I can give a few tips to get you going:

  • It isn’t strictly necessary to use the Artifactory plugin as Artifactory can handle being uploaded to just like a standard maven or ivy repo, but if you do then you can associate artifacts with builds in the Artifactory repo. FWIW in a team where I set that up no-one really used that association in Artifactory much though.

  • If you’re using the latest version of the Artifactory plugin you’ll need to use the newer Gradle publishing model.

If you do use the Artifactory plugin, the config reference on that wiki page is a bit overwhelming. A minimal config for a simple jar project might look something like:

publishing {

publications {

// assuming a jar project

jar(MavenPublication) {

from components.java

artifactId ‘mylib’

}

}

}

artifactoryPublish {

publications(‘jar’)

}

artifactory {

publish {

contextUrl = ‘http://your.repo.url.here/artifactory/

repository {

repoKey = ‘apps-builds-local’ // or whatever your initial repo is

username = artifactoryUsername // have jenkins pass this in

password = artifactoryPassword // have jenkins pass this in

}

}

clientConfig.info.buildName = “my-app-foo-branch” // or whatever

clientConfig.info.buildNumber = “$version-$buildNumber” // where buildNumber is passed in by jenkins

}

Note that given what you’ve described you want to do you’re going to hit the limitations of the OSS Artifactory version pretty quickly:

  • Most of the scriptable bits of Artifactory that you might need here like deleting builds and moving builds from one repo to another one are only available in the Pro version, see e.g. here and here

  • The OSS version doesn’t allow installing plugins which might also let you script those things from Jenkins

You can still delete / move things using the Artifactory OSS UI, but that gets cumbersome pretty quickly.

Hope that helps