Files
patchback[bot] caeafeec1f [PR #11943/38d49d24 backport][stable-12] yarn: add Alpine Linux support in integration tests (#12002)
yarn: add Alpine Linux support in integration tests (#11943)

* test(yarn): add Alpine Linux support via apk

Install nodejs and yarn via apk on Alpine, sharing the functional
test block with the existing non-Alpine (pre-built binary) path.
Extracts the test block into tests.yml to avoid duplication.

Fixes #4270



* fix(yarn): skip Node.js runtime warnings in stderr processing

Node.js 24 emits DeprecationWarning lines to stderr (e.g. for url.parse())
that are not JSON, causing _process_yarn_error to fail with "Unexpected
stderr output from Yarn". Skip lines starting with "(node:" before
attempting JSON parsing.



* test(yarn): add changelog fragment for #11943



* fix(yarn): only JSON-parse lines starting with '{' in stderr

Node.js 24 emits multi-line DeprecationWarnings to stderr (e.g. the hint
line "(Use `node --trace-deprecation ...`") that are not JSON and were
tripping the "Unexpected stderr output from Yarn" failure. Yarn's
structured output always starts with '{', so skip any line that doesn't.



* test(yarn): install sqlite on Alpine to fix nodejs 22 symbol error

On Alpine 3.21 nodejs 22 requires SQLite session extension symbols
(sqlite3session_*) that are not present in sqlite-libs; installing
the full sqlite package provides them.



* test(yarn): refresh apk cache and upgrade sqlite-libs before installing nodejs

The CI Alpine container may have a stale sqlite-libs that lacks the
session extension symbols (sqlite3session_*) required by nodejs 22+.
Force a cache refresh and upgrade sqlite-libs to the latest revision.



* fix(yarn): warn on non-JSON stderr lines instead of silently skipping

Non-JSON lines in stderr (e.g. Node.js runtime DeprecationWarnings) are
surfaced to the user via module.warn() rather than being silently ignored,
since their content and meaning are not known in advance.



* prefix yarn output line

* Update changelogs/fragments/11943-yarn-nodejs-runtime-warnings.yml



---------



(cherry picked from commit 38d49d240e)

Co-authored-by: Alexei Znamensky <103110+russoz@users.noreply.github.com>
Co-authored-by: Claude Sonnet 4.6 <noreply@anthropic.com>
Co-authored-by: Felix Fontein <felix@fontein.de>
2026-05-06 20:10:35 +02:00

43 lines
1.3 KiB
YAML

---
# Copyright (c) Ansible Project
# GNU General Public License v3.0+ (see LICENSES/GPL-3.0-or-later.txt or https://www.gnu.org/licenses/gpl-3.0.txt)
# SPDX-License-Identifier: GPL-3.0-or-later
- name: 'Create directory for Node'
file:
path: /usr/local/lib/nodejs
state: directory
- name: Show Node.js Download URL
debug:
var: nodejs_download
- name: Download Node.js
unarchive:
src: '{{ nodejs_download }}'
dest: '{{ remote_tmp_dir }}'
remote_src: true
creates: '{{ remote_tmp_dir }}/{{ nodejs_path }}.tar.gz'
- name: 'Download Yarn'
unarchive:
src: 'https://github.com/yarnpkg/yarn/releases/download/v{{yarn_version}}/yarn-v{{yarn_version}}.tar.gz'
dest: '{{ remote_tmp_dir }}'
remote_src: true
creates: '{{ remote_tmp_dir }}/yarn-v{{yarn_version}}_pkg.tar.gz'
- name: 'Copy node to directory created earlier'
command: "mv {{ remote_tmp_dir }}/{{ nodejs_path }} /usr/local/lib/nodejs/{{nodejs_path}}"
# Clean up before running tests
- name: Remove any previous Nodejs modules
file:
path: '{{remote_tmp_dir}}/node_modules'
state: absent
- include_tasks: tests.yml
vars:
node_bin_path: "/usr/local/lib/nodejs/{{ nodejs_path }}/bin"
yarn_bin_path: "{{ remote_tmp_dir }}/yarn-v{{ yarn_version }}/bin"
package: 'iconv-lite'