Skip to content

Commit 7b23e93

Browse files
hsbtclaude
andcommitted
Point build log links at logs.rubyci.org
Log links were built from the server's registered URI, which for the chkbuild servers is a direct URL into the public rubyci S3 bucket. Route them through the Fastly service in front of the same bucket instead, so repeated access during triage is served from the edge. Object keys are unchanged, and the fetch and listing paths still talk to S3 directly. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
1 parent 56cc6cb commit 7b23e93

5 files changed

Lines changed: 41 additions & 6 deletions

File tree

app/models/report.rb

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -155,15 +155,15 @@ def branch_opts
155155
end
156156

157157
def loguri
158-
server.uri.chomp('/') + datetime.strftime("/#{depsuffixed_name}/log/%Y%m%dT%H%M%SZ.log.html.gz")
158+
server.log_base_uri + datetime.strftime("/#{depsuffixed_name}/log/%Y%m%dT%H%M%SZ.log.html.gz")
159159
end
160160

161161
def diffuri
162-
server.uri.chomp('/') + datetime.strftime("/#{depsuffixed_name}/log/%Y%m%dT%H%M%SZ.diff.html.gz")
162+
server.log_base_uri + datetime.strftime("/#{depsuffixed_name}/log/%Y%m%dT%H%M%SZ.diff.html.gz")
163163
end
164164

165165
def failuri
166-
meta&.[]('compressed_failhtml_relpath') ? "#{server.uri.chomp('/')}/#{depsuffixed_name}/#{meta['compressed_failhtml_relpath']}" : nil
166+
meta&.[]('compressed_failhtml_relpath') ? "#{server.log_base_uri}/#{depsuffixed_name}/#{meta['compressed_failhtml_relpath']}" : nil
167167
end
168168

169169
def recenturi

app/models/server.rb

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,9 @@ class Server < ApplicationRecord
55

66
RUBYCI_S3_HOST = 'rubyci.s3.amazonaws.com'
77
RUBYCI_S3_URI = %r{\Ahttps?://#{Regexp.escape(RUBYCI_S3_HOST)}/}
8+
# Fastly in front of the same bucket. Object keys are unchanged, so only the
9+
# host is swapped.
10+
RUBYCI_LOGS_URL = 'https://logs.rubyci.org'
811

912
# Most rows still carry the http:// form these URIs were first registered
1013
# with, so both schemes have to match. Keep the Ruby and SQL forms together
@@ -18,7 +21,13 @@ def rubyci_s3?
1821
RUBYCI_S3_URI.match?(uri.to_s)
1922
end
2023

24+
# Base for the log links shown to users. Bucket-backed servers go through the
25+
# CDN; every other server keeps the URI it was registered with.
26+
def log_base_uri
27+
uri.sub(RUBYCI_S3_URI, "#{RUBYCI_LOGS_URL}/").chomp('/')
28+
end
29+
2130
def recent_uri(branch)
22-
"#{uri.chomp('/')}/ruby-#{branch}/recent.html"
31+
"#{log_base_uri}/ruby-#{branch}/recent.html"
2332
end
2433
end

config/routes.rb

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,8 +19,8 @@
1919
end
2020
end
2121

22-
get "/coverage" => redirect("https://rubyci.s3.amazonaws.com/coverage-latest-html/index.html")
23-
get "/doxygen" => redirect("https://rubyci.s3.amazonaws.com/doxygen-latest-html/index.html")
22+
get "/coverage" => redirect("#{Server::RUBYCI_LOGS_URL}/coverage-latest-html/index.html")
23+
get "/doxygen" => redirect("#{Server::RUBYCI_LOGS_URL}/doxygen-latest-html/index.html")
2424

2525
#resources :logs, only: [:show], constraints: {id: /.*/}
2626
end

test/models/report_test.rb

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -63,6 +63,18 @@ def build_report(attrs = {})
6363
assert_equal SHA, report.sha1
6464
end
6565

66+
test "log links go through the CDN" do
67+
report = build_report(
68+
server: create_server("cdn-links"),
69+
datetime: Time.utc(2026, 1, 21, 18, 30, 3),
70+
ltsv: "depsuffixed_name:ruby-master\tcompressed_failhtml_relpath:log/20260121T183003Z.fail.html.gz",
71+
)
72+
assert_equal "https://logs.rubyci.org/cdn-links/ruby-master/log/20260121T183003Z.log.html.gz", report.loguri
73+
assert_equal "https://logs.rubyci.org/cdn-links/ruby-master/log/20260121T183003Z.diff.html.gz", report.diffuri
74+
assert_equal "https://logs.rubyci.org/cdn-links/ruby-master/log/20260121T183003Z.fail.html.gz", report.failuri
75+
assert_equal "https://logs.rubyci.org/cdn-links/ruby-master/recent.html", report.recenturi
76+
end
77+
6678
test "extract_full_sha" do
6779
assert_equal SHA, Report.extract_full_sha("https://github.com/ruby/ruby:#{SHA}")
6880
assert_equal SHA, Report.extract_full_sha(%["https\\x3A//github.com/ruby/ruby":#{SHA}])

test/models/server_test.rb

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,20 @@ def create_server(uri)
1818
assert_not create_server("http://ci.rvm.jp/chkbuild/logs/").rubyci_s3?
1919
end
2020

21+
test "log_base_uri points bucket-backed servers at the CDN" do
22+
assert_equal "https://logs.rubyci.org/ubuntu", create_server("https://rubyci.s3.amazonaws.com/ubuntu/").log_base_uri
23+
assert_equal "https://logs.rubyci.org/rhel9", create_server("http://rubyci.s3.amazonaws.com/rhel9").log_base_uri
24+
end
25+
26+
test "log_base_uri keeps other servers as registered" do
27+
assert_equal "http://ci.rvm.jp/chkbuild/logs", create_server("http://ci.rvm.jp/chkbuild/logs/").log_base_uri
28+
end
29+
30+
test "recent_uri uses the CDN host" do
31+
server = create_server("https://rubyci.s3.amazonaws.com/debian/")
32+
assert_equal "https://logs.rubyci.org/debian/ruby-master/recent.html", server.recent_uri("master")
33+
end
34+
2135
test "rubyci_s3 scope selects the same servers as rubyci_s3?" do
2236
servers = [
2337
create_server("https://rubyci.s3.amazonaws.com/scope-https/"),

0 commit comments

Comments
 (0)