@@ -45,6 +45,7 @@ def run
4545 Dir . chdir base_dir if base_dir
4646 load_deps
4747 load_env
48+ log_identity
4849 start_report
4950 @success = false
5051 perform_release
@@ -65,7 +66,10 @@ def load_deps
6566end
6667
6768def load_env
68- raise "Did not find KOKORO_GFILE_DIR" unless ENV [ "KOKORO_GFILE_DIR" ]
69+ unless ENV [ "KOKORO_GFILE_DIR" ]
70+ logger . warn "Did not find KOKORO_GFILE_DIR. Skipping load of kokoro-hosted secrets."
71+ return
72+ end
6973 secret_manager_dir = File . join ENV [ "KOKORO_GFILE_DIR" ] , "secret_manager"
7074 keystore_dir = ENV [ "KOKORO_KEYSTORE_DIR" ]
7175 logger . warn "Did not find KOKORO_KEYSTORE_DIR" unless keystore_dir
@@ -109,6 +113,26 @@ def load_param param_name, dir, file_name, from: :content
109113 end
110114end
111115
116+ def log_identity
117+ if ENV [ "RUBY_COMMON_TOOLS" ]
118+ logger . info "Loaded release scripts from local file system"
119+ else
120+ logger . info "Loaded release scripts from git cache"
121+ end
122+ repo_dir = File . dirname __dir__ , 2
123+ if File . directory? "#{ repo_dir } /.git"
124+ commit = capture [ "git" , "rev-parse" , "HEAD" ] , chdir : repo_dir
125+ logger . info "Git clone commit for release scripts: #{ commit . strip } "
126+ else
127+ commit = File . basename repo_dir
128+ if commit =~ /^[0-9a-f]{40}$/
129+ logger . info "Git cache commit for release scripts: #{ commit } "
130+ else
131+ logger . warn "Unable to determine the commit for release scripts"
132+ end
133+ end
134+ end
135+
112136def acquire_reporter_token
113137 return unless reporter_app && reporter_installation && reporter_pem
114138 logger . info "Acquiring pull request reporter token from GitHub..."
@@ -499,12 +523,13 @@ def upload_docs_archive archive_path:, staging_bucket:, dest_prefix:
499523
500524 def run_aux_task task_name , remove : [ ]
501525 Array ( remove ) . each { |path | FileUtils . rm_rf path }
502- if File . file? "Rakefile"
526+ result = @executor . exec [ "toys" , "system" , "tools" , "show" , task_name ] , result_callback : nil , out : :null
527+ if result . success?
528+ @executor . exec [ "toys" , task_name ]
529+ else
503530 isolate_bundle do
504531 @executor . exec [ "bundle" , "exec" , "rake" , task_name ]
505532 end
506- else
507- @executor . exec [ "toys" , task_name ]
508533 end
509534 end
510535
@@ -527,7 +552,7 @@ def gem_version
527552 puts spec . version
528553 end
529554 end
530- value = @executor . capture_proc ( func ) . strip
555+ value = @executor . capture_proc ( func , log_cmd : "exec proc: load #{ gem_name } .gemspec" ) . strip
531556 logger . info "Specification gem version = #{ value } "
532557 Gem ::Version . new value
533558 end
0 commit comments