Skip to content

Commit

Permalink
output releases with explcit major/minor keys
Browse files Browse the repository at this point in the history
  • Loading branch information
cwaldren-ld committed Mar 18, 2024
1 parent 2aacc32 commit 6c1ca6f
Show file tree
Hide file tree
Showing 6 changed files with 51 additions and 28 deletions.
5 changes: 3 additions & 2 deletions cmd/ingest/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -242,13 +242,14 @@ func insertFeatures(tx *sql.Tx, id string, metadata *metadataV1) error {
}

func insertReleases(tx *sql.Tx, id string, release []release.WithEOL) error {
stmt, err := tx.Prepare("INSERT INTO sdk_releases (id, version, date, eol) VALUES (?, ?, ?, ?)")
stmt, err := tx.Prepare("INSERT INTO sdk_releases (id, major, minor, date, eol) VALUES (?, ?, ?, ?, ?)")
if err != nil {
return err
}
defer stmt.Close()
for _, release := range release {
_, err = stmt.Exec(id, release.MajorMinor(), release.Date.Format(time.RFC3339), release.MaybeEOL())
majorMinor := release.MajorMinor()
_, err = stmt.Exec(id, majorMinor[0], majorMinor[1], release.Date.Format(time.RFC3339), release.MaybeEOL())
if err != nil {
return err
}
Expand Down
4 changes: 2 additions & 2 deletions lib/release/releases.go
Original file line number Diff line number Diff line change
Expand Up @@ -51,8 +51,8 @@ type releasesQuery struct {
} `graphql:"repository(owner: $org, name: $repo)"`
}

func (r WithEOL) MajorMinor() string {
return strings.TrimPrefix(semver.MajorMinor(r.Version), "v")
func (r WithEOL) MajorMinor() []string {
return strings.Split(strings.TrimPrefix(semver.MajorMinor(r.Version), "v"), ".")
}

func (r WithEOL) MaybeEOL() *string {
Expand Down
Binary file modified metadata.sqlite3
Binary file not shown.
63 changes: 42 additions & 21 deletions products/releases.json
Original file line number Diff line number Diff line change
@@ -1,117 +1,138 @@
{
"akamai-base": [
{
"version": "2.1",
"major": "2",
"minor": "1",
"date": "2024-03-15T18:08:33Z",
"eol": null
},
{
"version": "2.0",
"major": "2",
"minor": "0",
"date": "2024-01-17T20:20:38Z",
"eol": "2025-03-15T18:08:33Z"
},
{
"version": "1.0",
"major": "1",
"minor": "0",
"date": "2023-09-06T16:50:07Z",
"eol": "2025-01-17T20:20:38Z"
}
],
"akamai-edgekv": [
{
"version": "1.1",
"major": "1",
"minor": "1",
"date": "2024-03-15T18:08:34Z",
"eol": null
},
{
"version": "1.0",
"major": "1",
"minor": "0",
"date": "2024-01-17T20:20:39Z",
"eol": "2025-03-15T18:08:34Z"
}
],
"cloudflare": [
{
"version": "2.4",
"major": "2",
"minor": "4",
"date": "2024-03-15T18:08:27Z",
"eol": null
},
{
"version": "2.3",
"major": "2",
"minor": "3",
"date": "2024-01-17T20:20:33Z",
"eol": "2025-03-15T18:08:27Z"
},
{
"version": "2.2",
"major": "2",
"minor": "2",
"date": "2023-11-01T21:33:19Z",
"eol": "2025-01-17T20:20:33Z"
},
{
"version": "2.1",
"major": "2",
"minor": "1",
"date": "2023-09-06T16:50:05Z",
"eol": "2024-11-01T21:33:19Z"
},
{
"version": "2.0",
"major": "2",
"minor": "0",
"date": "2023-08-10T20:32:51Z",
"eol": "2024-09-06T16:50:05Z"
}
],
"node-server": [
{
"version": "9.2",
"major": "9",
"minor": "2",
"date": "2024-03-15T18:08:30Z",
"eol": null
},
{
"version": "9.1",
"major": "9",
"minor": "1",
"date": "2024-02-08T21:29:54Z",
"eol": "2025-03-15T18:08:30Z"
},
{
"version": "9.0",
"major": "9",
"minor": "0",
"date": "2024-01-17T20:20:36Z",
"eol": "2025-02-08T21:29:54Z"
},
{
"version": "8.2",
"major": "8",
"minor": "2",
"date": "2024-02-12T21:00:03Z",
"eol": "2025-01-17T20:20:36Z"
},
{
"version": "8.1",
"major": "8",
"minor": "1",
"date": "2023-08-10T20:32:49Z",
"eol": "2025-01-17T20:20:36Z"
},
{
"version": "8.0",
"major": "8",
"minor": "0",
"date": "2023-07-05T16:40:59Z",
"eol": "2024-08-10T20:32:49Z"
}
],
"react-native": [
{
"version": "10.0",
"major": "10",
"minor": "0",
"date": "2024-03-15T18:08:29Z",
"eol": null
}
],
"vercel": [
{
"version": "1.3",
"major": "1",
"minor": "3",
"date": "2024-03-15T18:08:31Z",
"eol": null
},
{
"version": "1.2",
"major": "1",
"minor": "2",
"date": "2024-01-17T20:20:37Z",
"eol": "2025-03-15T18:08:31Z"
},
{
"version": "1.1",
"major": "1",
"minor": "1",
"date": "2023-11-01T21:33:21Z",
"eol": "2025-01-17T20:20:37Z"
},
{
"version": "1.0",
"major": "1",
"minor": "0",
"date": "2023-08-03T20:52:41Z",
"eol": "2024-11-01T21:33:21Z"
}
Expand Down
5 changes: 3 additions & 2 deletions schemas/sdk_metadata.sql
Original file line number Diff line number Diff line change
Expand Up @@ -48,10 +48,11 @@ CREATE TABLE sdk_feature_info (

CREATE TABLE sdk_releases (
id TEXT NOT NULL,
version TEXT NOT NULL,
major TEXT NOT NULL,
minor TEXT NOT NULL,
date TEXT NOT NULL,
eol TEXT,
PRIMARY KEY(id, version)
PRIMARY KEY(id, major, minor)
);


Expand Down
2 changes: 1 addition & 1 deletion scripts/generate-products.sh
Original file line number Diff line number Diff line change
Expand Up @@ -19,4 +19,4 @@ sqlite3 -json metadata.sqlite3 "SELECT * from sdk_repos;" |
jq -S 'reduce .[] as $item ({}; .[$item.id] += {github: $item.github})' > products/repos.json

sqlite3 -json metadata.sqlite3 "SELECT * FROM sdk_releases;" |
jq 'group_by(.id) | map({(.[0].id): map({version: .version, date: .date, eol: .eol})}) | add' > products/releases.json
jq 'group_by(.id) | map({(.[0].id): map({major: .major, minor: .minor, date: .date, eol: .eol})}) | add' > products/releases.json

0 comments on commit 6c1ca6f

Please sign in to comment.