gpt4 book ai didi

azure-devops - Chocolatey 无法在 Azure Pipeline 上安装 Inno Setup

转载 作者:行者123 更新时间:2023-12-04 04:21:12 26 4
gpt4 key购买 nike

我正在尝试在 Azure Devops 上的内置 VS2017 代理上安装 Inno Setup 5 用于我的构建管道之一,但我在标准输出中得到以下两行,但它以代码退出1 并且日志文件中没有任何内容。我的问题:

  • Inno支持这样安装吗?
  • 我做错了什么?
  • chocolatey 是否需要在具有登录 GUI 的机器上运行?

这是我认为最重要的来自标准输出的两行

    innosetup not installed. An error occurred during installation:
The process cannot access the file '...\.chocolateyPending' because it is being used by another process.

这是我在 Azure Devops 上的构建管道:

enter image description here

我的安装程序脚本是用 javascript 编写的,并在安装依赖项后通过 npm 脚本执行

const utils = require('./utils');
const fs = require('fs');
const path = require('path');
const spawn = require('child_process').spawn;

const command = 'cmd /c choco install innosetup --yes --force --no-progress -ia \'/VERYSILENT\'';
const logDirectory = path.join( 'C:', 'ProgramData', 'chocolatey', 'logs' );

function install() {
return new Promise( resolve => {

const cmd = command.split(' ').filter( ( x, i ) => i === 0 ).join('');
const args = command.split(' ').filter( ( x, i ) => i !== 0 );

var sqlcmd = spawn( cmd, args );
sqlcmd.stdout.on( 'data', data => {
console.log( data.toString().replace( /\r\n$/gmi, '' ) );
} )
sqlcmd.stderr.on( 'data', data => {
console.error( 'error', data.toString() );
process.exit( 1 );
} )
sqlcmd.on( 'exit', code => {
resolve( code );
} )

});
}

( async () => {

utils.header( 'installing Inno Setup' );
const installExitCode = await install();

utils.header( 'Log directory:', logDirectory );
console.log( ' *', fs.readdirSync( logDirectory ).join( '\r\n * ' ) );
utils.header( 'chocolatey.log' );
fs.createReadStream( path.join( logDirectory, 'chocolatey.log' ) ).pipe( process.stdout );
utils.header( 'choco.summary.log' );
fs.createReadStream( path.join( logDirectory, 'choco.summary.log' ) ).pipe( process.stdout );

if ( installExitCode !== 0 ) {
console.log( 'installer exited with error code:', installExitCode );
process.exit( installExitCode );
}

})();

这是我从失败的 Azure Devops 构建中获得的标准输出:

2019-01-22T18:34:19.0336866Z ########################################
2019-01-22T18:34:19.0337014Z
2019-01-22T18:34:19.0337191Z installing Inno Setup
2019-01-22T18:34:19.0337335Z
2019-01-22T18:34:19.0337513Z Chocolatey v0.10.11
2019-01-22T18:34:19.0337798Z Installing the following packages:
2019-01-22T18:34:19.0338258Z innosetup
2019-01-22T18:34:19.0338554Z By installing you accept licenses for the packages.
2019-01-22T18:34:19.0338705Z
2019-01-22T18:34:19.0338856Z InnoSetup v5.6.1 (forced) [Approved]
2019-01-22T18:34:19.0339051Z innosetup package files install completed. Performing other installation steps.
2019-01-22T18:34:19.0339266Z innosetup not installed. An error occurred during installation:
2019-01-22T18:34:19.0339462Z Item has already been added. Key in dictionary: 'NPM_CONFIG_CACHE' Key being added: 'npm_config_cache'
2019-01-22T18:34:19.0339703Z The process cannot access the file 'C:\ProgramData\chocolatey\lib\InnoSetup\.chocolateyPending' because it is being used by another process.
2019-01-22T18:34:19.0339890Z
2019-01-22T18:34:19.0340054Z ########################################
2019-01-22T18:34:19.0340204Z
2019-01-22T18:34:19.0340364Z Log directory: C:\ProgramData\chocolatey\logs
2019-01-22T18:34:19.0340513Z
2019-01-22T18:34:19.0340775Z * choco.summary.log
2019-01-22T18:34:19.0342937Z * chocolatey.log
2019-01-22T18:34:19.0343090Z
2019-01-22T18:34:19.0343282Z ########################################
2019-01-22T18:34:19.0343425Z
2019-01-22T18:34:19.0343598Z chocolatey.log
2019-01-22T18:34:19.0343738Z
2019-01-22T18:34:19.0344018Z
2019-01-22T18:34:19.0344255Z ########################################
2019-01-22T18:34:19.0344406Z
2019-01-22T18:34:19.0344582Z choco.summary.log
2019-01-22T18:34:19.0344722Z
2019-01-22T18:34:19.0344902Z installer exited with error code: 1

最佳答案

回答您的一些直接问题...

Does Inno Support being installed in this way?

是的,innosetup 确实支持以这种方式安装。您可以在包页面上看到 here .页面顶部的绿色灯泡表示此软件包版本已通过 Chocolatey 拥有的自动化流程正确安装,从而验证软件包是否已正确安装。

Does chocolatey require being run on machine with a logged in GUI?

不,在大多数情况下这不是必需的。有些 Chocolatey 包不会静默安装,用于安装这些包的机制“可能”要求安装在实际用户进程中运行,但大多数包不需要这个。

What am I doing wrong?

我怀疑“某些东西”在通过 npm 运行并安装在 Promise 中时无法正常工作。查看日志,好像有这样一条:

2019-01-22T18:34:19.0339462Z Item has already been added. Key in dictionary: 'NPM_CONFIG_CACHE' Key being added: 'npm_config_cache'

在 Chocolatey 日志的中间,这对我来说没有意义。

我最好的建议是在此 extension 上使用独立的 Chocolatey Task (注意:完全公开,我是这个扩展的作者),或者,尝试在 npm 之外进行安装,可能直接使用 PowerShell 任务。

关于azure-devops - Chocolatey 无法在 Azure Pipeline 上安装 Inno Setup,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/54314785/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com