From d54bf230aad2da8d371235d7a1c764288f31c02f Mon Sep 17 00:00:00 2001 From: Adam Grare Date: Fri, 26 Aug 2022 10:38:44 -0400 Subject: [PATCH 1/2] Pass GHA default environment variables --- lib/manageiq/cross_repo/runner/github.rb | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/lib/manageiq/cross_repo/runner/github.rb b/lib/manageiq/cross_repo/runner/github.rb index 70b4639..9bab3d8 100644 --- a/lib/manageiq/cross_repo/runner/github.rb +++ b/lib/manageiq/cross_repo/runner/github.rb @@ -13,6 +13,17 @@ def self.available? private + def env_vars + super.merge( + "CI" => "true", + "GITHUB_BASE_REF" => nil, # TODO: test_repo.base_ref, + "GITHUB_REF_NAME" => test_repo.ref || test_repo.sha, + "GITHUB_REPOSITORY" => test_repo.identifier, + "GITHUB_REPOSITORY_OWNER" => test_repo.org, + "GITHUB_SERVER_URL" => "https://github.com" + ) + end + def ci_config github_config = YAML.load_file(CONFIG_FILE) From 346bf1bbee49a8afc37e56dcdcbf29bf1ec3afed Mon Sep 17 00:00:00 2001 From: Adam Grare Date: Fri, 26 Aug 2022 12:30:19 -0400 Subject: [PATCH 2/2] WIP: test oparin base_ref --- lib/manageiq/cross_repo/runner.rb | 15 ++++++++++++++- lib/manageiq/cross_repo/runner/github.rb | 11 ----------- 2 files changed, 14 insertions(+), 12 deletions(-) diff --git a/lib/manageiq/cross_repo/runner.rb b/lib/manageiq/cross_repo/runner.rb index 61632fd..c210fd9 100644 --- a/lib/manageiq/cross_repo/runner.rb +++ b/lib/manageiq/cross_repo/runner.rb @@ -57,7 +57,17 @@ def run_tests end def env_vars - {"MANAGEIQ_REPO" => core_repo.path.to_s, "BUNDLE_PATH" => bundle_path.to_s, "TEST_SUITE" => test_suite} + { + "MANAGEIQ_REPO" => core_repo.path.to_s, + "BUNDLE_PATH" => bundle_path.to_s, + "TEST_SUITE" => test_suite, + "CI" => "true", + "GITHUB_BASE_REF" => "oparin", # TODO: test_repo.base_ref, + "GITHUB_REF_NAME" => test_repo.ref || test_repo.sha, + "GITHUB_REPOSITORY" => test_repo.identifier, + "GITHUB_REPOSITORY_OWNER" => test_repo.org, + "GITHUB_SERVER_URL" => "https://github.com" + } end def with_test_env @@ -113,6 +123,9 @@ def run_test_script(test_script) w.write(test_script) w.close + puts "** AG: #{env_vars.inspect}" + puts "** AG: #{test_script.inspect}" + system!(env_vars, "/bin/bash -s", :in => r, :out => $stdout, :err => $stderr) end end diff --git a/lib/manageiq/cross_repo/runner/github.rb b/lib/manageiq/cross_repo/runner/github.rb index 9bab3d8..70b4639 100644 --- a/lib/manageiq/cross_repo/runner/github.rb +++ b/lib/manageiq/cross_repo/runner/github.rb @@ -13,17 +13,6 @@ def self.available? private - def env_vars - super.merge( - "CI" => "true", - "GITHUB_BASE_REF" => nil, # TODO: test_repo.base_ref, - "GITHUB_REF_NAME" => test_repo.ref || test_repo.sha, - "GITHUB_REPOSITORY" => test_repo.identifier, - "GITHUB_REPOSITORY_OWNER" => test_repo.org, - "GITHUB_SERVER_URL" => "https://github.com" - ) - end - def ci_config github_config = YAML.load_file(CONFIG_FILE)