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


Java KeyMaterial類代碼示例

本文整理匯總了Java中org.jenkinsci.plugins.docker.commons.credentials.KeyMaterial的典型用法代碼示例。如果您正苦於以下問題:Java KeyMaterial類的具體用法?Java KeyMaterial怎麽用?Java KeyMaterial使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。


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

示例1: materialize

import org.jenkinsci.plugins.docker.commons.credentials.KeyMaterial; //導入依賴的package包/類
@Override
public KeyMaterial materialize() throws IOException, InterruptedException {
    
    EnvVars e = new EnvVars();

    if (key != null && cert != null && ca != null) {
        final FilePath tempCredsDir = new FilePath(getContext().getBaseDir(), UUID.randomUUID().toString());
        tempCredsDir.mkdirs();

        // protect this information from prying eyes
        tempCredsDir.chmod(0700);

        // these file names are defined by convention by docker
        copyInto(tempCredsDir, "key.pem", key);
        copyInto(tempCredsDir,"cert.pem", cert);
        copyInto(tempCredsDir,"ca.pem", ca);

        e.put("DOCKER_TLS_VERIFY", "1");
        e.put("DOCKER_CERT_PATH", tempCredsDir.getRemote());
        return new ServerKeyMaterial(e, tempCredsDir);
    }

    return new ServerKeyMaterial(e);
}
 
開發者ID:jenkinsci,項目名稱:docker-commons-plugin,代碼行數:25,代碼來源:ServerKeyMaterialFactory.java

示例2: start

import org.jenkinsci.plugins.docker.commons.credentials.KeyMaterial; //導入依賴的package包/類
@Override public final boolean start() throws Exception {
    KeyMaterialFactory keyMaterialFactory = newKeyMaterialFactory();
    KeyMaterial material = keyMaterialFactory.materialize();
    getContext().newBodyInvoker().
            withContext(EnvironmentExpander.merge(getContext().get(EnvironmentExpander.class), new Expander(material))).
            withCallback(new Callback(material)).
            start();
    return false;
}
 
開發者ID:jenkinsci,項目名稱:docker-workflow-plugin,代碼行數:10,代碼來源:AbstractEndpointStepExecution.java

示例3: materialize

import org.jenkinsci.plugins.docker.commons.credentials.KeyMaterial; //導入依賴的package包/類
/** {@inheritDoc} */
@Override
public KeyMaterial materialize() throws IOException, InterruptedException {
    EnvVars env = new EnvVars();
    env.put("DOCKER_HOST", host);
    return new KeyMaterialImpl(env);
}
 
開發者ID:jenkinsci,項目名稱:docker-commons-plugin,代碼行數:8,代碼來源:ServerHostKeyMaterialFactory.java

示例4: materialize

import org.jenkinsci.plugins.docker.commons.credentials.KeyMaterial; //導入依賴的package包/類
@Override
public KeyMaterial materialize() throws IOException, InterruptedException {

    KeyMaterial[] keyMaterials = new KeyMaterial[factories.length];
    EnvVars env = new EnvVars();
    try {
        for (int index = 0; index < factories.length; index++) {
            keyMaterials[index] = factories[index].materialize();
            env.putAll(keyMaterials[index].env());
        }
        return new CompositeKeyMaterial(env, keyMaterials);
    } catch (Throwable e) {
        for (int index = keyMaterials.length - 1; index >= 0; index--) {
            try {
                if (keyMaterials[index] != null) {
                    keyMaterials[index].close();
                }
            } catch (IOException ioe) {
                // ignore as we want to try and close them all and we are reporting the original exception
            } catch (Throwable t) {
                // ignore as we want to try and close them all and we are reporting the original exception
            }
        }
        // TODO Java 7+ use chained exceptions
        if (e instanceof IOException) {
            throw (IOException) e;
        } else if (e instanceof InterruptedException) {
            throw (InterruptedException) e;
        } else if (e instanceof RuntimeException) {
            throw (RuntimeException) e;
        } else {
            throw new IOException("Error materializing credentials.", e);
        }
    }
}
 
開發者ID:jenkinsci,項目名稱:docker-commons-plugin,代碼行數:36,代碼來源:CompositeKeyMaterialFactory.java

示例5: perform

import org.jenkinsci.plugins.docker.commons.credentials.KeyMaterial; //導入依賴的package包/類
@Override
public boolean perform(AbstractBuild<?, ?> build, Launcher launcher, BuildListener listener) throws InterruptedException, IOException {
    // prepare the credentials to talk to this docker and make it available for docker you'll be forking
    KeyMaterialFactory keyMaterialFactory = server.newKeyMaterialFactory(build).plus(registry.newKeyMaterialFactory(build));
    KeyMaterial key = keyMaterialFactory.materialize();
    try {
        // fork docker with appropriate environment to interact with this docker daemon
        return launcher.launch().cmds(DockerTool.getExecutable(toolName, build.getBuiltOn(), listener, build.getEnvironment(listener)), "info").envs(key.env()).join() == 0;
    } finally {
        key.close();
    }
}
 
開發者ID:jenkinsci,項目名稱:docker-commons-plugin,代碼行數:13,代碼來源:SampleDockerBuilder.java

示例6: Expander

import org.jenkinsci.plugins.docker.commons.credentials.KeyMaterial; //導入依賴的package包/類
Expander(KeyMaterial material) {
    this.material = material;
}
 
開發者ID:jenkinsci,項目名稱:docker-workflow-plugin,代碼行數:4,代碼來源:AbstractEndpointStepExecution.java

示例7: Callback

import org.jenkinsci.plugins.docker.commons.credentials.KeyMaterial; //導入依賴的package包/類
Callback(KeyMaterial material) {
    this.material = material;
}
 
開發者ID:jenkinsci,項目名稱:docker-workflow-plugin,代碼行數:4,代碼來源:AbstractEndpointStepExecution.java

示例8: materialize

import org.jenkinsci.plugins.docker.commons.credentials.KeyMaterial; //導入依賴的package包/類
@Override
public KeyMaterial materialize() throws IOException, InterruptedException {
    return KeyMaterial.NULL;
}
 
開發者ID:jenkinsci,項目名稱:docker-commons-plugin,代碼行數:5,代碼來源:NullKeyMaterialFactory.java

示例9: CompositeKeyMaterial

import org.jenkinsci.plugins.docker.commons.credentials.KeyMaterial; //導入依賴的package包/類
protected CompositeKeyMaterial(EnvVars envVars, KeyMaterial... keyMaterials) {
    super(envVars);
    this.keyMaterials = keyMaterials;
}
 
開發者ID:jenkinsci,項目名稱:docker-commons-plugin,代碼行數:5,代碼來源:CompositeKeyMaterialFactory.java


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