本文整理匯總了TypeScript中docker-common/containerconnection.open函數的典型用法代碼示例。如果您正苦於以下問題:TypeScript open函數的具體用法?TypeScript open怎麽用?TypeScript open使用的例子?那麽, 這裏精選的函數代碼示例或許可以為您提供幫助。
在下文中一共展示了open函數的2個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的TypeScript代碼示例。
示例1: ACRAuthenticationTokenProvider
// get the registry server authentication provider
var registryType = tl.getInput("containerregistrytype", true);
var authenticationProvider : AuthenticationTokenProvider;
if(registryType == "Azure Container Registry"){
authenticationProvider = new ACRAuthenticationTokenProvider(tl.getInput("azureSubscriptionEndpoint"), tl.getInput("azureContainerRegistry"));
}
else {
authenticationProvider = new GenericAuthenticationTokenProvider(tl.getInput("dockerRegistryEndpoint"));
}
var registryAuthenticationToken = authenticationProvider.getAuthenticationToken();
// Connect to any specified container host and/or registry
var connection = new ContainerConnection();
connection.open(tl.getInput("dockerHostEndpoint"), registryAuthenticationToken);
// Run the specified action
var action = tl.getInput("action", true).toLowerCase();
let command = "";
if(action !== "run a docker command") {
command = action;
}
else {
let customCommand = tl.getInput("customCommand", true);
// sanitize the custom command parameters to log just the action
let commandTokens = customCommand.split(" ");
if(commandTokens.length > 0) {
for(let index = 0; index < commandTokens.length; index ++) {
示例2: getDockerRegistryEndpointAuthenticationToken
import RegistryAuthenticationToken from "docker-common/registryauthenticationprovider/registryauthenticationtoken";
import ContainerConnection from 'docker-common/containerconnection';
import { getDockerRegistryEndpointAuthenticationToken } from "docker-common/registryauthenticationprovider/registryauthenticationtoken";
tl.setResourcePath(path.join(__dirname, 'task.json'));
let endpointId = tl.getInput("containerRegistry");
let registryAuthenticationToken: RegistryAuthenticationToken = getDockerRegistryEndpointAuthenticationToken(endpointId);
// Take the specified command
let command = tl.getInput("command", true).toLowerCase();
let isLogout = (command === "logout");
// Connect to any specified container registry
let connection = new ContainerConnection();
connection.open(null, registryAuthenticationToken, true, isLogout);
let dockerCommandMap = {
"buildandpush": "./dockerbuildandpush",
"build": "./dockerbuild",
"push": "./dockerpush",
"login": "./dockerlogin",
"logout": "./dockerlogout"
}
let telemetry = {
command: command,
jobId: tl.getVariable('SYSTEM_JOBID')
};
console.log("##vso[telemetry.publish area=%s;feature=%s]%s",