From 6920617af5ed5aa2f5a415f6d3b218485618720a Mon Sep 17 00:00:00 2001 From: Mohammed Naser Date: Mon, 6 Apr 2020 13:54:55 -0400 Subject: [PATCH] ensure-yarn: run ensure-nodejs before YARN needs a modern version of NodeJS and if we don't use the role to get the latest version, we end up failing on most platforms that ship an old version of it. This patch also adds testing to validate that ensure-yarn alone works. Co-Authored-By: Andreas Jaeger Change-Id: I83ac09bc5751c85c6f1eac550d289a300ca2255e --- playbooks/javascript/pre.yaml | 1 - roles/ensure-yarn/README.rst | 7 ++++++- roles/ensure-yarn/tasks/main.yaml | 4 ++++ zuul-tests.d/js-roles-jobs.yaml | 11 +++++++++++ 4 files changed, 21 insertions(+), 2 deletions(-) diff --git a/playbooks/javascript/pre.yaml b/playbooks/javascript/pre.yaml index 9511854fa..b8c3ff5fa 100644 --- a/playbooks/javascript/pre.yaml +++ b/playbooks/javascript/pre.yaml @@ -1,5 +1,4 @@ - hosts: all roles: - - ensure-nodejs - ensure-yarn - ensure-javascript-packages diff --git a/roles/ensure-yarn/README.rst b/roles/ensure-yarn/README.rst index 04ecc5acf..b55335581 100644 --- a/roles/ensure-yarn/README.rst +++ b/roles/ensure-yarn/README.rst @@ -1 +1,6 @@ -Install yarn from yarnpkg repos +Install yarn from yarnpkg repos. + +This role use the role :zuul:role:`ensure-nodejs` to ensure that +NodeJS is installed. See the documentation for +:zuul:role:`ensure-nodejs` and specify the version of NodeJS to +install. diff --git a/roles/ensure-yarn/tasks/main.yaml b/roles/ensure-yarn/tasks/main.yaml index 8c69e4b91..4a9fc32a7 100644 --- a/roles/ensure-yarn/tasks/main.yaml +++ b/roles/ensure-yarn/tasks/main.yaml @@ -1,3 +1,7 @@ +- name: Install NodeJS + include_role: + name: ensure-nodejs + - name: Gather variables for each operating system include_vars: "{{ zj_item }}" with_first_found: diff --git a/zuul-tests.d/js-roles-jobs.yaml b/zuul-tests.d/js-roles-jobs.yaml index c6530c8d5..f7ccc2858 100644 --- a/zuul-tests.d/js-roles-jobs.yaml +++ b/zuul-tests.d/js-roles-jobs.yaml @@ -8,6 +8,16 @@ vars: role_name: ensure-nodejs +- job: + name: zuul-jobs-test-ensure-yarn + description: Test the ensure-yarn role + files: + - roles/ensure-yarn/.* + - roles/ensure-nodejs/.* + - roles/ensure-package-repositories/.* + run: test-playbooks/simple-role-test.yaml + vars: + role_name: ensure-yarn - job: name: zuul-jobs-test-fetch-javascript-tarball @@ -37,6 +47,7 @@ check: jobs: &id001 - zuul-jobs-test-ensure-nodejs + - zuul-jobs-test-ensure-yarn - zuul-jobs-test-fetch-javascript-tarball - zuul-jobs-test-fetch-javascript-tarball-synchronize gate: