Skip to content

Commit

Permalink
Ignore yarn 2.4.3 (#627)
Browse files Browse the repository at this point in the history
After [#617](#617) was merged our inventory automation ran and the PR to update the `yarn` inventory with `2.4.3` ([#620](#620)) had failing tests that showed that the layout for this version did not match our other distributions.

This PR modifies the automation to ignore this version of `yarn` so that our mirroring jobs no longer report as failing and we will not get this distribution added to our inventory since it requires special handling in the buildpack to be usable.
  • Loading branch information
colincasey authored Aug 17, 2023
1 parent d2b2e4b commit 02ff87d
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 3 deletions.
4 changes: 2 additions & 2 deletions common/bin/download-verify-npm-package
Original file line number Diff line number Diff line change
Expand Up @@ -20,9 +20,9 @@ if [ -z "$package_version" ]; then
fi

if [ "yarn" = "${package_name}" ]; then
# Yarn 2+ (aka: "berry") is hosted under a different npm package (except for version 2.4.3).
# Yarn 2+ (aka: "berry") is hosted under a different npm package.
major_version=$(echo "$package_version" | cut -d "." -f 1)
package_name=$([ "$major_version" -ge 2 ] && [ "$package_version" != "2.4.3" ] && echo "@yarnpkg/cli-dist" || echo "yarn")
package_name=$([ "$major_version" -ge 2 ] && echo "@yarnpkg/cli-dist" || echo "yarn")
fi

npm_url="https://registry.npmjs.com/${package_name}/${package_version}"
Expand Down
19 changes: 18 additions & 1 deletion common/nodejs-utils/src/distribution.rs
Original file line number Diff line number Diff line change
Expand Up @@ -123,11 +123,28 @@ fn list_upstream_node_versions() -> anyhow::Result<VersionSet> {
.collect()
}

const IGNORE_YARN_VERSIONS: [&str; 1] = [
// This version is ignored because all of the current 2.x versions are published by the `@yarnpkg/cli-dist`
// module except for this one which is published by the `yarn` module. The layout of this package
// differs from what we expect so instead of coding in some edge case handling when we install this
// yarn version in the buildpack, we've decided to ignore it.
//
// There should be little user impact here because our Yarn inventory only controls the "global" binary
// that is installed which acts as a wrapper to the actual version of Yarn used when building.
// For Yarn 2+ projects, the actual Yarn version used is meant to be committed to the folder
// `.yarn/release` and the global binary delegates all operations to the committed version.
"2.4.3",
];

fn list_upstream_yarn_versions() -> anyhow::Result<VersionSet> {
let mut vset = VersionSet::new();
for pkg in ["yarn", "@yarnpkg/cli-dist"] {
for release in npmjs_org::list_releases(pkg)? {
vset.insert(release.version);
let ignore_release = pkg == "yarn"
&& IGNORE_YARN_VERSIONS.contains(&release.version.to_string().as_str());
if !ignore_release {
vset.insert(release.version);
}
}
}
Ok(vset)
Expand Down

0 comments on commit 02ff87d

Please sign in to comment.