summaryrefslogtreecommitdiff
path: root/lib/license/finder/ext
diff options
context:
space:
mode:
authorCan Eldem <celdem@gitlab.com>2020-07-23 11:01:47 +0000
committerCan Eldem <celdem@gitlab.com>2020-07-23 11:01:47 +0000
commit8ee0824204c0e97d97ad6d38778cd9e7e9da6813 (patch)
treed851d65d729ecdffd018c79c6f5d887a1e506bce /lib/license/finder/ext
parentca675527b53c2a8316c962ee1a17bc1ee1c0c156 (diff)
parentdfa59682cfe6cc3726c321236b1e0db5e965e722 (diff)
Merge branch 'offline-tests' into 'master'v3.19.2
Combine default/custom x509 certificates in TLS validation See merge request gitlab-org/security-products/license-management!194
Diffstat (limited to 'lib/license/finder/ext')
-rw-r--r--lib/license/finder/ext/bower.rb25
1 files changed, 18 insertions, 7 deletions
diff --git a/lib/license/finder/ext/bower.rb b/lib/license/finder/ext/bower.rb
index 2219b18..9b302f6 100644
--- a/lib/license/finder/ext/bower.rb
+++ b/lib/license/finder/ext/bower.rb
@@ -3,7 +3,15 @@
module LicenseFinder
class Bower < PackageManager
def prepare
- shell.execute([:bower, :install, '--allow-root'], env: default_env)
+ shell.execute([
+ :bower,
+ :install,
+ '--allow-root',
+ '--production',
+ '--verbose',
+ '--loglevel',
+ :debug
+ ], env: default_env)
end
def current_packages
@@ -18,7 +26,7 @@ module LicenseFinder
def bower_output
stdout, _stderr, status = Dir.chdir(project_path) do
- shell.execute([:bower, :list, '--json', '-l', 'action', '--allow-root'])
+ shell.execute([:bower, :list, '--json', '-l', 'action', '--allow-root'], env: default_env)
end
return {} unless status.success?
@@ -48,12 +56,15 @@ module LicenseFinder
end
def default_env
- return {} unless shell.custom_certificate_installed?
-
- {
- 'NPM_CONFIG_CAFILE' => ENV.fetch('NPM_CONFIG_CAFILE', shell.custom_certificate_path.to_s),
- 'bower_ca' => ENV.fetch('bower_ca', shell.custom_certificate_path.to_s)
+ @default_env ||= {
+ 'NPM_CONFIG_CAFILE' => ENV.fetch('NPM_CONFIG_CAFILE', shell.default_certificate_path).to_s,
+ 'bower_ca' => ENV.fetch('bower_ca', shell.default_certificate_path).to_s,
+ 'bower_directory' => ENV.fetch('bower_directory', vendor_path.join('bower_components')).to_s
}
end
+
+ def vendor_path
+ Pathname.pwd.join('.gitlab', 'cache', 'vendor')
+ end
end
end