當前位置: 首頁>>代碼示例>>Java>>正文


Java Computer.currentComputer方法代碼示例

本文整理匯總了Java中hudson.model.Computer.currentComputer方法的典型用法代碼示例。如果您正苦於以下問題:Java Computer.currentComputer方法的具體用法?Java Computer.currentComputer怎麽用?Java Computer.currentComputer使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在hudson.model.Computer的用法示例。


在下文中一共展示了Computer.currentComputer方法的9個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: onStarted

import hudson.model.Computer; //導入方法依賴的package包/類
@Override
public void onStarted(Run run, TaskListener listener) {
    Computer c = Computer.currentComputer();
    if (c != null && c instanceof OneShotComputer) {
        final OneShotSlave node = ((OneShotComputer) c).getNode();
        if (node == null) {
            throw new IllegalStateException("OneShotSlave node is null");
        }
        node.provision(listener);
    }
}
 
開發者ID:hyperhq,項目名稱:hyper-slaves-plugin,代碼行數:12,代碼來源:OneShotSlave.java

示例2: onStarted

import hudson.model.Computer; //導入方法依賴的package包/類
@Override
public void onStarted(Run run, TaskListener listener) {
    Computer c = Computer.currentComputer();
    if (c instanceof HyperComputer) {
        run.addAction(((HyperComputer) c).getProvisioner().getContext());
        // TODO remove HyperSlaveAssignmentAction
    }
}
 
開發者ID:hyperhq,項目名稱:hyper-slaves-plugin,代碼行數:9,代碼來源:HyperSlave.java

示例3: perform

import hudson.model.Computer; //導入方法依賴的package包/類
@Override
public void perform(Run<?,?> build, FilePath workspace, Launcher launcher, TaskListener listener) throws InterruptedException, IOException{
	Computer computer = Computer.currentComputer();
    if (computer == null) {
        throw new AbortException("The AppScan Source build step requires to be launched on a node");
    }
    perform(build, computer.getNode(), workspace, launcher, listener, build.getEnvironment(listener));
}
 
開發者ID:kevinfealey,項目名稱:appscansource-scanner,代碼行數:9,代碼來源:AppScanSourceBuilder.java

示例4: perform

import hudson.model.Computer; //導入方法依賴的package包/類
@Override
public void perform(@Nonnull Run<?, ?> run, @Nonnull FilePath ws, @Nonnull Launcher launcher, @Nonnull TaskListener listener) throws InterruptedException, IOException {
    try {
        CLIRunner runner = new CLIRunner(run, ws, launcher, listener);
        Computer computer = Computer.currentComputer();
        if (computer == null) {
            throw new AbortException("The ansible playbook build step requires to be launched on a node");
        }
        String exe = AnsibleInstallation.getExecutable(ansibleName, AnsibleCommand.ANSIBLE, computer.getNode(), listener, run.getEnvironment(listener));
        AnsibleAdHocCommandInvocation invocation = new AnsibleAdHocCommandInvocation(exe, run, ws, listener);
        invocation.setHostPattern(hostPattern);
        invocation.setInventory(inventory);
        invocation.setModule(module);
        invocation.setModuleCommand(command);
        invocation.setSudo(sudo, sudoUser);
        invocation.setForks(forks);
        invocation.setCredentials(StringUtils.isNotBlank(credentialsId) ?
                CredentialsProvider.findCredentialById(credentialsId, StandardUsernameCredentials.class, run) :
                null);
        invocation.setAdditionalParameters(additionalParameters);
        invocation.setHostKeyCheck(hostKeyChecking);
        invocation.setUnbufferedOutput(unbufferedOutput);
        invocation.setColorizedOutput(colorizedOutput);
        if (!invocation.execute(runner)) {
            throw new AbortException("Ansible Ad-Hoc command execution failed");
        }
    } catch (IOException ioe) {
        Util.displayIOException(ioe, listener);
        ioe.printStackTrace(listener.fatalError(hudson.tasks.Messages.CommandInterpreter_CommandFailed()));
        throw ioe;
    } catch (AnsibleInvocationException aie) {
        listener.fatalError(aie.getMessage());
        throw new AbortException(aie.getMessage());
    }
}
 
開發者ID:jcsirot,項目名稱:ansible-plugin,代碼行數:36,代碼來源:AnsibleAdHocCommandBuilder.java

示例5: perform

import hudson.model.Computer; //導入方法依賴的package包/類
@Override
public void perform(@Nonnull Run<?, ?> run, @Nonnull FilePath ws, @Nonnull Launcher launcher, @Nonnull TaskListener listener)
        throws InterruptedException, IOException
{
    Computer computer = Computer.currentComputer();
    if (computer == null) {
        throw new AbortException("The ansible playbook build step requires to be launched on a node");
    }
    perform(run, computer.getNode(), ws, launcher, listener, run.getEnvironment(listener));
}
 
開發者ID:jcsirot,項目名稱:ansible-plugin,代碼行數:11,代碼來源:AnsiblePlaybookBuilder.java

示例6: computeJdkToUse

import hudson.model.Computer; //導入方法依賴的package包/類
/**
 * Set the JDK to use to start ZAP.
 * 
 * @param build
 * @param listener the listener to display log during the job execution in jenkins
 * @param env list of environment variables. Used to set the path to the JDK
 * @throws IOException
 * @throws InterruptedException
 */
private void computeJdkToUse(AbstractBuild<?, ?> build,
		BuildListener listener, EnvVars env) throws IOException, InterruptedException {
	JDK jdkToUse = getJdkToUse(build.getProject());
	if (jdkToUse != null) {
		Computer computer = Computer.currentComputer();
		// just in case we are not in a build
		if (computer != null) {
			jdkToUse = jdkToUse.forNode(computer.getNode(), listener);
		}
		jdkToUse.buildEnvVars(env);
	}
}
 
開發者ID:jenkinsci,項目名稱:zaproxy-plugin,代碼行數:22,代碼來源:ZAProxy.java

示例7: onStarted

import hudson.model.Computer; //導入方法依賴的package包/類
@Override
public void onStarted(Run<?, ?> run, TaskListener listener) {
    final Computer computer = Computer.currentComputer();
    if (computer instanceof DockerComputer) {
        final DockerTransientNode node = ((DockerComputer) computer).getNode();
        run.addAction(new DockerBuildAction(node));
    }
}
 
開發者ID:jenkinsci,項目名稱:docker-plugin,代碼行數:9,代碼來源:DockerRunListener.java

示例8: consolidateEnvVars

import hudson.model.Computer; //導入方法依賴的package包/類
protected Map<String, String> consolidateEnvVars(TaskListener listener,
        AbstractBuild<?, ?> build,
        Launcher launcher) {
    // EnvVars extends TreeMap
    TreeMap<String, String> overrides = new TreeMap<String, String>();
    // merge from all potential sources
    if (build != null) {
        try {
            EnvVars buildEnv = build.getEnvironment(listener);
            if (isVerbose())
                listener.getLogger()
                        .println("build env vars:  " + buildEnv);
            overrides.putAll(buildEnv);
        } catch (IOException | InterruptedException e) {
            if (isVerbose())
                e.printStackTrace(listener.getLogger());
        }
    }

    try {
        EnvVars computerEnv = null;
        Computer computer = Computer.currentComputer();
        if (computer != null) {
            computerEnv = computer.getEnvironment();
        } else {
            if (launcher != null)
                computer = launcher.getComputer();
            if (computer != null) {
                computerEnv = computer.getEnvironment();
            }
        }
        if (isVerbose())
            listener.getLogger().println(
                    "computer env vars:  " + computerEnv);
        if (computerEnv != null)
            overrides.putAll(computerEnv);
    } catch (IOException | InterruptedException e2) {
        if (isVerbose())
            e2.printStackTrace(listener.getLogger());
    }

    return overrides;
}
 
開發者ID:openshift,項目名稱:jenkins-client-plugin,代碼行數:44,代碼來源:BaseStep.java

示例9: runingOnMaster

import hudson.model.Computer; //導入方法依賴的package包/類
public static boolean runingOnMaster() {
	return Computer.currentComputer() instanceof MasterComputer;
}
 
開發者ID:jenkinsci,項目名稱:openshift-deployer-plugin,代碼行數:4,代碼來源:Utils.java


注:本文中的hudson.model.Computer.currentComputer方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。