diff options
author | GitLab Bot <gitlab-bot@gitlab.com> | 2021-09-08 12:09:10 +0300 |
---|---|---|
committer | GitLab Bot <gitlab-bot@gitlab.com> | 2021-09-08 12:09:10 +0300 |
commit | 5cd68a92fa0397121f25357ffae4a4bb6393ae72 (patch) | |
tree | 9a3a6e7bb60419a36dd71096974a4b4177a9ed05 /tooling | |
parent | 1758f49bb51884245d53fc6675f180cb522a4623 (diff) |
Add latest changes from gitlab-org/gitlab@master
Diffstat (limited to 'tooling')
-rwxr-xr-x | tooling/bin/find_changes | 21 | ||||
-rwxr-xr-x | tooling/bin/find_tests | 16 |
2 files changed, 23 insertions, 14 deletions
diff --git a/tooling/bin/find_changes b/tooling/bin/find_changes new file mode 100755 index 00000000000..466510ccb19 --- /dev/null +++ b/tooling/bin/find_changes @@ -0,0 +1,21 @@ +#!/usr/bin/env ruby +# frozen_string_literal: true + +require 'gitlab' + +gitlab_token = ENV.fetch('DANGER_GITLAB_API_TOKEN', '') +gitlab_endpoint = ENV.fetch('CI_API_V4_URL') +mr_project_path = ENV.fetch('CI_MERGE_REQUEST_PROJECT_PATH') +mr_iid = ENV.fetch('CI_MERGE_REQUEST_IID') + +output_file = ARGV.shift + +Gitlab.configure do |config| + config.endpoint = gitlab_endpoint + config.private_token = gitlab_token +end + +mr_changes = Gitlab.merge_request_changes(mr_project_path, mr_iid) +file_changes = mr_changes.changes.map { |change| change['new_path'] } + +File.write(output_file, file_changes.join(' ')) diff --git a/tooling/bin/find_tests b/tooling/bin/find_tests index 97fadf406fe..33834064f36 100755 --- a/tooling/bin/find_tests +++ b/tooling/bin/find_tests @@ -1,24 +1,12 @@ #!/usr/bin/env ruby # frozen_string_literal: true -require 'gitlab' require 'test_file_finder' -gitlab_token = ENV.fetch('DANGER_GITLAB_API_TOKEN', '') -gitlab_endpoint = ENV.fetch('CI_API_V4_URL') - -Gitlab.configure do |config| - config.endpoint = gitlab_endpoint - config.private_token = gitlab_token -end - +changes = ARGV.shift output_file = ARGV.shift -mr_project_path = ENV.fetch('CI_MERGE_REQUEST_PROJECT_PATH') -mr_iid = ENV.fetch('CI_MERGE_REQUEST_IID') - -mr_changes = Gitlab.merge_request_changes(mr_project_path, mr_iid) -changed_files = mr_changes.changes.map { |change| change['new_path'] } +changed_files = File.read(changes).split(' ') tff = TestFileFinder::FileFinder.new(paths: changed_files).tap do |file_finder| file_finder.use TestFileFinder::MappingStrategies::PatternMatching.load('tests.yml') |