本文整理匯總了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);
}
示例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;
}
示例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);
}
示例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);
}
}
}
示例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();
}
}
示例6: Expander
import org.jenkinsci.plugins.docker.commons.credentials.KeyMaterial; //導入依賴的package包/類
Expander(KeyMaterial material) {
this.material = material;
}
示例7: Callback
import org.jenkinsci.plugins.docker.commons.credentials.KeyMaterial; //導入依賴的package包/類
Callback(KeyMaterial material) {
this.material = material;
}
示例8: materialize
import org.jenkinsci.plugins.docker.commons.credentials.KeyMaterial; //導入依賴的package包/類
@Override
public KeyMaterial materialize() throws IOException, InterruptedException {
return KeyMaterial.NULL;
}
示例9: CompositeKeyMaterial
import org.jenkinsci.plugins.docker.commons.credentials.KeyMaterial; //導入依賴的package包/類
protected CompositeKeyMaterial(EnvVars envVars, KeyMaterial... keyMaterials) {
super(envVars);
this.keyMaterials = keyMaterials;
}