public void setupCredentials(AbstractBuild build) throws IOException, InterruptedException { this.dockerEnv = dockerHost.newKeyMaterialFactory(build) .plus( registryEndpoint.newKeyMaterialFactory(build)) .materialize(); }
private Object readResolve() { if (pushOnSuccess && registry == null) { registry = new DockerRegistryEndpoint(null, null); } return this; } }
private Object readResolve() { if (pushCredentialsId == null && registry != null) { pushCredentialsId = registry.getCredentialsId(); } if (pullCredentialsId != null) { fromRegistry = new DockerRegistryEndpoint(null, pullCredentialsId); } return this; } }
@DataBoundConstructor public DockerBuilder(String repoName) { this.server = new DockerServerEndpoint(null, null); this.registry = new DockerRegistryEndpoint(null, null); this.repoName = repoName; }
public DockerHostConfig(DockerServerEndpoint endpoint, Item context) throws IOException, InterruptedException { this.endpoint = endpoint; try (ACLContext oldContext = ACL.as(ACL.SYSTEM)) { keys = endpoint.newKeyMaterialFactory(context, FilePath.localChannel).materialize(); } }
@Override public void close() throws IOException { keys.close(); } }
public EnvVars getEnvironment() { return keys.env(); }
public DefaultDockerHostSource() { this(new DockerServerEndpoint(null, null)); }
/** * Creates a read-protected directory inside {@link KeyMaterialContext#getBaseDir} suitable for storing secret files. * Be sure to {@link FilePath#deleteRecursive} this in {@link KeyMaterial#close}. */ protected final FilePath createSecretsDirectory() throws IOException, InterruptedException { FilePath dir = new FilePath(getContext().getBaseDir(), UUID.randomUUID().toString()); dir.mkdirs(); dir.chmod(0700); return dir; }
@Override public int hashCode() { int result = dockerHost != null ? dockerHost.hashCode() : 0; result = 31 * result + connectTimeout; result = 31 * result + readTimeout; result = 31 * result + (apiVersion != null ? apiVersion.hashCode() : 0); result = 31 * result + (hostname != null ? hostname.hashCode() : 0); return result; }
public DockerRegistryEndpoint getRegistry(Identifier identifier) { if (registry == null) { registry = new DockerRegistryEndpoint(null, pushCredentialsId); } return registry; }
public DockerHostConfig(DockerServerEndpoint endpoint, Item context) throws IOException, InterruptedException { this.endpoint = endpoint; final SecurityContext impersonate = ACL.impersonate(ACL.SYSTEM); try { keys = endpoint.newKeyMaterialFactory(context, FilePath.localChannel).materialize(); } finally { SecurityContextHolder.setContext(impersonate); } }
@Override public void close() throws IOException { keys.close(); } }
public EnvVars getEnvironment() { return keys.env(); }
public DefaultDockerHostSource() { this(new DockerServerEndpoint(null, null)); }
public DockerRegistryEndpoint getRegistry() { if (registry == null) { registry = new DockerRegistryEndpoint(null, pullCredentialsId); } return registry; }
@Override public void close() throws IOException { dockerEnv.close(); }
@Deprecated public DockerCloud(String name, List<DockerTemplate> templates, String serverUrl, int containerCap, int connectTimeout, int readTimeout, String credentialsId, String version, String dockerHostname) { this(name, templates, new DockerServerEndpoint(serverUrl, credentialsId), containerCap, connectTimeout, readTimeout, version, dockerHostname); }
public DockerRegistryEndpoint getRegistry() { if (registry == null) { registry = new DockerRegistryEndpoint(null, pullCredentialsId); } return registry; }
/** * For testing * * @param dockerLabel the docker label to use * @param url The registry URL * @param creds the registry credentials ID */ public FolderConfig(String dockerLabel, String url, String creds) { this.dockerLabel = dockerLabel; this.registry = new DockerRegistryEndpoint(url, creds); }