@@ -44,6 +44,8 @@ const (
4444 containerEphemeralTag = "CONTAINER_IMAGE_EPHEMERAL_TAG=latest"
4545 projectName = "opentelemetry-collector-releases"
4646 defaultBuildDir = "_build"
47+ ocbReleaseHeader = "### Images and binaries for collector distributions here: https://github.com/open-telemetry/opentelemetry-collector-releases/releases/tag/{{ .Tag }}"
48+ opampReleaseHeader = "### Release of OpAMP supervisor artifacts"
4749)
4850
4951var (
@@ -204,7 +206,10 @@ var (
204206 newContainerImageManifests (d .name , "linux" , ocbArchs , containerImageOptions {binaryRelease : true }),
205207 )
206208 d .ldFlags = "-s -w -X go.opentelemetry.io/collector/cmd/builder/internal.version={{ .Version }}"
207- }).WithBinaryPackagingDefaults ().Build ()
209+ }).WithBinaryPackagingDefaults ().
210+ WithBinaryMonorepo (".core/cmd/builder" ).
211+ WithDefaultBinaryRelease (ocbReleaseHeader ).
212+ Build ()
208213
209214 // OpAMP Supervisor binary
210215 opampDist = newDistributionBuilder (opampBinary ).WithConfigFunc (func (d * distribution ) {
@@ -220,7 +225,10 @@ var (
220225 newContainerImageManifests (d .name , "linux" , ocbArchs , containerImageOptions {binaryRelease : true }),
221226 )
222227 d .ldFlags = "-s -w -X github.com/open-telemetry/opentelemetry-collector-contrib/cmd/opampsupervisor/internal.version={{ .Version }}"
223- }).WithBinaryPackagingDefaults ().Build ()
228+ }).WithBinaryPackagingDefaults ().
229+ WithBinaryMonorepo (".contrib/cmd/opampsupervisor" ).
230+ WithDefaultBinaryRelease (opampReleaseHeader ).
231+ Build ()
224232)
225233
226234type buildConfig interface {
@@ -436,22 +444,14 @@ func (b *distributionBuilder) WithDefaultMonorepo() *distributionBuilder {
436444 return b
437445}
438446
439- func (b * distributionBuilder ) WithDefaultBinaryMonorepo ( ) * distributionBuilder {
447+ func (b * distributionBuilder ) WithBinaryMonorepo ( dir string ) * distributionBuilder {
440448 b .configFuncs = append (b .configFuncs , func (d * distribution ) {
441- b .dist .monorepo = b .binaryMonorepo ()
449+ b .dist .monorepo = b .binaryMonorepo (dir )
442450 })
443451 return b
444452}
445453
446- func (b * distributionBuilder ) binaryMonorepo () config.Monorepo {
447- dir := ""
448- switch b .dist .name {
449- case ocbBinary :
450- dir = ".core/cmd/builder"
451- case opampBinary :
452- dir = ".contrib/cmd/opampsupervisor"
453- }
454-
454+ func (b * distributionBuilder ) binaryMonorepo (dir string ) config.Monorepo {
455455 return config.Monorepo {
456456 TagPrefix : fmt .Sprintf ("cmd/%s/" , b .dist .name ),
457457 Dir : dir ,
@@ -501,30 +501,18 @@ func (b *distributionBuilder) WithDefaultRelease() *distributionBuilder {
501501 return b
502502}
503503
504- func (b * distributionBuilder ) WithDefaultBinaryRelease () * distributionBuilder {
504+ func (b * distributionBuilder ) WithDefaultBinaryRelease (header string ) * distributionBuilder {
505505 b .configFuncs = append (b .configFuncs , func (d * distribution ) {
506- b .dist .release = b .release ()
506+ b .dist .release = b .release (header )
507507 })
508508 return b
509509}
510510
511- func (b * distributionBuilder ) release () config.Release {
512- headerContent := ""
513- switch b .dist .name {
514- case ocbBinary :
515- headerContent = "### Images and binaries for collector distributions here: https://github.com/open-telemetry/opentelemetry-collector-releases/releases/tag/{{ .Tag }}"
516- case opampBinary :
517- headerContent = "### Release of OpAMP supervisor artifacts"
518- }
519-
511+ func (b * distributionBuilder ) release (header string ) config.Release {
520512 return config.Release {
521513 MakeLatest : "false" ,
522- GitHub : config.Repo {
523- Owner : "open-telemetry" ,
524- Name : projectName ,
525- },
526514 Header : config.IncludedMarkdown {
527- Content : headerContent ,
515+ Content : header ,
528516 },
529517 }
530518}
@@ -553,12 +541,10 @@ func (b *distributionBuilder) WithBinaryPackagingDefaults() *distributionBuilder
553541
554542 return b .WithBinArchive ().
555543 WithDefaultChecksum ().
556- WithDefaultBinaryMonorepo ().
557544 WithDefaultEnv ().
558545 WithDefaultSigns ().
559546 WithDefaultDockerSigns ().
560547 WithDefaultSBOMs ().
561- WithDefaultBinaryRelease ().
562548 WithDefaultBinaryChecksum ()
563549}
564550
0 commit comments