yarnpkg / berry

📦🐈 Active development trunk for Yarn ⚒
https://yarnpkg.com
BSD 2-Clause "Simplified" License
7.39k stars 1.11k forks source link

[Bug?]: yarn set version berry ignores YARN_RC_FILENAME #3312

Closed ThePlenkov closed 3 years ago

ThePlenkov commented 3 years ago

Self-service

Describe the bug

Hi! I try to build node container using yarn berry .

So here are several issues:

So what i did I've created yarnrc.yml file and build container with --build-arg YARN_RC_FILENAME=yarnrc.yml

However when I run a command RUN yarn set version berry it still updates .yarnrc.yml.

Here is the log proving this.

 [ 3/13] COPY package.json yarnrc.yml ./
#7 sha256:cb43eb160c863a02fff87217c52462c3da1337a32b8433c734d8eb6e91009598
#7 DONE 0.3s

#8 [ 4/13] RUN env
#8 sha256:03a75127caa9c6e9290f506b64dd6aff32d432f015196220d06111ef04688e25
#8 0.879 NODE_VERSION=14.17.5
#8 0.879 LC_ALL=en_US.UTF-8#
#8 0.879 PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin
#8 0.879 PWD=/app/server
#8 0.879 LANG=en_US.UTF-8
#8 0.879 TZ=:/etc/localtime
#8 0.879 NODE_MAJOR=14
#8 0.879 SHLVL=1
#8 0.879 HOME=/root
#8 0.879 YARN_RC_FILENAME=yarnrc.yml
#8 0.879 _=/usr/bin/env
#8 DONE 0.9s

#9 [ 5/13] RUN touch .yarnrc.yml
#9 sha256:ae26255deec133e5e89dbbe3da2bf4c8171128fe47ed4d35c143e350d4f43508
#9 DONE 1.0s

#10 [ 6/13] RUN yarn set version berry
#10 sha256:635bd2f7276f66333a616c57cd3401779079e34464c90fa53e0404b6884a5443
#10 1.059 Resolving berry to a url...
#10 1.061 Downloading https://github.com/yarnpkg/berry/raw/master/packages/berry-cli/bin/berry.js...
#10 2.379 Saving it into /app/server/.yarn/releases/yarn-berry.cjs...
#10 2.392 Updating /app/server/.yarnrc.yml...
#10 2.393 Done!
#10 DONE 2.5s

#11 [ 7/13] RUN ls .
#11 sha256:c5ffcd6da4a597f7ab6ee689755fbde37b907121917d0c2450e5d75a9d852e33
#11 0.595 package.json
#11 0.595 yarnrc.yml
#11 DONE 0.6s

#12 [ 8/13] RUN cat yarnrc.yml
#12 sha256:9595c8180457a9266e7a74e63add6ab4691fb3b0b71929dc8376a4766bbde112
#12 0.437 httpProxy: $HTTP_PROXY
#12 0.437 httspProxy: $HTTP_PROXY
#12 0.437 enableStrictSsl: false
#12 0.437 logFilters:
#12 0.437   - code: YN0013
#12 0.437     level: discard#12 DONE 0.5s

#13 [ 9/13] RUN cat .yarnrc.yml
#13 sha256:233df561d506e3dba0c1856fe7242ecbd9387b4a81ccd1573d09e43b22f08a2a
#13 4.142 yarnPath: ".yarn/releases/yarn-berry.cjs"
#13 DONE 4.5s

Right now the workaround is to rename yarnrc.yml into .yarnrc.yml but is really strange if this framework brings this requirement for all containers. Please invent something.

The best thing is to support by default yarnrc.yml without . to my vision. Thanks!

To reproduce

RUN yarn set version berry inside your container and then try to read config.

Environment

docker

Additional context

No response

merceyz commented 3 years ago

By default dot-files are ignored by docker which means we cannot copy .yarnrc.yml into container using copy directive.

That seems odd, I have several dockerfiles where I do just that

ThePlenkov commented 3 years ago

@merceyz I wonder to know how it works for you.

Actually I even tried like that: 1) COPY yarnrc.yml . 2) RUN cat yarnrc.ym -> it's there 3) RUN mv yarnrc.yml .yarnrc.yml 4) cat .yarnrc.yml -> file not found

There is even a statement in the official docker file reference about this: https://docs.docker.com/engine/reference/builder/#dockerignore-file image

yarnbot commented 3 years ago

Hi! 👋

This issue looks stale, and doesn't feature the reproducible label - which implies that you didn't provide a working reproduction using Sherlock. As a result, it'll be closed in a few days unless a maintainer explicitly vouches for it or you edit your first post to include a formal reproduction (you can use the playground for that).

Note that we require Sherlock reproductions for long-lived issues (rather than standalone git repositories or similar) because we're a small team. Sherlock gives us the ability to check which bugs are still affecting the master branch at any given point, and decreases the amount of code we need to run on our own machines (thus leading to faster bug resolutions). It helps us help you! 😃

If you absolutely cannot reproduce a bug on Sherlock (for example because it's a Windows-only issue), a maintainer will have to manually add the upholded label. Thanks for helping us triaging our repository! 🌟