我有一个BitBucket Pipeline,它使用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
如何访问由安装过程创建的构建.log?
显然最近Bitbucket添加了一个名为"after-script"的功能,因此我可以添加以下内容,这将打印日志文件的内容。
after-script:
- ls -1 /root/.cpanm/work/*/build.log | xargs cat
甚至可能是这个:
after-script:
- cat /root/.cpanm/work/*/build.log
我认为,以下内容只会在构建失败时显示日志文件的内容:
after-script:
- $BITBUCKET_EXIT_CODE && cat /root/.cpanm/work/*/build.log
在此处阅读更多内容: https://bitbucket.org/blog/after-scripts-now-available-for-bitbucket-pipelines