当前位置: 首页>>代码示例>>TypeScript>>正文


TypeScript containerconnection.open函数代码示例

本文整理汇总了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 ++) {
开发者ID:grawcho,项目名称:vso-agent-tasks,代码行数:31,代码来源:container.ts

示例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",
开发者ID:Microsoft,项目名称:vsts-tasks,代码行数:31,代码来源:docker.ts


注:本文中的docker-common/containerconnection.open函数示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。