Skip to content

Instantly share code, notes, and snippets.

@urjitbhatia
Created January 10, 2017 19:21
Show Gist options
  • Save urjitbhatia/c746bf12b9947f436004a0dd9e34f146 to your computer and use it in GitHub Desktop.
Save urjitbhatia/c746bf12b9947f436004a0dd9e34f146 to your computer and use it in GitHub Desktop.
Running multiple instances of yarnpkg jobs on CI servers
#!/bin/bash
# Place this file in your /usr/local/bin and then use darn instead of calling yarn
# This will wrap all your yarn calls to go through the same network mutex
# Calling yarn as before still works too if needed.
# --- Motivation ---
# Running multiple build jobs on CI servers like Jenkins will cause contention of
# shared yarnpkg resources (cache). This is going to end up badly for builds going
# out for deployment. This problem is usually not seen locally because devs rarely build
# multiple projects at a time on their local machines.
set -ex
yarn "$@" --mutex network
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment