diff --git a/.chloggen/add-local-module-replace-ocb-converter-provider.yaml b/.chloggen/add-local-module-replace-ocb-converter-provider.yaml new file mode 100644 index 00000000000..9b053592715 --- /dev/null +++ b/.chloggen/add-local-module-replace-ocb-converter-provider.yaml @@ -0,0 +1,32 @@ +# Use this changelog template to create an entry for release notes. + +# One of 'breaking', 'deprecation', 'new_component', 'enhancement', 'bug_fix' +change_type: enhancement + +# The name of the component, or a single word describing the area of concern, (e.g. otlpreceiver) +component: cmd/builder + +# A brief description of the change. Surround your text with quotes ("") if it needs to start with a backtick (`). +note: Allow for replacing of local Providers and Converters when building custom collector with ocb. + +# One or more tracking issues or pull requests related to the change +issues: [11649] + +# (Optional) One or more lines of additional information to render under the primary note. +# These lines will be padded with 2 spaces and then inserted directly into the document. +# Use pipe (|) for multiline entries. +subtext: | + Use the property `path` under `gomod` to replace an go module with a local folder in + builder-config.yaml. Ex: + ``` + providers: + - gomod: module.url/my/custom/provider v1.2.3 + path: /path/to/local/provider + ``` + +# Optional: The change log or logs in which this entry should be included. +# e.g. '[user]' or '[user, api]' +# Include 'user' if the change is relevant to end users. +# Include 'api' if there is a change to a library API. +# Default: '[user]' +change_logs: [user] diff --git a/cmd/builder/internal/builder/templates/go.mod.tmpl b/cmd/builder/internal/builder/templates/go.mod.tmpl index cec15fe06a4..ef68aa277c4 100644 --- a/cmd/builder/internal/builder/templates/go.mod.tmpl +++ b/cmd/builder/internal/builder/templates/go.mod.tmpl @@ -34,6 +34,12 @@ require ( github.com/knadh/koanf/providers/confmap v0.1.0 // indirect ) +{{- range .Converters}} +{{if ne .Path ""}}replace {{.GoMod}} => {{.Path}}{{end}} +{{- end}} +{{- range .Providers}} +{{if ne .Path ""}}replace {{.GoMod}} => {{.Path}}{{end}} +{{- end}} {{- range .Connectors}} {{if ne .Path ""}}replace {{.GoMod}} => {{.Path}}{{end}} {{- end}}