Modernize ensure-nodejs
The ensure-nodejs role defaults to install nodejs 6 which produces this error currently: Failed to update apt cache: W:The repository 'https://deb.nodesource.com/node_6.x noble Release' does not have a Release file., W:Data from such a repository can't be authenticated and is therefore potentially dangerous to use. We need to make a few changes to bring this ensure-nodejs role up to modern expectations for nodesource usage. First we drop the default nodejs version from ensure-nodejs. Everyone is already setting this value to make this role work or they are broken and will need to change something anyway. This gets us off of the nodejs update treadmill in this role. Then with nodejs 16 and newer there is a new gpg key and no deb-src packages so we need to change the apt configuration if using 16 and newer. We make these changes to match the corresponding setup_16.x etc scripts from nodesource. Change-Id: I0d5c93e4fbcee0be2cc477bf9f625e419a2b9bd1
This commit is contained in:
parent
b16fae463e
commit
efa55f881d
@ -1,2 +0,0 @@
|
|||||||
---
|
|
||||||
node_version: 6
|
|
@ -25,6 +25,17 @@
|
|||||||
repositories_list:
|
repositories_list:
|
||||||
- repo: deb-src https://deb.nodesource.com/node_{{ node_version }}.x {{ ansible_distribution_release }} main
|
- repo: deb-src https://deb.nodesource.com/node_{{ node_version }}.x {{ ansible_distribution_release }} main
|
||||||
- repo: deb https://deb.nodesource.com/node_{{ node_version }}.x {{ ansible_distribution_release }} main
|
- repo: deb https://deb.nodesource.com/node_{{ node_version }}.x {{ ansible_distribution_release }} main
|
||||||
|
when: node_version | int < 16
|
||||||
|
|
||||||
|
- name: Add all repositories
|
||||||
|
include_role:
|
||||||
|
name: ensure-package-repositories
|
||||||
|
vars:
|
||||||
|
repositories_keys:
|
||||||
|
- url: https://deb.nodesource.com/gpgkey/nodesource-repo.gpg.key
|
||||||
|
repositories_list:
|
||||||
|
- repo: deb https://deb.nodesource.com/node_{{ node_version }}.x nodistro main
|
||||||
|
when: node_version | int >= 16
|
||||||
|
|
||||||
# Use template so that we can easily update this in the future to be able to
|
# Use template so that we can easily update this in the future to be able to
|
||||||
# use a mirror location.
|
# use a mirror location.
|
||||||
|
@ -7,6 +7,7 @@
|
|||||||
run: test-playbooks/simple-role-test.yaml
|
run: test-playbooks/simple-role-test.yaml
|
||||||
vars:
|
vars:
|
||||||
role_name: ensure-nodejs
|
role_name: ensure-nodejs
|
||||||
|
node_version: 20
|
||||||
|
|
||||||
- job:
|
- job:
|
||||||
name: zuul-jobs-test-ensure-yarn
|
name: zuul-jobs-test-ensure-yarn
|
||||||
@ -18,6 +19,7 @@
|
|||||||
run: test-playbooks/simple-role-test.yaml
|
run: test-playbooks/simple-role-test.yaml
|
||||||
vars:
|
vars:
|
||||||
role_name: ensure-yarn
|
role_name: ensure-yarn
|
||||||
|
node_version: 20
|
||||||
|
|
||||||
- job:
|
- job:
|
||||||
name: zuul-jobs-test-fetch-javascript-tarball
|
name: zuul-jobs-test-fetch-javascript-tarball
|
||||||
|
@ -327,7 +327,7 @@
|
|||||||
Command to pass to npm.
|
Command to pass to npm.
|
||||||
|
|
||||||
.. zuul:jobvar:: node_version
|
.. zuul:jobvar:: node_version
|
||||||
:default: 6
|
:default: 14
|
||||||
|
|
||||||
The version of Node to use.
|
The version of Node to use.
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user