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


TypeScript registryauthenticationtoken.getDockerRegistryEndpointAuthenticationToken函數代碼示例

本文整理匯總了TypeScript中docker-common/registryauthenticationprovider/registryauthenticationtoken.getDockerRegistryEndpointAuthenticationToken函數的典型用法代碼示例。如果您正苦於以下問題:TypeScript getDockerRegistryEndpointAuthenticationToken函數的具體用法?TypeScript getDockerRegistryEndpointAuthenticationToken怎麽用?TypeScript getDockerRegistryEndpointAuthenticationToken使用的例子?那麽, 這裏精選的函數代碼示例或許可以為您提供幫助。


在下文中一共展示了getDockerRegistryEndpointAuthenticationToken函數的3個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的TypeScript代碼示例。

示例1: ACRAuthenticationTokenProvider

import RegistryAuthenticationToken from "docker-common/registryauthenticationprovider/registryauthenticationtoken"
import { getDockerRegistryEndpointAuthenticationToken } from "docker-common/registryauthenticationprovider/registryauthenticationtoken";

tl.setResourcePath(path.join(__dirname, '..' , 'task.json'));
// Change to any specified working directory
tl.cd(tl.getInput("cwd"));

// get the registry server authentication provider 
var registryType = tl.getInput("containerRegistryType", true);
const environmentVariableMaximumSize = 32766;
var registryAuthenticationToken: RegistryAuthenticationToken;
if(registryType ==  "Azure Container Registry"){
    registryAuthenticationToken = new ACRAuthenticationTokenProvider(tl.getInput("azureSubscriptionEndpoint"), tl.getInput("azureContainerRegistry")).getAuthenticationToken();
} 
else {
    registryAuthenticationToken = getDockerRegistryEndpointAuthenticationToken(tl.getInput("dockerRegistryEndpoint"));
}

// open kubectl connection and run the command
var connection = new ClusterConnection();
try
{
    connection.open(tl.getInput("kubernetesServiceEndpoint")).then(  
        () => { return run(connection, registryAuthenticationToken) }
    ).then(
       () =>  {
           tl.setResult(tl.TaskResult.Succeeded, "");
           connection.close();
       }
    ).catch((error) => {
       tl.setResult(tl.TaskResult.Failed, error.message)
開發者ID:Microsoft,項目名稱:vsts-tasks,代碼行數:31,代碼來源:kubernetes.ts

示例2: getDockerRegistryEndpointAuthenticationToken

let getDockerRegistrySecretArgs = () => {
    let authProvider: AuthenticationToken = getDockerRegistryEndpointAuthenticationToken(TaskInputParameters.dockerRegistryEndpoint);
    return `docker-registry ${TaskInputParameters.secretName.trim()} --docker-username=${authProvider.getUsername()} --docker-password=${authProvider.getPassword()} --docker-server=${authProvider.getLoginServerUrl()} --docker-email=${authProvider.getEmail()}`;
}
開發者ID:Microsoft,項目名稱:vsts-tasks,代碼行數:4,代碼來源:createSecret.ts

示例3: require

import { getDockerRegistryEndpointAuthenticationToken } from "docker-common/registryauthenticationprovider/registryauthenticationtoken";
import Q = require('q');

tl.setResourcePath(path.join(__dirname, 'task.json'));

// get the registry server authentication provider 
var containerRegistryType = tl.getInput("containerregistrytype", true);
const environmentVariableMaximumSize = 32766;

var registryAuthenticationToken;
if (containerRegistryType == "Azure Container Registry") {
    registryAuthenticationToken = new ACRAuthenticationTokenProvider(tl.getInput("azureSubscriptionEndpoint"), tl.getInput("azureContainerRegistry")).getAuthenticationToken();
}
else {
    let endpointId = tl.getInput("dockerRegistryEndpoint");
    registryAuthenticationToken = getDockerRegistryEndpointAuthenticationToken(endpointId);
}

// Connect to any specified container host and/or registry 
var connection = new ContainerConnection();
connection.open(tl.getInput("dockerHostEndpoint"), registryAuthenticationToken);

// Run the specified command
var command = tl.getInput("command", true).toLowerCase();
/* tslint:disable:no-var-requires */

var dockerCommandMap = {
    "build an image": "./containerbuild",
    "build": "./containerbuild",
    "tag image": "./containertag",
    "tag": "./containertag",
開發者ID:Microsoft,項目名稱:vsts-tasks,代碼行數:31,代碼來源:container.ts


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