From 303a3a2a23b0ca81cdc9788ab2a7fc43db4a3a61 Mon Sep 17 00:00:00 2001 From: "E. Dunham" Date: Thu, 7 Sep 2017 11:20:56 -0700 Subject: [PATCH] 2GB swapfile on Linux slaves to address https://github.com/servo/saltfs/issues/711 from example at https://serverfault.com/questions/628531/how-to-enable-swap-with-salt-stack --- buildbot/slave/init.sls | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/buildbot/slave/init.sls b/buildbot/slave/init.sls index 7457453d..3c24c83c 100644 --- a/buildbot/slave/init.sls +++ b/buildbot/slave/init.sls @@ -67,3 +67,20 @@ buildbot-slave: - pip: buildbot-slave-dependencies - file: {{ common.servo_home }}/buildbot/slave {% endif %} + +{% if grains.get('virtual_subtype', '') != 'Docker' and grains['kernel'] == 'Linux' %} +coreutils: + pkg.installed + +/swapfile: + cmd.run: + - name: | + [ -f /swapfile ] || dd if=/dev/zero of=/swapfile bs=1M count=2048k + chmod 0600 /swapfile + mkswap /swapfile + swapon -a + - unless: + - file /swapfile 2>&1 | grep -q "Linux/i386 swap" + mount.swap: + - persist: true +{% endif %}