Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions Dockerfile.updater
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,9 @@ bundle install
# executes the package manager outputs to every job log
COPY --chown=dependabot:dependabot updater/config/.yarnrc updater/config/.npmrc $DEPENDABOT_HOME/

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

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

# Add project
Expand Down
15 changes: 15 additions & 0 deletions npm_and_yarn/lib/dependabot/npm_and_yarn/helpers.rb
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,21 @@ def self.npm_version_numeric(lockfile_content)
def self.run_yarn_commands(*commands)
# We never want to execute postinstall scripts
SharedHelpers.run_shell_command("yarn config set enableScripts false")
if (http_proxy = ENV.fetch("HTTP_PROXY", false))
SharedHelpers.run_shell_command("yarn config set httpProxy #{http_proxy}")
end
if (https_proxy = ENV.fetch("HTTPS_PROXY", false))
SharedHelpers.run_shell_command("yarn config set httpsProxy #{https_proxy}")
end
if (ca_file_path = ENV.fetch("NODE_EXTRA_CA_CERTS", false))
output = SharedHelpers.run_shell_command("yarn --version")
major_version = Version.new(output).major
if major_version >= 4
SharedHelpers.run_shell_command("yarn config set httpsCaFilePath #{ca_file_path}")
else
SharedHelpers.run_shell_command("yarn config set caFilePath #{ca_file_path}")
end
end
commands.each { |cmd| SharedHelpers.run_shell_command(cmd) }
end
end
Expand Down