Skip to content

Commit

Permalink
Add site.release_info to Jekyll, retire config in _config_base.yml
Browse files Browse the repository at this point in the history
Fixes DOC-8924
  • Loading branch information
Nick Vigilante authored and nickvigilante committed Sep 28, 2023
1 parent b493faa commit 5983f0b
Show file tree
Hide file tree
Showing 33 changed files with 103 additions and 148 deletions.
95 changes: 0 additions & 95 deletions src/current/_config_base.yml
Original file line number Diff line number Diff line change
Expand Up @@ -70,101 +70,6 @@ plugins:
- jekyll-last-modified-at
- jekyll-minifier
- jekyll-get-json
release_info:
v1.0:
build_time: 2018/02/13 15:13:51 (go1.8.3)
docker_image: cockroachdb/cockroach
name: v1.0.7
start_time: 2017-02-13 13:33:22.046027038 -0400 EDT
version: v1.0.7
v1.1:
build_time: 2018/10/01 14:48:26 (go1.8.3)
docker_image: cockroachdb/cockroach
name: v1.1.9
start_time: 2018-10-01 15:10:52.34274101 +0000 UTC
version: v1.1.9
v19.1:
build_time: 2020/07/07 14:48:26 (go1.11.6)
crdb_branch_name: release-19.1
docker_image: cockroachdb/cockroach
name: v19.1.11
start_time: 2020-07-07 15:10:52.34274101 +0000 UTC
version: v19.1.11
v19.2:
build_time: 2021/01/19 11:00:26 (go1.12.12)
crdb_branch_name: release-19.2
docker_image: cockroachdb/cockroach
name: v19.2.12
start_time: 2021-01-19 11:01:26.34274101 +0000 UTC
version: v19.2.12
v2.0:
build_time: 2018/12/10 14:48:26 (go1.10)
docker_image: cockroachdb/cockroach
name: v2.0.7
start_time: 2018-12-10 15:10:52.34274101 +0000 UTC
version: v2.0.7
v2.1:
build_time: 2019/01/29 14:48:26 (go1.10.3)
docker_image: cockroachdb/cockroach
name: v2.1.11
start_time: 2019-01-29 15:10:52.34274101 +0000 UTC
version: v2.1.11
v20.1:
build_time: 2021/05/17 11:00:26 (go1.13.4)
crdb_branch_name: release-20.1
docker_image: cockroachdb/cockroach
name: v20.1.17
start_time: 2021-05-17 11:01:26.34274101 +0000 UTC
version: v20.1.17
v20.2:
build_time: 2022/02/09 11:00:26 (go1.13.4)
crdb_branch_name: release-20.2
docker_image: cockroachdb/cockroach
name: v20.2.19
start_time: 2022-02-09 11:01:26.34274101 +0000 UTC
version: v20.2.19
v21.1:
build_time: 2022-09-15 00:00:00 (go1.17)
crdb_branch_name: release-21.1
docker_image: cockroachdb/cockroach
name: v21.1.21
start_time: 2022-09-14 12:48:52.570761 +0000 UTC
version: v21.1.21
v21.2:
build_time: 2022-10-17 00:00:00 (go1.18)
crdb_branch_name: release-21.2
docker_image: cockroachdb/cockroach
name: v21.2.17
start_time: 2022-10-13 17:45:03.909127 +0000 UTC
version: v21.2.17
v22.1:
build_time: 2023-08-14 00:00:00 (go1.19)
crdb_branch_name: release-22.1
docker_image: cockroachdb/cockroach
name: v22.1.22
start_time: 2023-08-11 12:11:37.108514 +0000 UTC
version: v22.1.22
v22.2:
build_time: 2023-09-11 00:00:00 (go1.19)
crdb_branch_name: release-22.2
docker_image: cockroachdb/cockroach
name: v22.2.14
start_time: 2023-09-07 15:02:10.181670 +0000 UTC
version: v22.2.14
v23.1:
build_time: 2023-09-18 00:00:00 (go1.20)
crdb_branch_name: release-23.1
docker_image: cockroachdb/cockroach
name: v23.1.10
start_time: 2023-09-18 11:34:06.638434 +0000 UTC
version: v23.1.10
v23.2:
build_time: 2023-09-23 00:00:00 (go1.20)
crdb_branch_name: master
docker_image: cockroachdb/cockroach-unstable
name: v23.2.0-alpha1
start_time: 2023-09-14 15:11:55.322342 +0000 UTC
version: v23.2.0-alpha1
sass:
quiet_deps: 'true'
sass_dir: css
Expand Down
30 changes: 15 additions & 15 deletions src/current/_data/versions.csv
Original file line number Diff line number Diff line change
@@ -1,15 +1,15 @@
major_version,release_date,maint_supp_exp_date,asst_supp_exp_date,previous_version
v1.0,2017-05-10,2018-05-10,2018-11-10,N/A
v1.1,2017-10-12,2018-10-12,2019-04-12,v1.0
v2.0,2018-04-04,2019-04-04,2019-10-04,v1.1
v2.1,2018-10-30,2019-10-30,2020-04-30,v2.0
v19.1,2019-04-30,2020-04-30,2020-10-30,v2.1
v19.2,2019-11-12,2020-11-12,2021-05-12,v19.1
v20.1,2020-05-12,2021-05-12,2021-11-12,v19.2
v20.2,2020-11-10,2021-11-10,2022-05-10,v20.1
v21.1,2021-05-18,2022-05-18,2022-11-18,v20.2
v21.2,2021-11-16,2022-11-16,2023-05-16,v21.1
v22.1,2022-05-24,2023-05-24,2023-11-24,v21.2
v22.2,2022-12-05,2023-12-05,2024-06-05,v22.1
v23.1,2023-05-15,2024-05-15,2024-11-15,v22.2
v23.2,N/A,N/A,N/A,v23.1
major_version,release_date,maint_supp_exp_date,asst_supp_exp_date,previous_version,crdb_branch_name
v1.0,2017-05-10,2018-05-10,2018-11-10,N/A,release-1.0
v1.1,2017-10-12,2018-10-12,2019-04-12,v1.0,release-1.1
v2.0,2018-04-04,2019-04-04,2019-10-04,v1.1,release-2.0
v2.1,2018-10-30,2019-10-30,2020-04-30,v2.0,release-2.1
v19.1,2019-04-30,2020-04-30,2020-10-30,v2.1,release-19.1
v19.2,2019-11-12,2020-11-12,2021-05-12,v19.1,release-19.2
v20.1,2020-05-12,2021-05-12,2021-11-12,v19.2,release-20.1
v20.2,2020-11-10,2021-11-10,2022-05-10,v20.1,release-20.2
v21.1,2021-05-18,2022-05-18,2022-11-18,v20.2,release-21.1
v21.2,2021-11-16,2022-11-16,2023-05-16,v21.1,release-21.2
v22.1,2022-05-24,2023-05-24,2023-11-24,v21.2,release-22.1
v22.2,2022-12-05,2023-12-05,2024-06-05,v22.1,release-22.2
v23.1,2023-05-15,2024-05-15,2024-11-15,v22.2,release-23.1
v23.2,N/A,N/A,N/A,v23.1,master
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,7 @@ We've used `roachnet` as the network name here and in subsequent steps, but feel
The output will look something like this:
~~~
CockroachDB node starting at {{page.release_info.start_time}}
CockroachDB node starting at {{ now | date: "%Y-%m-%d %H:%M:%S.%6 +0000 UTC" }}
build: CCL {{page.release_info.version}} @ {{page.release_info.build_time}} (go1.12.6)
webui: http://roach1:8080
sql: postgresql://root@roach1:26257?sslmode=disable
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,7 @@ We've used `roachnet` as the network name here and in subsequent steps, but feel
The output will look something like this:
~~~
CockroachDB node starting at {{page.release_info.start_time}}
CockroachDB node starting at {{ now | date: "%Y-%m-%d %H:%M:%S.%6 +0000 UTC" }}
build: CCL {{page.release_info.version}} @ {{page.release_info.build_time}} (go1.12.6)
webui: http://roach1:8080
sql: postgresql://root@roach1:26257?sslmode=disable
Expand Down
1 change: 1 addition & 0 deletions src/current/_plugins/versions.rb
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@
require_relative 'versions/version'
require_relative 'versions/versioned_page'
require_relative 'versions/generator'
require_relative 'versions/release_info'

# Silence annoying "directory is already being watched" warning due to harmless
# symlink usage.
Expand Down
12 changes: 7 additions & 5 deletions src/current/_plugins/versions/config.rb
Original file line number Diff line number Diff line change
Expand Up @@ -2,16 +2,18 @@ module JekyllVersions
class Config
attr_reader :versions, :release_info, :cockroachcloud

def initialize(config)
['versions', 'release_info'].each do |key|
def initialize(config, site)
all_versions = site.config['release_info']&.keys || []

['versions'].each do |key|
raise "Config missing `#{key}` key" if config[key].nil?
end
raise "Config missing `versions.stable` key" if config['versions']['stable'].nil?
config['versions'].each do |_, v|
raise "Config missing `release_info.#{v}` key" if config['release_info'][v].nil?
all_versions.each do |version|
raise "Config missing `release_info.#{version}` key" if site.config['release_info'][version].nil?
end
@versions = config['versions']
@release_info = config['release_info']
@release_info = site.config['release_info']
@cockroachcloud = !!config['cockroachcloud']
end

Expand Down
3 changes: 2 additions & 1 deletion src/current/_plugins/versions/generator.rb
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,11 @@ class JekyllGenerator < Jekyll::Generator
priority :lowest

def initialize(config)
@config = Config.new(config)
@jekyll_config = config
end

def generate(site)
@config = Config.new(@jekyll_config, site)
Generator.new(@config, site).generate
end
end
Expand Down
46 changes: 46 additions & 0 deletions src/current/_plugins/versions/release_info.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
require 'csv'
require 'yaml'

module Jekyll
class ReleaseInfoGenerator < Jekyll::Generator
safe true
priority -100 # Making sure it runs first

def generate(site)
# Step 1: Determine the parent directory of the current site
parent_dir = File.expand_path('..', site.source)

# Step 2: Construct the paths to versions.csv and releases.yml
versions_path = File.join(parent_dir, "current/_data/versions.csv")
releases_path = File.join(parent_dir, "current/_data/releases.yml")

# Load versions and releases data
versions_data = CSV.read(versions_path, headers: true)
releases_data = YAML.load_file(releases_path)

# Process the data
release_info = {}
versions_data.each do |version|
major_version = version['major_version']
relevant_releases = releases_data.select { |release| release['major_version'] == major_version }
latest_release = relevant_releases.max_by { |release| Date.parse(release['release_date']) }

# Populate release info
release_info[major_version] = {
"version" => latest_release['release_name'],
"release_name" => latest_release['release_name'],
"major_version" => major_version,
"build_time" => "#{latest_release['release_date']} 00:00:00",
"go_version" => latest_release['go_version'],
"docker_image" => latest_release['docker']['docker_image'],
"release_type" => latest_release['release_type'],
"crdb_branch_name" => version['crdb_branch_name'],
"all_releases" => relevant_releases
}
end

# Add the data to site object
site.config['release_info'] = release_info
end
end
end
2 changes: 1 addition & 1 deletion src/current/_plugins/versions/version.rb
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ def initialize(config, v)
end

def name
if @config.release_info[version] && (name = @config.release_info[version]['name'])
if @config.release_info[version] && (name = @config.release_info[version]['release_name'])
name
else
version
Expand Down
4 changes: 2 additions & 2 deletions src/current/v1.0/demo-fault-tolerance-and-recovery.md
Original file line number Diff line number Diff line change
Expand Up @@ -222,7 +222,7 @@ $ cockroach start --insecure \
~~~

~~~
CockroachDB node starting at {{page.release_info.start_time}}
CockroachDB node starting at {{ now | date: "%Y-%m-%d %H:%M:%S.%6 +0000 UTC" }}
build: CCL {{page.release_info.version}} @ {{page.release_info.build_time}}
admin: http://localhost:8081
sql: postgresql://root@localhost:26258?sslmode=disable
Expand Down Expand Up @@ -288,7 +288,7 @@ $ cockroach start --insecure \
~~~

~~~
CockroachDB node starting at {{page.release_info.start_time}}
CockroachDB node starting at {{ now | date: "%Y-%m-%d %H:%M:%S.%6 +0000 UTC" }}
build: CCL {{page.release_info.version}} @ {{page.release_info.build_time}}
admin: http://localhost:8083
sql: postgresql://root@localhost:26260?sslmode=disable
Expand Down
2 changes: 1 addition & 1 deletion src/current/v1.0/secure-a-cluster.md
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ $ cockroach start \
~~~

~~~
CockroachDB node starting at {{page.release_info.start_time}}
CockroachDB node starting at {{ now | date: "%Y-%m-%d %H:%M:%S.%6 +0000 UTC" }}
build: CCL {{page.release_info.version}} @ {{page.release_info.build_time}}
admin: https://ROACHs-MBP:8080
sql: postgresql://root@ROACHs-MBP:26257?sslcert=%2FUsers%2F...
Expand Down
2 changes: 1 addition & 1 deletion src/current/v1.0/start-a-local-cluster.md
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ $ cockroach start --insecure \
~~~

~~~
CockroachDB node starting at {{page.release_info.start_time}}
CockroachDB node starting at {{ now | date: "%Y-%m-%d %H:%M:%S.%6 +0000 UTC" }}
build: CCL {{page.release_info.version}} @ {{page.release_info.build_time}}
admin: http://localhost:8080
sql: postgresql://root@localhost:26257?sslmode=disable
Expand Down
2 changes: 1 addition & 1 deletion src/current/v1.0/start-a-node.md
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,7 @@ Field | Description
When you run `cockroach start`, some helpful details are printed to the standard output:

~~~ shell
CockroachDB node starting at {{page.release_info.start_time}}
CockroachDB node starting at {{ now | date: "%Y-%m-%d %H:%M:%S.%6 +0000 UTC" }}
build: CCL {{page.release_info.version}} @ {{page.release_info.build_time}}
admin: http://ROACHs-MBP:8080
sql: postgresql://root@ROACHs-MBP:26257?sslmode=disable
Expand Down
4 changes: 2 additions & 2 deletions src/current/v1.1/demo-fault-tolerance-and-recovery.md
Original file line number Diff line number Diff line change
Expand Up @@ -252,7 +252,7 @@ $ cockroach start --insecure \
~~~

~~~
CockroachDB node starting at {{page.release_info.start_time}}
CockroachDB node starting at {{ now | date: "%Y-%m-%d %H:%M:%S.%6 +0000 UTC" }}
build: CCL {{page.release_info.version}} @ {{page.release_info.build_time}}
admin: http://localhost:8081
sql: postgresql://root@localhost:26258?sslmode=disable
Expand Down Expand Up @@ -319,7 +319,7 @@ $ cockroach start \
~~~

~~~
CockroachDB node starting at {{page.release_info.start_time}}
CockroachDB node starting at {{ now | date: "%Y-%m-%d %H:%M:%S.%6 +0000 UTC" }}
build: CCL {{page.release_info.version}} @ {{page.release_info.build_time}}
admin: http://localhost:8083
sql: postgresql://root@localhost:26260?sslmode=disable
Expand Down
2 changes: 1 addition & 1 deletion src/current/v1.1/secure-a-cluster.md
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ $ cockroach start \
~~~

~~~
CockroachDB node starting at {{page.release_info.start_time}}
CockroachDB node starting at {{ now | date: "%Y-%m-%d %H:%M:%S.%6 +0000 UTC" }}
build: CCL {{page.release_info.version}} @ {{page.release_info.build_time}}
admin: https://ROACHs-MBP:8080
sql: postgresql://root@ROACHs-MBP:26257?sslcert=%2FUsers%2F...
Expand Down
2 changes: 1 addition & 1 deletion src/current/v1.1/start-a-local-cluster.md
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ $ cockroach start --insecure \
~~~

~~~
CockroachDB node starting at {{page.release_info.start_time}}
CockroachDB node starting at {{ now | date: "%Y-%m-%d %H:%M:%S.%6 +0000 UTC" }}
build: CCL {{page.release_info.version}} @ {{page.release_info.build_time}}
admin: http://localhost:8080
sql: postgresql://root@localhost:26257?sslmode=disable
Expand Down
2 changes: 1 addition & 1 deletion src/current/v1.1/start-a-node.md
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,7 @@ Field | Description
When you run `cockroach start`, some helpful details are printed to the standard output:

~~~ shell
CockroachDB node starting at {{page.release_info.start_time}}
CockroachDB node starting at {{ now | date: "%Y-%m-%d %H:%M:%S.%6 +0000 UTC" }}
build: CCL {{page.release_info.version}} @ {{page.release_info.build_time}}
admin: http://ROACHs-MBP:8080
sql: postgresql://root@ROACHs-MBP:26257?sslmode=disable
Expand Down
4 changes: 2 additions & 2 deletions src/current/v19.1/demo-fault-tolerance-and-recovery.md
Original file line number Diff line number Diff line change
Expand Up @@ -226,7 +226,7 @@ $ cockroach start --insecure \
~~~

~~~
CockroachDB node starting at {{page.release_info.start_time}}
CockroachDB node starting at {{ now | date: "%Y-%m-%d %H:%M:%S.%6 +0000 UTC" }}
build: CCL {{page.release_info.version}} @ {{page.release_info.build_time}}
admin: http://localhost:8081
sql: postgresql://root@localhost:26258?sslmode=disable
Expand Down Expand Up @@ -294,7 +294,7 @@ $ cockroach start \
~~~

~~~
CockroachDB node starting at {{page.release_info.start_time}}
CockroachDB node starting at {{ now | date: "%Y-%m-%d %H:%M:%S.%6 +0000 UTC" }}
build: CCL {{page.release_info.version}} @ {{page.release_info.build_time}}
admin: http://localhost:8083
sql: postgresql://root@localhost:26260?sslmode=disable
Expand Down
2 changes: 1 addition & 1 deletion src/current/v19.1/start-a-node.md
Original file line number Diff line number Diff line change
Expand Up @@ -152,7 +152,7 @@ This means, by default, CockroachDB writes all messages to log files, and never
When you run `cockroach start`, some helpful details are printed to the standard output:

~~~ shell
CockroachDB node starting at {{page.release_info.start_time}}
CockroachDB node starting at {{ now | date: "%Y-%m-%d %H:%M:%S.%6 +0000 UTC" }}
build: CCL {{page.release_info.version}} @ {{page.release_info.build_time}}
webui: http://localhost:8080
sql: postgresql://root@localhost:26257?sslmode=disable
Expand Down
2 changes: 1 addition & 1 deletion src/current/v19.2/cockroach-start-single-node.md
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,7 @@ This means, by default, CockroachDB writes all messages to log files, and never
When you run `cockroach start-single-node`, some helpful details are printed to the standard output:

~~~ shell
CockroachDB node starting at {{page.release_info.start_time}}
CockroachDB node starting at {{ now | date: "%Y-%m-%d %H:%M:%S.%6 +0000 UTC" }}
build: CCL {{page.release_info.version}} @ {{page.release_info.build_time}} (go1.12.6)
webui: http://localhost:8080
sql: postgresql://root@localhost:26257?sslmode=disable
Expand Down
2 changes: 1 addition & 1 deletion src/current/v19.2/cockroach-start.md
Original file line number Diff line number Diff line change
Expand Up @@ -147,7 +147,7 @@ This means, by default, CockroachDB writes all messages to log files, and never
When you run `cockroach start`, some helpful details are printed to the standard output:

~~~ shell
CockroachDB node starting at {{page.release_info.start_time}}
CockroachDB node starting at {{ now | date: "%Y-%m-%d %H:%M:%S.%6 +0000 UTC" }}
build: CCL {{page.release_info.version}} @ {{page.release_info.build_time}} (go1.12.6)
webui: http://localhost:8080
sql: postgresql://root@localhost:26257?sslmode=disable
Expand Down
2 changes: 1 addition & 1 deletion src/current/v19.2/secure-a-cluster.md
Original file line number Diff line number Diff line change
Expand Up @@ -152,7 +152,7 @@ You can use either [`cockroach cert`](cockroach-cert.html) commands or [`openssl
The output will look something like this:

~~~
CockroachDB node starting at {{page.release_info.start_time}}
CockroachDB node starting at {{ now | date: "%Y-%m-%d %H:%M:%S.%6 +0000 UTC" }}
build: CCL {{page.release_info.version}} @ {{page.release_info.build_time}} (go1.12.6)
webui: https://localhost:8080
sql: postgresql://root@localhost:26257?sslcert=certs%2Fclient.root.crt&sslkey=certs%2Fclient.root.key&sslmode=verify-full&sslrootcert=certs%2Fca.crt
Expand Down
Loading

0 comments on commit 5983f0b

Please sign in to comment.