Java Code Examples for hudson.init.InitMilestone#JOB_LOADED

The following examples show how to use hudson.init.InitMilestone#JOB_LOADED . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: DockerSwarmCloud.java    From docker-swarm-plugin with MIT License 6 votes vote down vote up
@Initializer(after = InitMilestone.JOB_LOADED)
public static void initFromYaml() throws IOException {
    File configsDir = new File(Jenkins.getInstance().getRootDir(), "pluginConfigs");
    File swarmConfigYaml = new File(configsDir, "swarm.yml");
    if (swarmConfigYaml.exists()) {
        LOGGER.info("Configuring swarm plugin from " + swarmConfigYaml.getAbsolutePath());
        ObjectMapper mapper = new ObjectMapper(new YAMLFactory());
        try (InputStream in = new BufferedInputStream(new FileInputStream(swarmConfigYaml))) {
            DockerSwarmCloud configuration = mapper.readValue(in, DockerSwarmCloud.class);
            DockerSwarmCloud existingCloud = DockerSwarmCloud.get();
            if (existingCloud != null) {
                Jenkins.getInstance().clouds.remove(existingCloud);
            }
            Jenkins.getInstance().clouds.add(configuration);
        }
    }
    scheduleReaperActor();
    scheduleResetStuckBuildsActor();
}
 
Example 2
Source File: BackwardCompatibility.java    From lockable-resources-plugin with MIT License 6 votes vote down vote up
@Initializer(after = InitMilestone.JOB_LOADED)
public static void compatibilityMigration() {
	LOG.log(Level.FINE, "lockable-resource-plugin compatibility migration task run");
	List<LockableResource> resources = LockableResourcesManager.get().getResources();
	for (LockableResource resource : resources) {
		List<StepContext> queuedContexts = resource.getQueuedContexts();
		if (!queuedContexts.isEmpty()) {
			for (StepContext queuedContext : queuedContexts) {
				List<String> resourcesNames = new ArrayList<>();
				resourcesNames.add(resource.getName());
				LockableResourcesStruct resourceHolder = new LockableResourcesStruct(resourcesNames, "", 0);
				LockableResourcesManager.get().queueContext(queuedContext, Arrays.asList(resourceHolder), resource.getName(), null);
			}
			queuedContexts.clear();
		}
	}
}
 
Example 3
Source File: GitLabSCMWebHook.java    From gitlab-branch-source-plugin with GNU General Public License v2.0 5 votes vote down vote up
@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();
}