summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authormo khan <mo.khan@gmail.com>2020-09-10 19:31:53 +0000
committermo khan <mo.khan@gmail.com>2020-09-10 19:31:53 +0000
commitaa44fb0d5ca05da6780869fb187985a4600cb969 (patch)
tree850ca482ea48dca003c7c4d582376ec5618d5520
parentd4da2eff19bd210d18b0dbb80aa305c6a955a644 (diff)
parentf4edc9a8e9c0a94056ecb80ec6333dfa42857a14 (diff)
Merge branch 'fix-go-patch-install-dir' into 'master'v3.25.4
Use golang_version as install directory for Go See merge request gitlab-org/security-products/license-management!217
-rw-r--r--.gitlab/test.yml11
-rw-r--r--CHANGELOG.md4
-rw-r--r--Gemfile.lock2
-rw-r--r--config/projects/golang.rb3
-rw-r--r--lib/license/finder/ext/gradle.rb14
-rw-r--r--lib/license/management/shell.rb1
-rw-r--r--lib/license/management/version.rb2
-rw-r--r--spec/integration/go/modules_spec.rb2
-rw-r--r--spec/integration/ruby/bundler_spec.rb13
9 files changed, 24 insertions, 28 deletions
diff --git a/.gitlab/test.yml b/.gitlab/test.yml
index 1dbc2c9..e44a90d 100644
--- a/.gitlab/test.yml
+++ b/.gitlab/test.yml
@@ -73,10 +73,17 @@ integration-go:
RSPEC_DIR: spec/integration/go
needs: ['build-docker-image']
-integration-java:
+integration-java-gradle:
extends: .rspec
variables:
- RSPEC_DIR: spec/integration/java
+ RSPEC_DIR: spec/integration/java/gradle_spec.rb
+ needs:
+ - build-docker-image
+
+integration-java-maven:
+ extends: .rspec
+ variables:
+ RSPEC_DIR: spec/integration/java/maven_spec.rb
needs:
- build-docker-image
- build-mvn-pkg
diff --git a/CHANGELOG.md b/CHANGELOG.md
index 0344a7a..b0940c0 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -1,5 +1,9 @@
# GitLab License management changelog
+## v3.25.4
+
+- Fix patch number of `GOLANG_VERSION` being ignored, making the scan fail if there's no match for MAJOR.MINOR (!215)
+
## v3.25.3
- Ensure `apt-get` db is valid for `before_script` blocks. (!215)
diff --git a/Gemfile.lock b/Gemfile.lock
index 6b0909c..1088739 100644
--- a/Gemfile.lock
+++ b/Gemfile.lock
@@ -8,7 +8,7 @@ GIT
PATH
remote: .
specs:
- license-management (3.25.3)
+ license-management (3.25.4)
license_finder (~> 6.7)
GEM
diff --git a/config/projects/golang.rb b/config/projects/golang.rb
index 0a53092..cb21ae8 100644
--- a/config/projects/golang.rb
+++ b/config/projects/golang.rb
@@ -6,8 +6,7 @@ name "golang-#{golang_version}"
maintainer "GitLab B.V."
homepage "https://golang.org/"
-major, minor, _patch = golang_version.split('.')
-install_dir "/opt/asdf/installs/golang/#{major}.#{minor}/go"
+install_dir "/opt/asdf/installs/golang/#{golang_version}/go"
package_scripts_path Pathname.pwd.join("config/scripts/golang")
build_version golang_version
diff --git a/lib/license/finder/ext/gradle.rb b/lib/license/finder/ext/gradle.rb
index 4d6b000..a683207 100644
--- a/lib/license/finder/ext/gradle.rb
+++ b/lib/license/finder/ext/gradle.rb
@@ -18,7 +18,7 @@ module LicenseFinder
end
def package_management_command
- wrapper? ? './gradlew' : 'gradle'
+ wrapper? ? './gradlew' : :gradle
end
private
@@ -29,22 +29,18 @@ module LicenseFinder
def download_licenses
_stdout, _stderr, status = within_project_path do
- env = {
- 'JAVA_HOME' => ENV.fetch("JAVA_HOME", "/opt/asdf/installs/java/#{java_version}"),
- 'TERM' => 'noop'
- }
shell.execute([
@command,
ENV.fetch('GRADLE_CLI_OPTS', '--exclude-task=test --no-daemon --debug'),
'downloadLicenses'
- ], env: env)
+ ], env: default_env)
end
status.success?
end
def wrapper?
- File.exist?(File.join(project_path, 'gradlew'))
+ project_path.join('gradlew').exist?
end
def xml_parsing_options
@@ -63,8 +59,10 @@ module LicenseFinder
def default_env
@default_env = {
+ 'ASDF_JAVA_VERSION' => ENV.fetch('ASDF_JAVA_VERSION', java_version),
'CACHE_DIR' => '/opt/gitlab',
- 'JAVA_HOME' => ENV.fetch("JAVA_HOME", "/opt/asdf/installs/java/#{java_version}")
+ 'JAVA_HOME' => ENV.fetch("JAVA_HOME", "/opt/asdf/installs/java/#{java_version}"),
+ 'TERM' => 'noop'
}
end
end
diff --git a/lib/license/management/shell.rb b/lib/license/management/shell.rb
index b066bc1..e4fd35a 100644
--- a/lib/license/management/shell.rb
+++ b/lib/license/management/shell.rb
@@ -10,6 +10,7 @@ module License
cargo: '/opt/asdf/bin/asdf exec cargo',
cert_sync: '/opt/asdf/installs/mono/6.8.0.123/bin/cert-sync',
embedded_bundle: '/opt/gitlab/embedded/bin/bundle',
+ gradle: '/opt/asdf/bin/asdf exec gradle',
gem: '/opt/asdf/bin/asdf exec gem',
go: '/opt/asdf/bin/asdf exec go',
keytool: '/opt/asdf/bin/asdf exec keytool',
diff --git a/lib/license/management/version.rb b/lib/license/management/version.rb
index f99a3b6..f1203fc 100644
--- a/lib/license/management/version.rb
+++ b/lib/license/management/version.rb
@@ -2,6 +2,6 @@
module License
module Management
- VERSION = '3.25.3'
+ VERSION = '3.25.4'
end
end
diff --git a/spec/integration/go/modules_spec.rb b/spec/integration/go/modules_spec.rb
index 6486096..2048bdb 100644
--- a/spec/integration/go/modules_spec.rb
+++ b/spec/integration/go/modules_spec.rb
@@ -15,7 +15,7 @@ RSpec.describe "modules" do
include_examples "each report version", "go", "modules"
- ['1.11', '1.12', '1.13', '1.14', '1.15'].each do |version|
+ ['1.11', '1.12', '1.13', '1.14', '1.15', '1.15.1'].each do |version|
context "when scanning a go.mod and go.sum files with v#{version}" do
before do
runner.add_file('main.go', fixture_file_content('go/main.go'))
diff --git a/spec/integration/ruby/bundler_spec.rb b/spec/integration/ruby/bundler_spec.rb
index 1c0e472..5d18b12 100644
--- a/spec/integration/ruby/bundler_spec.rb
+++ b/spec/integration/ruby/bundler_spec.rb
@@ -93,19 +93,6 @@ RSpec.describe "bundler" do
end
end
- context "when scanning the `gitlab-runner` project" do
- before do
- runner.clone('https://gitlab.com/gitlab-org/gitlab-runner.git')
- end
-
- specify do
- expect(subject).to match_schema
- expect(subject[:licenses]).not_to be_empty
- expect(subject[:dependencies]).not_to be_empty
- expect(subject.dependency_names).to include('gitlab.com/gitlab-org/gitlab-terminal')
- end
- end
-
context "when fetching dependencies from a custom registry" do
before do
add_host('rubygems.test', '127.0.0.1')