@Restricted(DoNotUse.class)
    public HttpResponse doInstallStatus(StaplerRequest request) {
        try {
            String correlationId = request.getParameter("correlationId");
            Map<String,Object> response = new HashMap<>();
            response.put("state", Jenkins.getInstance().getInstallState().name());
            List<Map<String, String>> installStates = new ArrayList<>();
            response.put("jobs", installStates);
            List<UpdateCenterJob> jobCopy = getJobs();

            for (UpdateCenterJob job : jobCopy) {
                if (job instanceof InstallationJob) {
                    UUID jobCorrelationId = job.getCorrelationId();
                    if (correlationId == null || (jobCorrelationId != null && correlationId.equals(jobCorrelationId.toString()))) {
                        InstallationJob installationJob = (InstallationJob) job;
                        Map<String, String> pluginInfo = new LinkedHashMap<>();
                        pluginInfo.put("name", installationJob.plugin.name);
                        pluginInfo.put("version", installationJob.plugin.version);
                        pluginInfo.put("title", installationJob.plugin.title);
                        pluginInfo.put("installStatus", installationJob.status.getType());
                        pluginInfo.put("requiresRestart", Boolean.toString(installationJob.status.requiresRestart()));
                        if (jobCorrelationId != null) {
                            pluginInfo.put("correlationId", jobCorrelationId.toString());
                        }
                        installStates.add(pluginInfo);
                    }
                }
            }
            return HttpResponses.okJSON(JSONObject.fromObject(response));
        } catch (Exception e) {
            return HttpResponses.errorJSON(String.format("ERROR: %s", e.getMessage()));
        }
    }
@ Restricted ( DoNotUse . class ) public HttpResponse doInstallStatus ( StaplerRequest request ) { try { String correlationId = request . getParameter ( "correlationId" ) ; Map < String , Object > response = new HashMap < > ( ) ; response . put ( "state" , Jenkins . getInstance ( ) . getInstallState ( ) . name ( ) ) ; List < Map < String , String > > installStates = new ArrayList < > ( ) ; response . put ( "jobs" , installStates ) ; List < UpdateCenterJob > jobCopy = getJobs ( ) ; for ( UpdateCenterJob job : jobCopy ) { if ( job instanceof InstallationJob ) { UUID jobCorrelationId = job . getCorrelationId ( ) ; if ( correlationId == null || ( jobCorrelationId != null && correlationId . equals ( jobCorrelationId . toString ( ) ) ) ) { InstallationJob installationJob = ( InstallationJob ) job ; Map < String , String > pluginInfo = new LinkedHashMap < > ( ) ; pluginInfo . put ( "name" , installationJob . plugin . name ) ; pluginInfo . put ( "version" , installationJob . plugin . version ) ; pluginInfo . put ( "title" , installationJob . plugin . title ) ; pluginInfo . put ( "installStatus" , installationJob . status . getType ( ) ) ; pluginInfo . put ( "requiresRestart" , Boolean . toString ( installationJob . status . requiresRestart ( ) ) ) ; if ( jobCorrelationId != null ) { pluginInfo . put ( "correlationId" , jobCorrelationId . toString ( ) ) ; } installStates . add ( pluginInfo ) ; } } } return HttpResponses . okJSON ( JSONObject . fromObject ( response ) ) ; } catch ( Exception e ) { return HttpResponses . errorJSON ( String . format ( "ERROR: %s" , e . getMessage ( ) ) ) ; } }
Get the current installation status of a plugin set.
<p>
Supports a "correlationId" request parameter if you only want to get the
install status of a set of plugins requested for install through
{@link PluginManager#doInstallPlugins(org.kohsuke.stapler.StaplerRequest)}.

@return The current installation status of a plugin set.