What I ended up doing is using what I had previously to setup Jenkins,
login, and install the Job Configuration History plugin, and got the output
of the config.xml. For whatever reason, doing the
http://JENKINSURL:8080/job/NAME/config.xml would just result in a blank
page, and not actually show the configuration of the GitHub Source Branch
job.
However, I noticed that the config is tied very specifically to specific
versions of Plugins. I can install plugins, but if those change, then they
break my job.
/**
* activatePlugin activates given plugins.
* The plugin parameter is a pluginManager object(?)
*
* @param plugin [Object]
*
* @return nil
*/
def activatePlugin(plugin) {
// If our specified plugin isn't enabled, enable it.
if (! plugin.isEnabled()) {
plugin.enable()
// Set our state to true.
deployed = true
}
// Go through each dependency of our plugins, and enable those.
// Otherwise our plugins wouldn't work even if they're installed.
plugin.getDependencies().each {
activatePlugin(pluginManager.getPlugin(it.shortName))
}
}
// As of 2018-12-18
def plugin_list = [
"ant:1.9",
"build-timeout:1.19",
"email-ext:2.63",
"github-branch-source:2.4.1",
"gradle:1.29",
"ldap:1.20",
"matrix-auth:2.3",
"antisamy-markup-formatter:1.5",
"pam-auth:1.4",
"pipeline:2.6",
"pipeline-github-lib:1.0",
"ssh-slaves:1.29.1",
"subversion:2.12.1",
"timestamper:1.8.10",
"ws-cleanup:0.37",
]
// Loop through all of the plugins and install/update and activate them.
plugin_list.each { plugin ->
// If the plugin isn't being installed, update it.
if (! pluginManager.getPlugin(plugin)) {
deployment = updateCenter.getPlugin(plugin).deploy(true)
deployment.get()
}
// Activate the plugin and all of its dependencies.
activatePlugin(pluginManager.getPlugin(plugin))
}
However, there is an overloaded method in the updateCenter called
getPlugin(String name, and VersionNumber version)
-
https://javadoc.jenkins.io/hudson/model/UpdateCenter.html#getPlugin-java.lang.String-hudson.util.VersionNumber-
I'm not sure where to find the VersionNumber or how to get that to give to
this method.
On Friday, December 14, 2018 at 3:46:05 PM UTC-6, Phillip Dudley wrote:
>
> Would anyone have any pointers to configuring the GitHub Organization
> Item/Job with Groovy so that when my Jenkins instance starts up, it reads
> the
>
> $JENKINS_HOME/init.groovy.d/
>
> folder and configures a default job to perform GitHub Organization
> scanning for Jenkinsfiles?
>
> I've got most of the other stuff I need such as setting banners,
> installing plugins, configuring default Jenkins users and assigning them
> permissions via the matrix-auth plugin. Even finally hooked up to LDAP and
> I can authenticate. However, I don't seem to find too much on configuring
> that plugin except through the UI. Most of my Googling returns results for
> using Jenkinsfiles, or Groovy tutorials, but not actually setting up and
> configuring that plugin.
>
> TL;DR,
> Looking for a direction to learn how to configure the GitHub Organization
> job to scan my GitHub Organization for Jenkinsfiles and start performing
> Jobs.
>
--
You received this message because you are subscribed to the Google Groups
"Jenkins Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To view this discussion on the web visit
https://groups.google.com/d/msgid/jenkinsci-users/cba85d73-2f8c-4c71-8063-90afbec219c1%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.