Skip to content

Commit

Permalink
Merge branch 'main' into main
Browse files Browse the repository at this point in the history
  • Loading branch information
sfc-gh-sili authored Aug 10, 2024
2 parents 98ec533 + ef07ea0 commit b9f8254
Show file tree
Hide file tree
Showing 27 changed files with 139 additions and 119 deletions.
25 changes: 25 additions & 0 deletions .chloggen/codeboten_mdatagen-expose-scope-name.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
# 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: mdatagen

# A brief description of the change. Surround your text with quotes ("") if it needs to start with a backtick (`).
note: export ScopeName in internal/metadata package

# One or more tracking issues or pull requests related to the change
issues: [10845]

# (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: This can be used by components that need to set their scope name manually. Will save component owners from having to store a variable, which may diverge from the scope name used by the component for emitting its own telemetry.

# 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: []
27 changes: 27 additions & 0 deletions .chloggen/expose_host_tests.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
# 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: mdatagen

# A brief description of the change. Surround your text with quotes ("") if it needs to start with a backtick (`).
note: Expose a setting on tests::host to set up your own host initialization code

# One or more tracking issues or pull requests related to the change
issues: [10765]

# (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: |
Some receivers require a host that has additional capabilities such as exposing exporters.
For those, we can expose a setting that allows them to place a different host in the generated code.
# 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: []
25 changes: 25 additions & 0 deletions .chloggen/ocb-migration.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
# 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: ocb

# A brief description of the change. Surround your text with quotes ("") if it needs to start with a backtick (`).
note: migrate build and release of ocb binaries to opentelemetry-collector-releases repository

# One or more tracking issues or pull requests related to the change
issues: [10710]

# (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: ocb binaries will now be released under open-telemetry/opentelemetry-collector-releases tagged as "cmd/builder/vX.XXX.X"

# 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]
32 changes: 0 additions & 32 deletions .github/workflows/check-goreleaser.yaml

This file was deleted.

12 changes: 10 additions & 2 deletions .github/workflows/prepare-release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ jobs:

steps:
- name: Validate version format
shell: bash
run: |
validate_beta_version() {
local regex_pattern_beta='^[0-9]+\.[0-9]+\.[0-9]+$'
Expand All @@ -42,13 +43,20 @@ jobs:
fi
}
validate_beta_version "${{ inputs.candidate-beta }}" "candidate-beta"
if [[ ! -z "${{ inputs.candidate-beta }}" ]]; then
validate_beta_version "${{ inputs.candidate-beta }}" "candidate-beta"
fi
validate_beta_version "${{ inputs.current-beta }}" "current-beta"
if [[ ! -z "${{ inputs.candidate-stable }}" ]]; then
validate_stable_version "${{ inputs.candidate-stable }}" "candidate-stable"
fi
validate_stable_version "${{ inputs.current-stable }}" "current-stable"
shell: bash
if [[ -z "${{ inputs.candidate-beta }}" && -z "${{ inputs.candidate-stable }}" ]]; then
echo "Candidate version is not set for beta or stable. Please set a version to proceed."
exit 1
fi
# Releasing opentelemetry-collector
prepare-release:
Expand Down
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
name: Builder - Release
name: Source Code - Release

on:
push:
tags:
- 'v*'
- "v*"

jobs:
goreleaser:
Expand All @@ -13,19 +13,6 @@ jobs:
uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4.1.7
with:
fetch-depth: 0
- name: Setup Go
uses: actions/setup-go@0a12ed9d6a96ab950c8f026ed9f722fe0da7ef32 # v5.0.2
with:
go-version: ~1.21.5
- name: Run GoReleaser
uses: goreleaser/goreleaser-action@286f3b13b1b49da4ac219696163fb8c1c93e1200 # v6.0.0
with:
distribution: goreleaser-pro
version: latest
args: release --clean -f cmd/builder/.goreleaser.yml
env:
GORELEASER_KEY: ${{ secrets.GORELEASER_KEY }}
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: Create Github Release
run: |
gh release create ${{ github.ref_name }} -t ${{ github.ref_name }} -n "### Images and binaries here: https://github.com/open-telemetry/opentelemetry-collector-releases/releases/tag/${{ github.ref_name }}"
Expand Down
39 changes: 0 additions & 39 deletions cmd/builder/.goreleaser.yml

This file was deleted.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

5 changes: 3 additions & 2 deletions cmd/mdatagen/loader.go
Original file line number Diff line number Diff line change
Expand Up @@ -229,6 +229,7 @@ type tests struct {
SkipShutdown bool `mapstructure:"skip_shutdown"`
GoLeak goLeak `mapstructure:"goleak"`
ExpectConsumerError bool `mapstructure:"expect_consumer_error"`
Host string `mapstructure:"host"`
}

type telemetry struct {
Expand Down Expand Up @@ -257,7 +258,7 @@ type metadata struct {
ScopeName string `mapstructure:"scope_name"`
// ShortFolderName is the shortened folder name of the component, removing class if present
ShortFolderName string `mapstructure:"-"`

// Tests is the set of tests generated with the component
Tests tests `mapstructure:"tests"`
}

Expand Down Expand Up @@ -285,7 +286,7 @@ func loadMetadata(filePath string) (metadata, error) {
return metadata{}, err
}

md := metadata{ShortFolderName: shortFolderName(filePath)}
md := metadata{ShortFolderName: shortFolderName(filePath), Tests: tests{Host: "componenttest.NewNopHost()"}}
if err = conf.Unmarshal(&md); err != nil {
return md, err
}
Expand Down
2 changes: 2 additions & 0 deletions cmd/mdatagen/loader_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -280,6 +280,7 @@ func TestLoadMetadata(t *testing.T) {
},
ScopeName: "go.opentelemetry.io/collector/internal/receiver/samplereceiver",
ShortFolderName: "sample",
Tests: tests{Host: "componenttest.NewNopHost()"},
},
},
{
Expand All @@ -289,6 +290,7 @@ func TestLoadMetadata(t *testing.T) {
Parent: "parentComponent",
ScopeName: "go.opentelemetry.io/collector/cmd/mdatagen",
ShortFolderName: "testdata",
Tests: tests{Host: "componenttest.NewNopHost()"},
},
},
{
Expand Down
6 changes: 4 additions & 2 deletions cmd/mdatagen/main_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -462,7 +462,8 @@ import (
)
var (
Type = component.MustNewType("foo")
Type = component.MustNewType("foo")
ScopeName = ""
)
const (
Expand Down Expand Up @@ -491,7 +492,8 @@ import (
)
var (
Type = component.MustNewType("foo")
Type = component.MustNewType("foo")
ScopeName = ""
)
const (
Expand Down
12 changes: 6 additions & 6 deletions cmd/mdatagen/templates/component_test.go.tmpl
Original file line number Diff line number Diff line change
Expand Up @@ -118,7 +118,7 @@ func TestComponentLifecycle(t *testing.T) {
t.Run(test.name + "-lifecycle", func(t *testing.T) {
c, err := test.createFn(context.Background(), exportertest.NewNopSettings(), cfg)
require.NoError(t, err)
host := componenttest.NewNopHost()
host := {{ .Tests.Host }}
err = c.Start(context.Background(), host)
require.NoError(t, err)
require.NotPanics(t, func() {
Expand Down Expand Up @@ -215,7 +215,7 @@ func TestComponentLifecycle(t *testing.T) {
t.Run(test.name + "-lifecycle", func(t *testing.T) {
c, err := test.createFn(context.Background(), processortest.NewNopSettings(), cfg)
require.NoError(t, err)
host := componenttest.NewNopHost()
host := {{ .Tests.Host }}
err = c.Start(context.Background(), host)
require.NoError(t, err)
require.NotPanics(t, func() {
Expand Down Expand Up @@ -310,7 +310,7 @@ func TestComponentLifecycle(t *testing.T) {
t.Run(test.name + "-lifecycle", func(t *testing.T) {
firstRcvr, err := test.createFn(context.Background(), receivertest.NewNopSettings(), cfg)
require.NoError(t, err)
host := componenttest.NewNopHost()
host := {{ .Tests.Host }}
require.NoError(t, err)
require.NoError(t, firstRcvr.Start(context.Background(), host))
require.NoError(t, firstRcvr.Shutdown(context.Background()))
Expand Down Expand Up @@ -348,12 +348,12 @@ func TestComponentLifecycle(t *testing.T) {
t.Run("lifecycle", func(t *testing.T) {
firstExt, err := factory.CreateExtension(context.Background(), extensiontest.NewNopSettings(), cfg)
require.NoError(t, err)
require.NoError(t, firstExt.Start(context.Background(), componenttest.NewNopHost()))
require.NoError(t, firstExt.Start(context.Background(), {{ .Tests.Host }}))
require.NoError(t, firstExt.Shutdown(context.Background()))

secondExt, err := factory.CreateExtension(context.Background(), extensiontest.NewNopSettings(), cfg)
require.NoError(t, err)
require.NoError(t, secondExt.Start(context.Background(), componenttest.NewNopHost()))
require.NoError(t, secondExt.Start(context.Background(), {{ .Tests.Host }}))
require.NoError(t, secondExt.Shutdown(context.Background()))
})
{{- end }}
Expand Down Expand Up @@ -472,7 +472,7 @@ func TestComponentLifecycle(t *testing.T) {
t.Run(test.name + "-lifecycle", func(t *testing.T) {
firstConnector, err := test.createFn(context.Background(), connectortest.NewNopSettings(), cfg)
require.NoError(t, err)
host := componenttest.NewNopHost()
host := {{ .Tests.Host }}
require.NoError(t, err)
require.NoError(t, firstConnector.Start(context.Background(), host))
require.NoError(t, firstConnector.Shutdown(context.Background()))
Expand Down
3 changes: 2 additions & 1 deletion cmd/mdatagen/templates/status.go.tmpl
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,8 @@ import (
)

var (
Type = component.MustNewType("{{ .Type }}")
Type = component.MustNewType("{{ .Type }}")
ScopeName = "{{ .ScopeName }}"
)

const (
Expand Down

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

11 changes: 5 additions & 6 deletions docs/release.md
Original file line number Diff line number Diff line change
Expand Up @@ -46,9 +46,7 @@ It is possible that a core approver isn't a contrib approver. In that case, the

If you set your remote using `https` you need to include `REMOTE=https://github.com/open-telemetry/opentelemetry-collector.git` in each command. Wait for the new tag build to pass successfully.

6. The release script for the collector builder should create a new GitHub release for the builder. This is a separate release from the core, but we might join them in the future if it makes sense.

7. A new `v0.85.0` release should be automatically created on Github by now. Edit it and use the contents from the CHANGELOG.md and CHANGELOG-API.md as the release's description.
6. A new `v0.85.0` source code release should be automatically created on Github by now. Edit it and use the contents from the CHANGELOG.md and CHANGELOG-API.md as the release's description.

## Releasing opentelemetry-collector-contrib

Expand All @@ -74,10 +72,9 @@ It is possible that a core approver isn't a contrib approver. In that case, the
5. A new `v0.85.0` release should be automatically created on Github by now. Edit it and use the contents from the CHANGELOG.md as the release's description.

## Producing the artifacts

The last step of the release process creates artifacts for the new version of the collector and publishes images to Dockerhub. The steps in this portion of the release are done in the [opentelemetry-collector-releases](https://github.com/open-telemetry/opentelemetry-collector-releases) repo.

1. Update the `./distribution/**/manifest.yaml` files to include the new release version.
1. Update the `./distributions/**/manifest.yaml` files to include the new release version.

2. Update the builder version in `OTELCOL_BUILDER_VERSION` to the new release in the `Makefile`. While this might not be strictly necessary for every release, this is a good practice.

Expand All @@ -86,12 +83,14 @@ The last step of the release process creates artifacts for the new version of th

4. Check out the commit created by merging the PR and tag with the new release version by running the `make push-tags TAG=v0.85.0` command. If you set your remote using `https` you need to include `REMOTE=https://github.com/open-telemetry/opentelemetry-collector-releases.git` in each command. Wait for the new tag build to pass successfully.

5. Ensure the "Release Core", "Release Contrib" and "Release k8s" actions pass, this will
5. Ensure the "Release Core", "Release Contrib", "Release k8s", and "Builder - Release" actions pass, this will

1. push new container images to `https://hub.docker.com/repository/docker/otel/opentelemetry-collector`, `https://hub.docker.com/repository/docker/otel/opentelemetry-collector-contrib` and `https://hub.docker.com/repository/docker/otel/opentelemetry-collector-k8s`

2. create a Github release for the tag and push all the build artifacts to the Github release. See [example](https://github.com/open-telemetry/opentelemetry-collector-releases/actions/workflows/release-core.yaml).

3. build and release ocb binaries under a separate tagged Github release, e.g. `cmd/builder/v0.85.0`

## Troubleshooting

1. `unknown revision internal/coreinternal/v0.85.0` -- This is typically an indication that there's a dependency on a new module. You can fix it by adding a new `replaces` entry to the `go.mod` for the affected module.
Expand Down
Loading

0 comments on commit b9f8254

Please sign in to comment.