diff --git a/README.md b/README.md index d27ab33..8b8b220 100644 --- a/README.md +++ b/README.md @@ -71,6 +71,7 @@ Registry generated from the source above. "oss" ], "repo": { + "clone_url": "https://github.com/grafana/xk6-dashboard.git", "description": "A k6 extension that makes k6 metrics available on a web-based dashboard.", "homepage": "https://github.com/grafana/xk6-dashboard", "license": "AGPL-3.0", @@ -78,6 +79,7 @@ Registry generated from the source above. "owner": "grafana", "public": true, "stars": 325, + "timestamp": 1719907965, "topics": [ "xk6", "xk6-official", @@ -137,6 +139,7 @@ Registry generated from the source above. "oss" ], "repo": { + "clone_url": "https://github.com/grafana/xk6-sql.git", "description": "k6 extension to load test RDBMSs (PostgreSQL, MySQL, MS SQL and SQLite3)", "homepage": "https://github.com/grafana/xk6-sql", "license": "Apache-2.0", @@ -144,6 +147,7 @@ Registry generated from the source above. "owner": "grafana", "public": true, "stars": 104, + "timestamp": 1721400602, "topics": [ "k6", "sql", @@ -175,6 +179,7 @@ Registry generated from the source above. "oss" ], "repo": { + "clone_url": "https://github.com/grafana/xk6-disruptor.git", "description": "Extension for injecting faults into k6 tests", "homepage": "https://k6.io/docs/javascript-api/xk6-disruptor/", "license": "AGPL-3.0", @@ -182,6 +187,7 @@ Registry generated from the source above. "owner": "grafana", "public": true, "stars": 88, + "timestamp": 1724358828, "topics": [ "chaos-engineering", "fault-injection", @@ -228,6 +234,7 @@ Registry generated from the source above. "oss" ], "repo": { + "clone_url": "https://github.com/szkiba/xk6-faker.git", "description": "Random fake data generator for k6.", "homepage": "http://ivan.szkiba.hu/xk6-faker/", "license": "AGPL-3.0", @@ -235,6 +242,7 @@ Registry generated from the source above. "owner": "szkiba", "public": true, "stars": 49, + "timestamp": 1719935566, "topics": [ "xk6", "xk6-javascript-k6-x-faker" @@ -264,12 +272,14 @@ Registry generated from the source above. "oss" ], "repo": { + "clone_url": "https://gitlab.com/szkiba/xk6-banner.git", "description": "Print ASCII art banner from k6 test.", "homepage": "https://gitlab.com/szkiba/xk6-banner", "license": "MIT", "name": "xk6-banner", "owner": "szkiba", "public": true, + "timestamp": 1724312566, "topics": [ "xk6" ], @@ -291,13 +301,13 @@ Registry generated from the source above. "oss" ], "repo": { + "clone_url": "https://github.com/grafana/k6.git", "description": "A modern load testing tool, using Go and JavaScript - https://k6.io", "homepage": "https://github.com/grafana/k6", "license": "AGPL-3.0", "name": "k6", "owner": "grafana", "public": true, - "stars": 24302, "topics": [ "es6", "go", diff --git a/cmd/load.go b/cmd/load.go index afb5237..9c8bdcd 100644 --- a/cmd/load.go +++ b/cmd/load.go @@ -100,6 +100,12 @@ func loadRepository(ctx context.Context, module string) (*k6registry.Repository, return nil, err } + // Some unused metadata in the k6 repository changes too often + if strings.HasPrefix(module, k6Module) { + repo.Stars = 0 + repo.Timestamp = 0 + } + return repo, nil } @@ -162,6 +168,12 @@ func loadGitHub(ctx context.Context, module string) (*k6registry.Repository, err repo.Public = rep.GetVisibility() == "public" + if ts := rep.GetPushedAt(); !ts.IsZero() { + repo.Timestamp = float64(ts.Unix()) + } + + repo.CloneUrl = rep.GetCloneURL() + tags, _, err := client.Repositories.ListTags(ctx, owner, name, &github.ListOptions{PerPage: 100}) if err != nil { return nil, err @@ -207,6 +219,12 @@ func loadGitLab(ctx context.Context, module string) (*k6registry.Repository, err repo.Topics = proj.Topics repo.Public = len(proj.Visibility) == 0 || proj.Visibility == gitlab.PublicVisibility + repo.CloneUrl = proj.HTTPURLToRepo + + if proj.LastActivityAt != nil { + repo.Timestamp = float64(proj.LastActivityAt.Unix()) + } + if proj.License != nil { for key := range validLicenses { if strings.EqualFold(key, proj.License.Key) { diff --git a/docs/example.json b/docs/example.json index 84d3e22..86a253b 100644 --- a/docs/example.json +++ b/docs/example.json @@ -13,6 +13,7 @@ "oss" ], "repo": { + "clone_url": "https://github.com/grafana/xk6-dashboard.git", "description": "A k6 extension that makes k6 metrics available on a web-based dashboard.", "homepage": "https://github.com/grafana/xk6-dashboard", "license": "AGPL-3.0", @@ -20,6 +21,7 @@ "owner": "grafana", "public": true, "stars": 325, + "timestamp": 1719907965, "topics": [ "xk6", "xk6-official", @@ -79,6 +81,7 @@ "oss" ], "repo": { + "clone_url": "https://github.com/grafana/xk6-sql.git", "description": "k6 extension to load test RDBMSs (PostgreSQL, MySQL, MS SQL and SQLite3)", "homepage": "https://github.com/grafana/xk6-sql", "license": "Apache-2.0", @@ -86,6 +89,7 @@ "owner": "grafana", "public": true, "stars": 104, + "timestamp": 1721400602, "topics": [ "k6", "sql", @@ -117,6 +121,7 @@ "oss" ], "repo": { + "clone_url": "https://github.com/grafana/xk6-disruptor.git", "description": "Extension for injecting faults into k6 tests", "homepage": "https://k6.io/docs/javascript-api/xk6-disruptor/", "license": "AGPL-3.0", @@ -124,6 +129,7 @@ "owner": "grafana", "public": true, "stars": 88, + "timestamp": 1724358828, "topics": [ "chaos-engineering", "fault-injection", @@ -170,6 +176,7 @@ "oss" ], "repo": { + "clone_url": "https://github.com/szkiba/xk6-faker.git", "description": "Random fake data generator for k6.", "homepage": "http://ivan.szkiba.hu/xk6-faker/", "license": "AGPL-3.0", @@ -177,6 +184,7 @@ "owner": "szkiba", "public": true, "stars": 49, + "timestamp": 1719935566, "topics": [ "xk6", "xk6-javascript-k6-x-faker" @@ -206,12 +214,14 @@ "oss" ], "repo": { + "clone_url": "https://gitlab.com/szkiba/xk6-banner.git", "description": "Print ASCII art banner from k6 test.", "homepage": "https://gitlab.com/szkiba/xk6-banner", "license": "MIT", "name": "xk6-banner", "owner": "szkiba", "public": true, + "timestamp": 1724312566, "topics": [ "xk6" ], @@ -233,13 +243,13 @@ "oss" ], "repo": { + "clone_url": "https://github.com/grafana/k6.git", "description": "A modern load testing tool, using Go and JavaScript - https://k6.io", "homepage": "https://github.com/grafana/k6", "license": "AGPL-3.0", "name": "k6", "owner": "grafana", "public": true, - "stars": 24302, "topics": [ "es6", "go", diff --git a/docs/registry.md b/docs/registry.md index e2abace..270b787 100644 --- a/docs/registry.md +++ b/docs/registry.md @@ -174,6 +174,16 @@ The `true` value of the `archived` flag indicates that the repository is archive If a repository is archived, it usually means that the owner has no intention of maintaining it. Such extensions should be removed from the registry. +#### Timestamp + +The `timestamp` property contains the timestamp of the last modification of the repository in UNIX time format (the number of non-leap seconds that have elapsed since 00:00:00 UTC on 1st January 1970). + +Its value depends on the repository manager, in the case of GitHub it contains the time of the last push operation, in the case of GitLab the time of the last repository activity. + +#### Clone URL + +The `clone_url` property contains a (typically HTTP) URL, which is used to clone the repository. + ## Registry Processing The source of the registry is a YAML file optimized for human use. Since collecting extension metadata is a complicated and time-consuming task, it is advisable to extract this step into a registry generator CLI tool. The output of this tool is an extension registry in JSON format. diff --git a/docs/registry.schema.json b/docs/registry.schema.json index 7904352..52aff50 100644 --- a/docs/registry.schema.json +++ b/docs/registry.schema.json @@ -153,6 +153,17 @@ "type": "boolean", "default": "false", "description": "Archived repository flag.\n\nA `true` value indicates that the repository is archived, read only.\n\nIf a repository is archived, it usually means that the owner has no intention of maintaining it. Such extensions should be removed from the registry.\n" + }, + "timestamp": { + "type": "number", + "default": 0, + "description": "Last modification timestamp.\n\nThe timestamp property contains the timestamp of the last modification of the repository in UNIX time format (the number of non-leap seconds that have elapsed since 00:00:00 UTC on 1st January 1970).\nIts value depends on the repository manager, in the case of GitHub it contains the time of the last push operation, in the case of GitLab the time of the last repository activity.\n" + }, + "clone_url": { + "type": "string", + "format": "uri", + "default": "", + "description": "URL for the git clone operation.\n\nThe clone_url property contains a (typically HTTP) URL, which is used to clone the repository.\n" } } }, diff --git a/docs/registry.schema.yaml b/docs/registry.schema.yaml index bd6ed23..93578b6 100644 --- a/docs/registry.schema.yaml +++ b/docs/registry.schema.yaml @@ -215,6 +215,22 @@ $defs: A `true` value indicates that the repository is archived, read only. If a repository is archived, it usually means that the owner has no intention of maintaining it. Such extensions should be removed from the registry. + timestamp: + type: number + default: 0 + description: | + Last modification timestamp. + + The timestamp property contains the timestamp of the last modification of the repository in UNIX time format (the number of non-leap seconds that have elapsed since 00:00:00 UTC on 1st January 1970). + Its value depends on the repository manager, in the case of GitHub it contains the time of the last push operation, in the case of GitLab the time of the last repository activity. + clone_url: + type: string + format: uri + default: "" + description: | + URL for the git clone operation. + + The clone_url property contains a (typically HTTP) URL, which is used to clone the repository. tier: type: string enum: ["official", "partner", "community"] diff --git a/registry_gen.go b/registry_gen.go index 5d048c4..d200978 100644 --- a/registry_gen.go +++ b/registry_gen.go @@ -163,6 +163,13 @@ type Repository struct { // Archived bool `json:"archived,omitempty" yaml:"archived,omitempty" mapstructure:"archived,omitempty"` + // URL for the git clone operation. + // + // The clone_url property contains a (typically HTTP) URL, which is used to clone + // the repository. + // + CloneUrl string `json:"clone_url,omitempty" yaml:"clone_url,omitempty" mapstructure:"clone_url,omitempty"` + // Repository description. // Description string `json:"description,omitempty" yaml:"description,omitempty" mapstructure:"description,omitempty"` @@ -200,6 +207,17 @@ type Repository struct { // Stars int `json:"stars,omitempty" yaml:"stars,omitempty" mapstructure:"stars,omitempty"` + // Last modification timestamp. + // + // The timestamp property contains the timestamp of the last modification of the + // repository in UNIX time format (the number of non-leap seconds that have + // elapsed since 00:00:00 UTC on 1st January 1970). + // Its value depends on the repository manager, in the case of GitHub it contains + // the time of the last push operation, in the case of GitLab the time of the last + // repository activity. + // + Timestamp float64 `json:"timestamp,omitempty" yaml:"timestamp,omitempty" mapstructure:"timestamp,omitempty"` + // Repository topics. // // Topics make it easier to find the repository. It is recommended to set the xk6 diff --git a/releases/v0.1.13.md b/releases/v0.1.13.md new file mode 100644 index 0000000..9833c9b --- /dev/null +++ b/releases/v0.1.13.md @@ -0,0 +1,7 @@ +k6registry `v0.1.13` is here 🎉! + +This is an internal maintenance release. + +## Add repo metadata for linter support + +Add last modification (`timestamp`) and git clone URL (`clone_url`) repository metadata to support implementation of extension linter.