jenkins-x / draft-packs

Note these build packs are moving to https://github.com/jenkins-x-buildpacks
https://jenkins-x.io/architecture/build-packs/
Apache License 2.0
18 stars 45 forks source link

Change Maven and Gradle pipelines to support Artifactory #50

Closed yahavi closed 6 years ago

yahavi commented 6 years ago

We'd like Jenkins X to optionally support Artifactory as it binary repository manager. To support this functionality, in addition to this PR, I submitted the following two PRs to the jenkins-x-image and jx repositories. https://github.com/jenkins-x/jx/pull/1274 https://github.com/jenkins-x/jenkins-x-image/pull/32

This pull request adds the following: Change Maven and Gradle pipelines to support both Artifactory and Nexus. Looking forward to your feedback

jstrachan commented 6 years ago

@yahavi its really hard to compare the diffs btw - did you reformat with a different indentation?

jstrachan commented 6 years ago

@yahavi rather than adding loads of complex code into every Jenkinsfile I wonder if we could do this, for maven, by just using a profile or something? Then we could enable all this via the ~/.m2/settings.xml file or something like that to minimise change?

Either that or I'd prefer a simple CLI command like jx build maven or jx build gradle or something that can wrap up this conditional logic for doing things differently with artifactory

jstrachan commented 6 years ago

I was thinking that most folks would use either nexus or artifactory so for the most part we'd be able to use a canonical URL for the repository (e.g. a Kubernetes Service) when doing things like deploy - but I guess things look very different for artifactory

yahavi commented 6 years ago

@jstrachan, Thanks for looking into my PR.

I fixed the indentation issue.

As for your second comment, the Jenkins Artifactory Plugin exposes Artifactory features which are not available if you use out of the box maven. Few examples for such features are checksum deployment (for faster uploads) and automatic configuration of resolution and deployment repositories. The plugin overrides the settings.xml configuration, if you configure resolution from Artifactory as part of your pipeline script. This basically allows dynamic configuration (for resolution and deployment repositories). These capabilities are extremely powerful and therefore very popular. In addition, the Artifactory Plugin exposes a growing pipeline DSL, which offers vast functionality when working with Artifactory from Jenkins. Also, I'm not sure we should create a different experience for users who use Jenkins vs Jenkins X. Another option might be creating a different set of pipeline drafts when installing Jenkins X with Artifactory. What do you think?

yahavi commented 6 years ago

In order to simplify the implementation, I created a new pull request to support this requirement. Basically, the new pull request does not add any change to the draft-packs. I tested it and all works properly with Artifactory. https://github.com/jenkins-x/jx/pull/1753