Codeship times out using yarn in build pipeline

749 views Asked by At

I used to use a custom build, test and deploy script for codeship and npm. Moving to yarn now, I want to continue using codeship. Hoowever, it always times out on the yarn command after 10 minutes.

The relevant part of the script is:

nvm install 6.3.1
npm install yarn
yarn

This produces:

yarn install v0.18.1
[1/4] Resolving packages...
[2/4] Fetching packages...
warning [email protected]: The platform "linux" is incompatible with this module.
info "[email protected]" is an optional dependency and failed compatibility check. Excluding it from installation.
[3/4] Linking dependencies...
warning Incorrect peer dependency "joi@^9.0.4".
[4/4] Building fresh packages...

--------------------------------------------------------------------------------
This command didn't output anything for 10 minutes, thus we stopped it.
Please make sure your steps regularly print to standard out or standard error.
If the error is on our end please inform us so we can help you to fix this.
--------------------------------------------------------------------------------

Are the two (yarn and codeship) incompatible?

1

There are 1 answers

0
Alex Strizhak On

@simon to resolve - add those tow lines into Setup Commands section:

function prevent_codeship_timeout() { ( for i in {1..5}; do echo "Preventing Codeship timeout by echoing every 300 seconds"; sleep 300; done ) & local pid=$!; trap 'kill ${pid}' SIGINT SIGTERM EXIT; }
prevent_codeship_timeout &

by reaching out to this issue in Codeship support, Joe Siewert helped to resolve it:

For this I recommend adding this script as a build step and then call it right after in the background. This will just print some log output periodically to keep the build running. It will run a fixed number of times so you may need to increase/decrease the iterations (the {1..5} part) depending on how long your build step runs

Note it is important to paste that whole function into the build steps as a single line otherwise it won't be read in correctly

Thanks for your help Joe Siewert!