Question

I'm prototyping a new build system using Jenkins, Gradle, and Artifactory. There seems to be conflicting or rather overlapping features in these tools, in regards to specifying the build artifacts and their destination. I see three paths going forward:

  1. Specify the artifact settings on the particular task in Jenkins, using the Jenkins Artifactory plugin.
  2. Specify the artifact settings in the Gradle build scripts, using the Gradle Artifactory plugin.
  3. Specify generic maven repo settings in the Gradle build scripts, using the standard Gradle "maven" plugin.

I see pro's and con's to all of these approaches, but nothing is missing a critical feature for our builds, as far as I can see.

To further my confusion, the Gradle Artifactory plugin wiki states:

Build Server Integration - When running Gradle builds in your continuous integration build server, it is recommended to use one of the Artifactory Plugins for Jenkins, TeamCity or Bamboo to configure resolution and publishing to Artifactory with build-info capturing, via your build server UI.

So, some questions to get the conversation going:

  1. Does it make sense to clutter the build scripts with artifact logic? It might help to add that developer's don't deploy. Currently, I only see build artifacts being uploaded from the Jenkins task.
  2. Does leaving all of this build logic in the task configuration expose us to issues, in the event that the CI server is down?
  3. What about version control for artifact changes done through the CI interface?
  4. I've seen simple Bamboo configurations that specify the build artifacts through the CI server UI, rather than the pom's. Is this just a bad build practice?
  5. Is there a killer tool integration feature that separates one of these approaches from the other?
  6. How useful is the build info object? Is that only available in the Jenkins Artifactory plugin and not the Gradle Artifactory plugin?

I am really hoping to hear from existing users of these tools and what pitfalls/requirements may have led them to one of the approaches above (or perhaps even a better one that I haven't considered yet).

Was it helpful?

Solution

Does it make sense to clutter the build scripts with artifact logic? It might help to add that developer's don't deploy. Currently, I only see build artifacts being uploaded from the Jenkins task.

I'd say that's the way to go. Your build server is the single point of truth, and only artifacts built in the build server should be deployed.

Does leaving all of this build logic in the task configuration expose us to issues, in the event that the CI server is down?

That one is simple - you shouldn't deploy while your CI server is down. Building on local machine might produce wrong artifacts, which shouldn't be deployed.

What about version control for artifact changes done through the CI interface?

Not sure I understood your question.

I've seen simple Bamboo configurations that specify the build artifacts through the CI server UI, rather than the pom's. Is this just a bad build practice?

This configuration ignores Maven's ability to deploy, and I am not sure I can find a good scenario to justify it. The only thing I can think of is deferred deploy, but Artifactory plugin can take care of that.

Is there a killer tool integration feature that separates one of these approaches from the other?

Now we got to the essence :)

Well, the advantage of defining what you deploy in your build script (in case of Gradle) gives you the flexibility to fine-tuning every aspect of the deployment (think about the dynamic properties you might want to add in certain cases). Another very serious advantage is that your build is source, which means it is versionable in your version control.

The advantage of defining the deployment details in the build server configuration is that the build server is the only place the deployment should occur. So, if you don't have the deployment details in your build script, you know for sure it won't be deployed standalone.

So, how can you combine between the two to get the advantages of both worlds?

Code your deployment logic in your Gradle script using the Artifactory plugin DSL. Provide details like username and password from properties, which exists on build server only.

How useful is the build info object?

Extremely useful. The information in buildInfo was harvested during the build process and the buidInfo is the only place it exists. Having this information is the only option you will be able to reproduce this build in the future.

Is that only available in the Jenkins Artifactory plugin and not the Gradle Artifactory plugin?

'artifactory' and 'artifactory-publish' Gradle plugins both generate the buildInfo object, regardless of where are they running (be it your local machine or Jenkins build server).

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top