我正在努力建立构建链。基本体系结构是:build > test > deploy
。这是用于测试功能分支,因此我希望部署是自动的。我也只想在构建步骤中构建一次应用程序,而不是在每个工作中都构建一次。因此,请输入快照/工件依赖关系。
我相信我的构建链依赖关系全部井井有条。我在deploy
上设置了VCS触发器,以侦听代码更改。
然后deploy
对test
具有快照和工件依赖性。根据{{1}},test
也是如此。
一旦在build
步骤中构建了该应用程序,我便将其压缩以切换到build
。我第一份工作test
的工件路径为:build
。
我仔细检查了此zip文件,成功复制了包括%system.teamcity.build.checkoutDir%/** => st_ui.zip
在内的整个项目。
到目前为止一切都很好。在node_modules
中,我的工件依赖性规则是解压缩zip并将其复制到build agent工作目录:test
现在,我可以成功解压缩zip,但是,一旦尝试在应用程序上执行,就会收到st_ui.zip!** => %system.teamcity.build.checkoutDir%
错误。我将在下面附加构建日志。当我SSH到构建代理服务器并尝试执行时,出现相同的错误。这种执行是通过拥有我要执行的文件所在目录的超级用户来完成的,因此我很难将头缠在那个文件上。
Exit Code 126 Permission Denied
我在这里遇到的一个想法是结帐目录为[12:31:06] Finalize build settings
[12:31:06] Collecting changes in 1 VCS root
[12:31:11] Skip checking for changes - changes are already collected
[12:31:12] Clearing temporary directory: /opt/teamcity/temp/buildTmp
[12:31:12] Publishing internal artifacts (3s)
[12:31:12] Checkout directory: /opt/teamcity/work/a289be5eae7725c
[12:31:12] Updating sources: auto checkout (on agent)
[12:31:12] [Updating sources] Will use agent side checkout
[12:31:12] Resolving artifact dependencies (18s)
[12:31:12] [Resolving artifact dependencies] Started downloading files from REDACTED
[12:31:30] [Resolving artifact dependencies] 94608 files retrieved from REDACTED for pattern [st_ui.zip!** => /opt/teamcity/work/a289be5eae7725c]
[12:31:30] Step 1/1: Run Tests (Gulp)
[12:31:30] [Step 1/1] Executing /opt/teamcity/work/a289be5eae7725c/node_modules/.bin/gulp via wrapping shell script
[12:31:30] [Step 1/1] Starting: /opt/teamcity/temp/agentTmp/wrapper3645075516094104483.sh --no-color --teamcity.properties.all=/opt/teamcity/temp/agentTmp/teamcity6742679845678469104.json --teamcity.properties=/opt/teamcity/temp/agentTmp/teamcity6827850557743504325.json test
[12:31:30] [Step 1/1] in directory: /opt/teamcity/work/a289be5eae7725c
[12:31:30] [Step 1/1] /opt/teamcity/temp/agentTmp/wrapper3645075516094104483.sh: line 2: /opt/teamcity/work/a289be5eae7725c/node_modules/.bin/gulp: Permission denied
[12:31:30] [Step 1/1] Process exited with code 126
[12:31:30] [Step 1/1] Step Run Tests (Gulp) failed
[12:31:30] Publishing internal artifacts
[12:31:30] Publishing artifacts (1m:24s)
[12:33:04] Build finished
,而作业似乎在临时目录中执行:/opt/teamcity/work/a289be5eae7725c
关于作业执行位置的差异可能解释了我的身份验证问题。我应该将应用复制到其他地方吗?我只想将应用程序压缩为作业之间的zip并将应用程序移交给下一个构建代理(在相同的TC许可下,它可以是另一台服务器上的不同代理),它不必是签出目录,这是我目前对应用程序应该去哪里的理解。