szabgab
szabgab

Reputation: 6302

Viewing the cpanm error log in Bitbucket pipelines when installing a Perl module fails

I have a BitBucket Pipeline that installs a bunch of Perl modules using cpanm. One of them fails and this is the snippet I can see in the log:

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

How could I access the build.log that was created by the installation process?

Upvotes: 5

Views: 823

Answers (1)

szabgab
szabgab

Reputation: 6302

Apparently recently Bitbucket added a feature called "after-script" so I could add the following and that would print the content of the log files.

       after-script:
          - ls -1 /root/.cpanm/work/*/build.log | xargs cat

or maybe even this:

       after-script:
          - cat /root/.cpanm/work/*/build.log

and the following, I think, will only show the content of the log files if the build failed:

       after-script:
          - $BITBUCKET_EXIT_CODE && cat /root/.cpanm/work/*/build.log

Read more here: https://bitbucket.org/blog/after-scripts-now-available-for-bitbucket-pipelines

Upvotes: 3

Related Questions