-
Notifications
You must be signed in to change notification settings - Fork 173
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Fallbacks to npm when COREPACK_NPM_REGISTRY is set #339
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Note that means that corepack use yarn@latest
will now work, but only when COREPACK_NPM_REGISTRY
is set 😅
I'm starting to desentangle that in #340, although I'll also need to tweak |
I feel like I'm missing something here: USER root
...
ARG NODEJS_VERSION='18.19.0'
ENV PATH "/opt/node/bin:$PATH"
RUN mkdir -p /opt/node \
&& tar -xzf /installers/node-v${NODEJS_VERSION}-linux-x64.tar.gz --directory=/opt/node --strip-components=1 --no-same-owner
USER jenkins
# Configure npm & install+configure Yarn.
ARG YARN_VERSION='4.1.0'
ARG NPM_REGISTRY_URL='https://nexus.corp.internal/repository/npmjs-proxy/'
ENV COREPACK_NPM_REGISTRY $NPM_REGISTRY_URL
ENV NPM_CONFIG_PREFIX ${HOME}/.npm-global
ENV PATH ${NPM_CONFIG_PREFIX}/bin:$PATH
RUN npm config set registry $NPM_REGISTRY_URL \
# Node 18.19.0 ships with corepack 0.22.0, but we need corepack 0.24.0+
&& npm install --global corepack@latest \
&& corepack enable \
&& corepack --version \
&& corepack install --global yarn@${YARN_VERSION} \
&& yarn config set --home npmRegistryServer $NPM_REGISTRY_URL Results in:
@arcanis I'm not sure why corepack is still trying to connect to |
@PayBas did you ever find out why this was happening? |
It's been mentioned a couple of times that Yarn publishing its versions on its own was inconvenient for people using private npm mirrors. I'd prefer to keep using our store by default, but it makes sense to offer a way to fallback to the npm store when requested. This diff changes the logic so that we use the
@yarnpkg/cli-dist
package when theCOREPACK_NPM_REGISTRY
variable is set. It should be backward-compatible, since theregistry
field is still the same.Fixes #337