From 8a86f7c7fc5ee4a343cec0e6649cf9c7a1a3d819 Mon Sep 17 00:00:00 2001 From: Monty Taylor Date: Fri, 15 Dec 2017 19:25:08 -0600 Subject: [PATCH] Don't run npm shrinkwrap if using yarn If we're using yarn, it means we started from a yarn.lock file in the first place. If that's true, we don't need to *produce* a shrinkwrap file. Needed-By: I848f22dce6196b2df9de4b9f585e857e03cdb0d7 Change-Id: I6519ff5ea7ac4b79e46f29c6190d660718d03f1b --- roles/fetch-javascript-output/tasks/main.yaml | 19 ++++++++++++++++--- 1 file changed, 16 insertions(+), 3 deletions(-) diff --git a/roles/fetch-javascript-output/tasks/main.yaml b/roles/fetch-javascript-output/tasks/main.yaml index b44743107..e173556b9 100644 --- a/roles/fetch-javascript-output/tasks/main.yaml +++ b/roles/fetch-javascript-output/tasks/main.yaml @@ -14,13 +14,21 @@ state: directory delegate_to: localhost +- name: Check for yarn.lock + stat: + path: "{{ zuul_work_dir }}/yarn.lock" + register: yarn_lock + - name: Check for shrinkwrap stat: path: "{{ zuul_work_dir }}/npm-shrinkwrap.json" + when: not yarn_lock.stat.exists register: shrinkwrap - name: Run npm prune because of https://github.com/npm/npm/issues/6298 - when: not shrinkwrap.stat.exists + when: + - not yarn_lock.stat.exists + - not shrinkwrap.stat.exists command: npm prune environment: DISPLAY: ':99' @@ -28,7 +36,9 @@ chdir: "{{ zuul_work_dir }}" - name: Run npm shrinkwrap - when: not shrinkwrap.stat.exists + when: + - not yarn_lock.stat.exists + - not shrinkwrap.stat.exists command: npm shrinkwrap environment: DISPLAY: ':99' @@ -62,6 +72,7 @@ when: karma_stat.stat.exists - name: Check again for shrinkwrap + when: not yarn_lock.stat.exists stat: path: "{{ zuul_work_dir }}/npm-shrinkwrap.json" register: shrinkwrap_final @@ -72,4 +83,6 @@ mode: pull src: "{{ zuul_work_dir }}/npm-shrinkwrap.json" verify_host: true - when: shrinkwrap_final.stat.exists + when: + - not yarn_lock.stat.exists + - shrinkwrap_final.stat.exists