本文整理汇总了Java中hudson.init.InitMilestone.JOB_LOADED属性的典型用法代码示例。如果您正苦于以下问题:Java InitMilestone.JOB_LOADED属性的具体用法?Java InitMilestone.JOB_LOADED怎么用?Java InitMilestone.JOB_LOADED使用的例子?那么, 这里精选的属性代码示例或许可以为您提供帮助。您也可以进一步了解该属性所在类hudson.init.InitMilestone
的用法示例。
在下文中一共展示了InitMilestone.JOB_LOADED属性的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: jobLoaded
@Initializer(before = InitMilestone.COMPLETED, after = InitMilestone.JOB_LOADED)
public static void jobLoaded() throws IOException
{
m_logger.fine("Initialization milestone: All jobs have been loaded"); //$NON-NLS-1$
Jenkins jenkins = Jenkins.getInstance();
for (AbstractProject<?, ?> project : jenkins.getAllItems(AbstractProject.class))
{
try
{
SCM scmConfig = project.getScm();
if (scmConfig instanceof AbstractConfiguration && ((AbstractConfiguration) scmConfig).isMigrated())
{
project.save();
m_logger.info(String.format(
"Project %s has been migrated.", //$NON-NLS-1$
project.getFullName()));
}
}
catch (IOException e)
{
m_logger.log(Level.SEVERE, String.format("Failed to upgrade job %s", project.getFullName()), e); //$NON-NLS-1$
}
}
}
示例2: packageRenameConverting
@Initializer(before = InitMilestone.JOB_LOADED)
@Restricted(NoExternalUse.class)
public static void packageRenameConverting() {
for(XStream2 xs : Arrays.asList(Items.XSTREAM2, Run.XSTREAM2, Jenkins.XSTREAM2, getFingerprintXStream())) {
xs.addCompatibilityAlias("org.jenkinsci.plugins.dockerhub.notification.DockerHubTrigger",
DockerHubTrigger.class);
xs.addCompatibilityAlias("org.jenkinsci.plugins.dockerhub.notification.DockerHubWebHookCause",
DockerHubWebHookCause.class);
xs.addCompatibilityAlias("org.jenkinsci.plugins.dockerhub.notification.DockerPullImageBuilder",
DockerPullImageBuilder.class);
//TODO no back-compat tests for the column and filter
xs.addCompatibilityAlias("org.jenkinsci.plugins.dockerhub.notification.TriggerListViewColumn",
TriggerListViewColumn.class);
xs.addCompatibilityAlias("org.jenkinsci.plugins.dockerhub.notification.TriggerViewFilter",
TriggerViewFilter.class);
//The TriggerOption extension point has also changed package name and will not be backwards compatible API
xs.addCompatibilityAlias("org.jenkinsci.plugins.dockerhub.notification.opt.impl.TriggerForAllUsedInJob",
TriggerForAllUsedInJob.class);
xs.addCompatibilityAlias("org.jenkinsci.plugins.dockerhub.notification.opt.impl.TriggerOnSpecifiedImageNames",
TriggerOnSpecifiedImageNames.class);
xs.addCompatibilityAlias("org.jenkinsci.plugins.dockerhub.notification.TriggerStore$TriggerEntry",
TriggerStore.TriggerEntry.class);
xs.addCompatibilityAlias("org.jenkinsci.plugins.dockerhub.notification.TriggerStore$TriggerEntry$RunEntry",
TriggerStore.TriggerEntry.RunEntry.class);
}
}
示例3: initialize
@Initializer(after = InitMilestone.JOB_LOADED)
public static void initialize() {
new Thread(new Runnable() {
@Override
public void run() {
ACL.impersonate(ACL.SYSTEM, new ListenerInitializerTask(GitLabSCMWebHook.get()));
}
}).start();
}
示例4: initialize
/**
* Let's trigger an update after Jenkins is fully up.
*
* JOB_LOADED is the last milestone that can be triggered with an @Initializer,
* COMPLETED doesn't work. So, we queue the update and check that Jenkins is fully up in the runnable
* used in refreshDataOnStartup()
*/
@Initializer(after = InitMilestone.JOB_LOADED)
public static void initialize() {
// TODO switch to Jenkins.getActiveInstance() once 1.590+ is the baseline
Jenkins jenkins = Jenkins.getInstance();
if (jenkins == null) {
throw new IllegalStateException("Jenkins has not been started, or was already shut down");
}
QuickDiskUsagePlugin plugin = jenkins.getPlugin(QuickDiskUsagePlugin.class);
if (plugin == null) return;
plugin.refreshDataOnStartup();
}
示例5: init
/**
* We want to start the Mesos scheduler as part of the initialization of Jenkins
* and after the cloud class values have been restored from persistence.If this is
* the very first time, this method will be NOOP as MesosCloud is not registered yet.
*/
@Initializer(after=InitMilestone.JOB_LOADED)
public static void init() {
Jenkins jenkins = getJenkins();
List<Node> slaves = jenkins.getNodes();
// Turning the AUTOMATIC_SLAVE_LAUNCH flag off because the below slave removals
// causes computer launch in other slaves that have not been removed yet.
// To study how a slave removal updates the entire list, one can refer to
// Hudson NodeProvisioner class and follow this method chain removeNode() ->
// setNodes() -> updateComputerList() -> updateComputer().
Jenkins.AUTOMATIC_SLAVE_LAUNCH = false;
for (Node n : slaves) {
//Remove all slaves that were persisted when Jenkins shutdown.
if (n instanceof MesosSlave) {
((MesosSlave)n).terminate();
}
}
// Turn it back on for future real slaves.
Jenkins.AUTOMATIC_SLAVE_LAUNCH = true;
for (Cloud c : jenkins.clouds) {
if( c instanceof MesosCloud) {
// Register mesos framework on init, if on demand registration is not enabled.
if (!((MesosCloud) c).isOnDemandRegistration()) {
((MesosCloud)c).restartMesos();
}
}
}
}
示例6: loadConfig
@Initializer(after = InitMilestone.EXTENSIONS_AUGMENTED, before = InitMilestone.JOB_LOADED)
public static void loadConfig() throws IOException {
SupportPlugin instance = getInstance();
if (instance != null)
instance.load();
}