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


TypeScript task.getTaskVariable函數代碼示例

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


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

示例1: run

async function run() {
    try {
        tl.setResourcePath(path.join(__dirname, 'task.json'));

        // Check platform is macOS since demands are not evaluated on Hosted pools
        if (os.platform() !== 'darwin') {
            console.log(tl.loc('InstallRequiresMac'));
        } else {
            let keychain: string = tl.getInput('keychain');
            let keychainPath: string = tl.getTaskVariable('APPLE_CERTIFICATE_KEYCHAIN');

            let deleteCert: boolean = tl.getBoolInput('deleteCert');
            let hash: string = tl.getTaskVariable('APPLE_CERTIFICATE_SHA1HASH');
            if (deleteCert && hash) {
                sign.deleteCert(keychainPath, hash);
            }

            let deleteKeychain: boolean = false;
            if (keychain === 'temp') {
                deleteKeychain = true;
            } else if (keychain === 'custom') {
                deleteKeychain = tl.getBoolInput('deleteCustomKeychain');
            }

            if (deleteKeychain && keychainPath) {
                await sign.deleteKeychain(keychainPath);
            }
        }
    } catch (err) {
        tl.warning(err);
    }
}
開發者ID:Microsoft,項目名稱:vsts-tasks,代碼行數:32,代碼來源:postinstallcert.ts

示例2: run

async function run() {
    try {
        util.tryRestoreKnownHosts();

        let agentPid: string = tl.getTaskVariable(util.postKillAgentSetting);
        if (agentPid) {
            tl.debug('Killing SSH Agent PID: ' + agentPid);
            ps.kill(+agentPid);
        } else {
            let deleteKey: string = tl.getTaskVariable(util.postDeleteKeySetting);
            let sshTool: util.SshToolRunner = new util.SshToolRunner();
            sshTool.deleteKey(deleteKey)
        }
    } catch (err) {
        tl.setResult(tl.TaskResult.Failed, err);
    }
}
開發者ID:Microsoft,項目名稱:vsts-tasks,代碼行數:17,代碼來源:postinstallsshkey.ts

示例3: run

async function run() {
    try {
        tl.setResourcePath(path.join(__dirname, 'task.json'));
        const keystoreFile: string = tl.getTaskVariable('KEYSTORE_FILE_PATH');
        if (keystoreFile && tl.exist(keystoreFile)) {
            fs.unlinkSync(keystoreFile);
            tl.debug('Deleted keystore file downloaded from the server: ' + keystoreFile);
        }
    } catch (err) {
        tl.warning(tl.loc('DeleteKeystoreFileFailed', err));
    }
}
開發者ID:Microsoft,項目名稱:vsts-tasks,代碼行數:12,代碼來源:postandroidsigning.ts

示例4:

var jarsigning = (fn: string) => {
    // file must exist
    tl.checkPath(fn, 'file to sign');

    var jarsigner = tl.which("jarsigner", false);
    if (!jarsigner) {
        var java_home = tl.getVariable('JAVA_HOME');
        if (!java_home) {
            throw tl.loc('JavaHomeNotSet');
        }

        jarsigner = tl.resolve(java_home, 'bin', 'jarsigner');
    }

    var jarsignerRunner = tl.tool(jarsigner);

    // Get keystore file path for signing
    var keystoreFile = tl.getTaskVariable('KEYSTORE_FILE_PATH');

    // Get keystore alias
    var keystoreAlias = tl.getInput('keystoreAlias', true);

    var keystorePass = tl.getInput('keystorePass', false);

    var keyPass = tl.getInput('keyPass', false);

    var jarsignerArguments = tl.getInput('jarsignerArguments', false);

    jarsignerRunner.arg(['-keystore', keystoreFile]);

    if (keystorePass) {
        jarsignerRunner.arg(['-storepass', keystorePass]);
    }

    if (keyPass) {
        jarsignerRunner.arg(['-keypass', keyPass]);
    }

    if (jarsignerArguments) {
        jarsignerRunner.line(jarsignerArguments);
    }

    var unsignedFn = fn + ".unsigned";
    var success = tl.mv(fn, unsignedFn, '-f', false);

    jarsignerRunner.arg(['-signedjar', fn, unsignedFn, keystoreAlias]);

    return jarsignerRunner.exec(null);
}
開發者ID:Microsoft,項目名稱:vsts-tasks,代碼行數:49,代碼來源:androidsigning.ts

示例5: findAndroidTool

const apksigning = (fn: string) => {
    // file must exist
    tl.checkPath(fn, 'file to sign');

    let apksigner = tl.getInput('apksignerLocation', false);

    // if the tool path is not set, let's find one (anyone) from the SDK folder
    if (!apksigner) {
        apksigner = findAndroidTool('apksigner');
    }

    const apksignerRunner = tl.tool(apksigner);

    // Get keystore file path for signing
    const keystoreFile = tl.getTaskVariable('KEYSTORE_FILE_PATH');

    // Get keystore alias
    const keystoreAlias = tl.getInput('keystoreAlias', true);

    const keystorePass = tl.getInput('keystorePass', false);

    const keyPass = tl.getInput('keyPass', false);

    const apksignerArguments = tl.getInput('apksignerArguments', false);

    apksignerRunner.arg(['sign', '--ks', keystoreFile]);

    if (keystorePass) {
        apksignerRunner.arg(['--ks-pass', 'pass:' + keystorePass]);
    }

    if (keystoreAlias) {
        apksignerRunner.arg(['--ks-key-alias', keystoreAlias]);
    }

    if (keyPass) {
        apksignerRunner.arg(['--key-pass', 'pass:' + keyPass]);
    }

    if (apksignerArguments) {
        apksignerRunner.line(apksignerArguments);
    }

    apksignerRunner.arg([fn]);

    return apksignerRunner.exec(null);
};
開發者ID:Microsoft,項目名稱:vsts-tasks,代碼行數:47,代碼來源:androidsigning.ts


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