sza*_*gab 5 perl bitbucket cpanm bitbucket-pipelines
我有一个BitBucket管道,该管道使用cpanm安装了一堆Perl模块。其中之一失败了,这是我在日志中看到的摘录:
Fetching http://www.cpan.org/authors/id/P/PE/PETDANCE/ack-v3.0.2.tar.gz ... OK
Configuring ack-v3.0.2 ... OK
==> Found dependencies: File::Next
--> Working on File::Next
Fetching http://www.cpan.org/authors/id/P/PE/PETDANCE/File-Next-1.16.tar.gz ... OK
Configuring File-Next-1.16 ... OK
Building and testing File-Next-1.16 ... OK
Successfully installed File-Next-1.16
! Installing App::Ack failed. See /root/.cpanm/work/1562605191.55/build.log for details. Retry with --force to force install it.
! Installing the dependencies failed: Module 'App::Ack' is not installed
! Bailing out the installation for ..
Building and testing ack-v3.0.2 ... FAIL
Run Code Online (Sandbox Code Playgroud)
如何访问安装过程中创建的build.log?
显然最近 Bitbucket 添加了一个名为“after-script”的功能,因此我可以添加以下内容,这将打印日志文件的内容。
after-script:
- ls -1 /root/.cpanm/work/*/build.log | xargs cat
Run Code Online (Sandbox Code Playgroud)
或者甚至是这样的:
after-script:
- cat /root/.cpanm/work/*/build.log
Run Code Online (Sandbox Code Playgroud)
我认为,以下内容只会在构建失败时显示日志文件的内容:
after-script:
- $BITBUCKET_EXIT_CODE && cat /root/.cpanm/work/*/build.log
Run Code Online (Sandbox Code Playgroud)
在这里阅读更多信息:https ://bitbucket.org/blog/after-scripts-now-available-for-bitbucket-pipelines