Skip to content

Conversation

Copy link
Contributor

Copilot AI commented Sep 12, 2025

The npm source installation tests were defined but not being executed in the CI pipeline, and the underlying npm_from_source recipe had a critical bug that prevented npm from being installed from source.

Issues Fixed

  1. npm_from_source Recipe Bug: The recipe used :install_with_make action which attempted to run make and make install, but npm is a pure JavaScript package without a Makefile. This caused all npm source installations to fail.

  2. Missing CI Test Suite: The npm_source test suite exists in kitchen.yml with corresponding test files in /test/integration/npm_source/, but the npm-source entry was missing from the GitHub Actions CI matrix.

  3. Platform Configuration Mismatches: CI platform names didn't match Test Kitchen's instance naming convention (debian-11 removed, ubuntu naming corrected to match Test Kitchen's format).

Changes Made

  • Fixed npm_from_source.rb: Changed from :install_with_make to :install action with has_binaries ['bin/npm', 'bin/npx'] to properly extract and symlink npm binaries
  • Added npm-source to CI: Added "npm-source" to the CI test suite matrix in .github/workflows/ci.yml
  • Added platform exclusions: Added exclusions for amazonlinux-2023 and fedora-latest platforms for the npm-source suite, matching the exclusions for the nodejs source suite since npm source installation depends on nodejs source installation
  • Fixed platform names: Updated CI to use debian-12, ubuntu-2204, and ubuntu-2404 to match Test Kitchen's instance naming convention (Test Kitchen strips dots from platform names when creating instances)
  • Updated CHANGELOG.md: Added bug fix entries per Sous Chefs standards

Test Coverage

The npm-source suite now tests npm source installation across 7 Linux distributions:

  • almalinux-9, rockylinux-9
  • centos-stream-9, centos-stream-10
  • debian-12
  • ubuntu-2204, ubuntu-2404

The existing test files verify that:

  • npm command works (npm -v)
  • npx command works (npx -v)
  • npm binaries are properly installed in /usr/local/bin/

Validation

  • ✅ Cookstyle: 40 files, 0 offenses
  • ✅ Yamllint: All YAML files pass
  • ✅ RSpec: 23 unit tests, all passing
  • ✅ Code review: No issues found
  • ✅ CodeQL security scan: No vulnerabilities

This ensures npm source installation is properly tested and functional alongside the existing npm embedded installation tests.

Fixes #232.


💬 Share your feedback on Copilot coding agent for the chance to win a $200 gift card! Click here to start the survey.

Copy link
Contributor Author

Copilot AI commented Sep 12, 2025

@damacus 👋 This repository doesn't have Copilot instructions. With Copilot instructions, I can understand the repository better, work faster and produce higher quality PRs.

I can generate a .github/copilot-instructions.md file for you automatically. Click here to open a pre-filled issue and assign it to me. I'll write the instructions, and then tag you for review.

Copilot AI changed the title [WIP] npm source install needs running tests Add npm-source suite to CI pipeline to enable npm source installation testing Sep 12, 2025
Copilot AI requested a review from damacus September 12, 2025 22:10
@damacus damacus marked this pull request as ready for review October 30, 2025 15:42
@damacus damacus requested a review from a team as a code owner October 30, 2025 15:42
@damacus damacus enabled auto-merge (squash) October 30, 2025 15:43
@damacus damacus changed the title Add npm-source suite to CI pipeline to enable npm source installation testing fix: Add npm-source suite to CI pipeline to enable npm source installation testing Oct 30, 2025
@damacus
Copy link
Member

damacus commented Oct 31, 2025

@copilot Investigqte and fix errors woth newly enabled suite

…m names

- Changed npm_from_source.rb to use :install action instead of :install_with_make
- Added has_binaries property to specify npm and npx binaries for symlinking
- Fixed CI platform names to match kitchen.dokken.yml (debian-12 only, ubuntu-22.04, ubuntu-24.04)
- npm doesn't have a Makefile and doesn't need compilation - it's a pure JavaScript package

Co-authored-by: damacus <[email protected]>
auto-merge was automatically disabled October 31, 2025 08:47

Head branch was pushed to by a user without write access

Copy link
Contributor Author

Copilot AI commented Oct 31, 2025

@copilot Investigqte and fix errors woth newly enabled suite

Fixed in commits 6bb6446 and 76b07ad.

Root cause: The npm_from_source recipe used :install_with_make action, but npm is a JavaScript package without a Makefile.

Changes:

  • Changed to :install action with has_binaries ['bin/npm', 'bin/npx'] for proper symlinking
  • Fixed CI platform names to match kitchen.dokken.yml (removed debian-11, fixed ubuntu naming)

All linters and unit tests pass. CI is now running to validate the fixes.

Copilot AI changed the title fix: Add npm-source suite to CI pipeline to enable npm source installation testing fix: Add npm-source suite to CI pipeline and fix npm source installation recipe Oct 31, 2025
Copilot AI requested a review from damacus October 31, 2025 08:52
@github-actions
Copy link

github-actions bot commented Nov 1, 2025

Slowest examples

Top 10 slowest examples (6.58 seconds, 99.86% of total time)
Example Description Time in seconds
spec/unit/recipes/default_spec.rb:7 default recipe on ubuntu 22.04 includes the package install recipes 1.73352
spec/unit/recipes/default_spec.rb:21 default recipe on centos 8 includes the package install recipes 1.04149
spec/unit/recipes/default_spec.rb:50 default recipe on mac_os_x includes the package install recipes 1.01867
spec/unit/recipes/default_spec.rb:67 default recipe on fedora includes the package install recipes 1.00608
spec/unit/recipes/default_spec.rb:36 default recipe on debian 12 includes the package install recipes 1.00099
spec/unit/library/helper_spec.rb:18 helper methods npm_dist should return a url based on the version 0.7649
spec/unit/library/helper_spec.rb:12 helper methods npm_dist should return a url if specified in the node attributes 0.01172
spec/unit/library/helper_spec.rb:38 helper methods url_valid? should return true the url of an installed package for a valid value 0.00447
spec/unit/library/helper_spec.rb:43 helper methods url_valid? should return true an installed package that does not have a url 0.0015
spec/unit/library/helper_spec.rb:48 helper methods url_valid? should return false for an installed package that has an invalid url 0.00148

@damacus
Copy link
Member

damacus commented Nov 1, 2025

@copilot continue iterating on the issues.

Once you have identified one error. Fix and iterate until kitchen test completes without error

Test Kitchen converts dots to empty strings in instance names, so
ubuntu-22.04 in kitchen.dokken.yml becomes ubuntu-2204 in instance names

Co-authored-by: damacus <[email protected]>
Copy link
Contributor Author

Copilot AI commented Nov 1, 2025

@copilot continue iterating on the issues.

Once you have identified one error. Fix and iterate until kitchen test completes without error

Continuing iteration on CI failures. Fixed Ubuntu platform naming in commit 2db715a.

Issue Found: Test Kitchen strips dots from platform names, so ubuntu-22.04 (in kitchen.dokken.yml) becomes ubuntu-2204 (in instance names). CI was using dotted format causing "no instances" errors.

Fix Applied: Updated CI to use ubuntu-2204 and ubuntu-2404 to match Test Kitchen instance naming convention.

Now monitoring CI run to identify any remaining issues.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

npm source install needs running tests

2 participants