Skip to content

Commit 991c90d

Browse files
committed
Set yanrs CA file path config based on yarn version
1 parent 7986ff1 commit 991c90d

File tree

2 files changed

+9
-1
lines changed

2 files changed

+9
-1
lines changed

Dockerfile.updater

-1
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,6 @@ bundle install
4747
COPY --chown=dependabot:dependabot updater/config/.yarnrc updater/config/.npmrc $DEPENDABOT_HOME/
4848

4949
# For Yarn Berry we can set this via an environment variable
50-
ENV YARN_HTTPS_CA_FILE_PATH=/etc/ssl/certs/ca-certificates.crt
5150
ENV NODE_EXTRA_CA_CERTS=/etc/ssl/certs/ca-certificates.crt
5251

5352
# END: HACKY WORKAROUND FOR NPM GIT INSTALLS SPAWNING CHILD PROCESS

npm_and_yarn/lib/dependabot/npm_and_yarn/helpers.rb

+9
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,15 @@ def self.run_yarn_commands(*commands)
2929
if (https_proxy = ENV.fetch("HTTPS_PROXY", false))
3030
SharedHelpers.run_shell_command("yarn config set httpsProxy #{https_proxy}")
3131
end
32+
if (ca_file_path = ENV.fetch("NODE_EXTRA_CA_CERTS", false))
33+
output = SharedHelpers.run_shell_command("yarn --version")
34+
major_version = Version.new(output).major
35+
if major_version >= 4
36+
SharedHelpers.run_shell_command("yarn config set httpsCaFilePath #{ca_file_path}")
37+
else
38+
SharedHelpers.run_shell_command("yarn config set caFilePath #{ca_file_path}")
39+
end
40+
end
3241
commands.each { |cmd| SharedHelpers.run_shell_command(cmd) }
3342
end
3443
end

0 commit comments

Comments
 (0)