From 3f4ba91c60bff2b9a861a890da567b0ce83897f5 Mon Sep 17 00:00:00 2001 From: Antoine Toulme Date: Tue, 12 Dec 2023 19:20:32 -0800 Subject: [PATCH 1/4] [chore] use distributions.yaml in mdatagen --- .gitignore | 2 ++ cmd/mdatagen/go.mod | 2 +- cmd/mdatagen/statusdata.go | 38 ++++++++++++++++++++++++-------------- 3 files changed, 27 insertions(+), 15 deletions(-) diff --git a/.gitignore b/.gitignore index 52616038f614..34500e1634aa 100644 --- a/.gitignore +++ b/.gitignore @@ -39,3 +39,5 @@ integration-coverage.html go.work* /result +# File copied into mdatagen to be embedded +cmd/mdatagen/.distributions.yaml \ No newline at end of file diff --git a/cmd/mdatagen/go.mod b/cmd/mdatagen/go.mod index 6c9ec4e77d1f..ee538916999c 100644 --- a/cmd/mdatagen/go.mod +++ b/cmd/mdatagen/go.mod @@ -15,6 +15,7 @@ require ( go.uber.org/multierr v1.11.0 go.uber.org/zap v1.26.0 golang.org/x/text v0.14.0 + gopkg.in/yaml.v3 v3.0.1 ) require ( @@ -41,7 +42,6 @@ require ( google.golang.org/genproto/googleapis/rpc v0.0.0-20230822172742-b8732ec3820d // indirect google.golang.org/grpc v1.59.0 // indirect google.golang.org/protobuf v1.31.0 // indirect - gopkg.in/yaml.v3 v3.0.1 // indirect ) retract ( diff --git a/cmd/mdatagen/statusdata.go b/cmd/mdatagen/statusdata.go index 9ecf63d4257d..95f2c9fdd493 100644 --- a/cmd/mdatagen/statusdata.go +++ b/cmd/mdatagen/statusdata.go @@ -4,25 +4,35 @@ package main import ( + _ "embed" "sort" + + "gopkg.in/yaml.v3" ) -// distros is a collection of distributions that can be referenced in the metadata.yaml files. -// The rules below apply to every distribution added to this list: -// - The distribution must be open source. -// - The link must point to a publicly accessible repository. -var distros = map[string]string{ - "core": "https://github.com/open-telemetry/opentelemetry-collector-releases/tree/main/distributions/otelcol", - "contrib": "https://github.com/open-telemetry/opentelemetry-collector-releases/tree/main/distributions/otelcol-contrib", - "aws": "https://github.com/aws-observability/aws-otel-collector", - "grafana": "https://github.com/grafana/agent", - "observiq": "https://github.com/observIQ/observiq-otel-collector", - "redhat": "https://github.com/os-observability/redhat-opentelemetry-collector", - "splunk": "https://github.com/signalfx/splunk-otel-collector", - "sumo": "https://github.com/SumoLogic/sumologic-otel-collector", - "liatrio": "https://github.com/liatrio/liatrio-otel-collector", +//go:generate cp -r ../../distributions.yaml .distributions.yaml +//go:embed .distributions.yaml +var distrosBytes []byte + +func init() { + var dd []distroData + err := yaml.Unmarshal(distrosBytes, &dd) + if err != nil { + panic(err) + } + for _, d := range dd { + distros[d.Name] = d.URL + } } +type distroData struct { + Name string `yaml:"name"` + URL string `yaml:"url"` +} + +// distros is a collection of distributions that can be referenced in the metadata.yaml files. +var distros = map[string]string{} + type Codeowners struct { // Active codeowners Active []string `mapstructure:"active"` From ab862ebf15bee794b7d652bf9d0b7e211c91912c Mon Sep 17 00:00:00 2001 From: Antoine Toulme Date: Mon, 18 Dec 2023 09:45:50 -0800 Subject: [PATCH 2/4] do not ignore the .distributions.yaml file --- .gitignore | 4 +--- cmd/mdatagen/.distributions.yaml | 33 ++++++++++++++++++++++++++++++++ 2 files changed, 34 insertions(+), 3 deletions(-) create mode 100644 cmd/mdatagen/.distributions.yaml diff --git a/.gitignore b/.gitignore index 34500e1634aa..0e9f28b57bd6 100644 --- a/.gitignore +++ b/.gitignore @@ -38,6 +38,4 @@ integration-coverage.html go.work* -/result -# File copied into mdatagen to be embedded -cmd/mdatagen/.distributions.yaml \ No newline at end of file +/result \ No newline at end of file diff --git a/cmd/mdatagen/.distributions.yaml b/cmd/mdatagen/.distributions.yaml new file mode 100644 index 000000000000..89b97a0f43d8 --- /dev/null +++ b/cmd/mdatagen/.distributions.yaml @@ -0,0 +1,33 @@ +# A collection of distributions that can be referenced in the metadata.yaml files. +# The rules below apply to every distribution added to this list: +# - The distribution must be open source. +# - The link must point to a publicly accessible repository. + - name: core + url: https://github.com/open-telemetry/opentelemetry-collector-releases/tree/main/distributions/otelcol + - name: contrib + url: https://github.com/open-telemetry/opentelemetry-collector-releases/tree/main/distributions/otelcol-contrib + - name: aws + url: https://github.com/aws-observability/aws-otel-collector + - name: grafana + url: https://github.com/grafana/agent + - name: observiq + url: https://github.com/observIQ/observiq-otel-collector + - name: redhat + url: https://github.com/os-observability/redhat-opentelemetry-collector + - name: splunk + url: https://github.com/signalfx/splunk-otel-collector + maintainers: + - atoulme + - crobert-1 + - dmitryax + - hughesjj + - jeffreyc-splunk + - jinja2 + - jvoravong + - panotti + - rmfitzpatrick + - samiura + - name: sumo + url: https://github.com/SumoLogic/sumologic-otel-collector + - name: liatrio + url: https://github.com/liatrio/liatrio-otel-collector \ No newline at end of file From 8967e9c8ed031f9a519b414e83f86ba83f3fa7fa Mon Sep 17 00:00:00 2001 From: Antoine Toulme Date: Mon, 18 Dec 2023 10:52:04 -0800 Subject: [PATCH 3/4] update distros --- cmd/mdatagen/.distributions.yaml | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/cmd/mdatagen/.distributions.yaml b/cmd/mdatagen/.distributions.yaml index 89b97a0f43d8..d6c9cfb0824d 100644 --- a/cmd/mdatagen/.distributions.yaml +++ b/cmd/mdatagen/.distributions.yaml @@ -29,5 +29,14 @@ - samiura - name: sumo url: https://github.com/SumoLogic/sumologic-otel-collector + maintainers: + - aboguszewski-sumo + - astencel-sumo + - kkujawa-sumo + - rnishtala-sumo + - sumo-drosiek + - swiatekm-sumo - name: liatrio - url: https://github.com/liatrio/liatrio-otel-collector \ No newline at end of file + url: https://github.com/liatrio/liatrio-otel-collector + maintainers: + - adrielp From a785008ce0218d084db98e4df93262149a71332d Mon Sep 17 00:00:00 2001 From: Antoine Toulme Date: Mon, 18 Dec 2023 13:03:14 -0800 Subject: [PATCH 4/4] fix .gitignore --- .gitignore | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.gitignore b/.gitignore index 0e9f28b57bd6..52616038f614 100644 --- a/.gitignore +++ b/.gitignore @@ -38,4 +38,4 @@ integration-coverage.html go.work* -/result \ No newline at end of file +/result